/[dolibarr]/dolibarr/htdocs/telephonie/script/facturation-analyse.php
ViewVC logotype

Diff of /dolibarr/htdocs/telephonie/script/facturation-analyse.php

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.1 by rodolphe, Mon May 9 15:00:04 2005 UTC revision 1.2 by rodolphe, Wed Jul 27 13:09:46 2005 UTC
# Line 25  Line 25 
25   */   */
26    
27  /**  /**
28     \file       htdocs/telephonie/script/facturation-emission.php     \file       htdocs/telephonie/script/facturation-analyse.php
29     \ingroup    telephonie     \ingroup    telephonie
30     \brief      Emission des factures     \brief      Analyse de la facturation
31     \version    $Revision$     \version    $Revision$
32  */  */
33    
# Line 39  $opt = getopt("l:c:"); Line 39  $opt = getopt("l:c:");
39  $limit = $opt['l'];  $limit = $opt['l'];
40  $optcontrat = $opt['c'];  $optcontrat = $opt['c'];
41    
42    /*
43     * analyse ratio cout fournisseur
44     *
45     */
46    
47    $datetime = time();
48    $date = strftime("%d%h%Y%Hh%Mm%S",$datetime);
49    $month = strftime("%m", $datetime);
50    $year = strftime("%Y", $datetime);
51    
52    if ($month == 1)
53    {
54      $month = "12";
55      $year = $year - 1;
56    }
57    else
58    {
59      $month = substr("00".($month - 1), -2) ;
60    }
61    
62    
63    $sql = "SELECT sum(cd.fourn_montant) as fourn_montant, sum(cd.cout_vente) as cout_vente";
64    $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_facture as tf";
65    $sql .= " ,    ".MAIN_DB_PREFIX."telephonie_communications_details as cd";
66    
67    $sql .= " WHERE tf.date = '".$year."-".$month."-01'";
68    $sql .= " AND tf.rowid = cd.fk_telephonie_facture";
69    $sql .= " GROUP BY cd.fk_fournisseur";
70    
71    $re2sql = $db->query($sql) ;
72    
73    if ( $re2sql )
74    {
75      $nu2m = $db->num_rows($re2sql);      
76      $j = 0;
77      while ($j < $nu2m)
78        {
79          $row = $db->fetch_row($re2sql);
80    
81          print $row[0].' '.$row[1]."\n";
82    
83          $j++;
84        }
85    }
86    else
87    {
88      print $db->error();
89    }
90    
91    
92    
93    
94    
95    
96    
97    
98    
99    /*
100     * Partie 2
101     *
102     */
103    
104    
105    
106  require_once (DOL_DOCUMENT_ROOT."/includes/php_writeexcel/class.writeexcel_workbook.inc.php");  require_once (DOL_DOCUMENT_ROOT."/includes/php_writeexcel/class.writeexcel_workbook.inc.php");
107  require_once (DOL_DOCUMENT_ROOT."/includes/php_writeexcel/class.writeexcel_worksheet.inc.php");  require_once (DOL_DOCUMENT_ROOT."/includes/php_writeexcel/class.writeexcel_worksheet.inc.php");
108    

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.2

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26