Exemplo n.º 1
0
if (isset($_POST['preview'])) {
   $rs=getDocumentsBill();
   echo "<BR /><div align=\"center\"><b>".$script_transl['preview']."</b></div>";
   echo "<table class=\"Tlarge\">";
   echo "<th class=\"FacetFieldCaptionTD\">".$script_transl['date_reg']."</th>
         <th class=\"FacetFieldCaptionTD\">".$script_transl['protoc']."</th>
         <th class=\"FacetFieldCaptionTD\">".$script_transl['doc_type']."</th>
         <th class=\"FacetFieldCaptionTD\">N.</th>
         <th class=\"FacetFieldCaptionTD\">".$script_transl['customer']."</th>
         <th class=\"FacetFieldCaptionTD\">".$script_transl['tot']."</th>\n";
   $ctrl_date='';
   $tot_type=array('B'=>0,'T'=>0,'V'=>0);

   foreach($rs as $k=>$v) {
         if($ctrl_date <> substr($v['tes']['datfat'],0,4)) {
            $n=getReceiptNumber($v['tes']['datfat']);
         }
         // calcolo i totali
         $stamp=false;
         $round=0;
         $tot=computeTot($v['vat'],$v['car']-$v['rit']);
	 //fine calcolo totali
         echo "<tr class=\"FacetDataTD\">
               <td align=\"center\">".gaz_format_date($v['tes']['datfat'])."</td>
               <td align=\"center\">".$v['tes']['protoc'].'/'.$v['tes']['seziva']."</td>
               <td>".$script_transl['doc_type_value'][$v['tes']['tipdoc']]."</td>
               <td>".$v['tes']['numfat']."</td>
               <td>".$v['tes']['ragsoc']."</td>
               <td align=\"right\">".gaz_format_number($tot['tot'])."</td>
               </tr>\n";
               $rate = CalcolaScadenze($tot['tot'],substr($v['tes']['datfat'],8,2),substr($v['tes']['datfat'],5,2),substr($v['tes']['datfat'],0,4),$v['tes']['tipdec'],$v['tes']['giodec'],$v['tes']['numrat'],$v['tes']['tiprat'],$v['tes']['mesesc'],$v['tes']['giosuc']);
Exemplo n.º 2
0
     }
 }
 $curl = curl_init();
 curl_setopt($curl, CURLOPT_URL, "https://my.izettle.com/login");
 curl_setopt($curl, CURLOPT_POSTFIELDS, "user[email_address]=XXX&user[password]=XXX");
 curl_setopt($curl, CURLOPT_COOKIEJAR, dirname(__FILE__) . "/cookie.txt");
 curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
 curl_exec($curl);
 curl_close($curl);
 $matches = getTransactionHrefs($_POST['transactions']);
 $tranx = [];
 $count = 0;
 $zeroCount = 0;
 foreach ($matches as $match) {
     $rawData = curlIndividualReciept($match);
     $receiptNumber = getReceiptNumber($rawData);
     $parsedData = parseRawData($rawData);
     $totalPaid = getTotalPaid($rawData);
     $paymentType = paymentType($rawData);
     if ($totalPaid == 0 && $zeroCount == 1) {
         // if this is the second zero total paid, finish.
         break;
     } elseif ($totalPaid == 0) {
         // if this is the first total paid, make the zero count equal to one.
         $zeroCount = 1;
         continue;
     } elseif ($zeroCount == 0) {
         // if this is an amount BEFORE the first zero count, skip this iteration.
         continue;
     }
     array_shift($parsedData);