/**
  * Fill the body of email's message with a close cash
  *
  * @param int $id
  *
  * @return string		String with ticket data
  */
 public static function FillMailCloseCashBody($id)
 {
     global $db, $conf, $langs, $mysoc;
     $sql = "select fk_user, date_c, fk_cash, ref";
     $sql .= " from " . MAIN_DB_PREFIX . "pos_control_cash";
     $sql .= " where rowid = " . $id;
     $result = $db->query($sql);
     if ($result) {
         $objp = $db->fetch_object($result);
         $date = $objp->date_c;
         $fk_user = $objp->fk_user;
         $terminal = $objp->fk_cash;
         $ref = $objp->ref;
     }
     $message = $conf->global->MAIN_INFO_SOCIETE_NOM . " \n" . $conf->global->MAIN_INFO_SOCIETE_ADRESSE . " \n" . $conf->global->MAIN_INFO_SOCIETE_CP . ' ' . $conf->global->MAIN_INFO_SOCIETE_VILLE . " \n\n";
     $message .= $langs->transnoentities("CloseCashReport") . ': ' . $ref . "\n";
     $cash = new Cash($db);
     $cash->fetch($terminal);
     $message .= $langs->transnoentities("Terminal") . ': ' . $cash->name . "\n";
     $userstatic = new User($db);
     $userstatic->fetch($fk_user);
     $message .= $langs->transnoentities("User") . ': ' . $userstatic->firstname . ' ' . $userstatic->lastname . "\n";
     $message .= dol_print_date($db->jdate($date), 'dayhourtext') . "\n\n";
     $message .= $langs->transnoentities("TicketsCash") . "\n";
     $message .= $langs->transnoentities("Ticket") . "\t\t\t\t\t" . $langs->transnoentities("Total") . "\n";
     $sql = "SELECT t.ticketnumber, p.amount, t.type";
     $sql .= " FROM " . MAIN_DB_PREFIX . "pos_ticket as t, " . MAIN_DB_PREFIX . "pos_paiement_ticket as pt, " . MAIN_DB_PREFIX . "paiement as p";
     $sql .= " WHERE t.fk_control = " . $id . " AND t.fk_cash=" . $terminal . " AND p.fk_paiement=" . $cash->fk_modepaycash . " AND t.fk_statut > 0";
     $sql .= " AND p.rowid = pt.fk_paiement AND t.rowid = pt.fk_ticket ";
     $sql .= " UNION SELECT f.facnumber, p.amount, f.type";
     $sql .= " FROM " . MAIN_DB_PREFIX . "pos_facture as pf," . MAIN_DB_PREFIX . "facture as f, " . MAIN_DB_PREFIX . "paiement_facture as pfac, " . MAIN_DB_PREFIX . "paiement as p ";
     $sql .= " WHERE pf.fk_control_cash = " . $id . " AND pf.fk_cash=" . $terminal . " AND p.fk_paiement=" . $cash->fk_modepaycash . " AND pf.fk_facture = f.rowid and f.fk_statut > 0";
     $sql .= " AND p.rowid = pfac.fk_paiement AND f.rowid = pfac.fk_facture";
     $result = $db->query($sql);
     if ($result) {
         $num = $db->num_rows($result);
         if ($num > 0) {
             $i = 0;
             $subtotalcash = 0;
             while ($i < $num) {
                 $objp = $db->fetch_object($result);
                 $message .= $objp->ticketnumber . "\t\t" . price($objp->amount) . "\n";
                 $i++;
                 $subtotalcash += $objp->amount;
             }
         } else {
             $message .= $langs->transnoentities("NoTickets") . "\n";
         }
     }
     $message .= $langs->trans("TotalCash") . "\t" . price($subtotalcash) . " " . $langs->trans(currency_name($conf->currency)) . "\n";
     $message .= $langs->trans("TicketsCreditCard") . "\n";
     $message .= $langs->trans("Ticket") . "\t\t" . $langs->trans("Total") . "\n";
     // Credit card
     $sql = "SELECT t.ticketnumber, p.amount, t.type";
     $sql .= " FROM " . MAIN_DB_PREFIX . "pos_ticket as t, " . MAIN_DB_PREFIX . "pos_paiement_ticket as pt, " . MAIN_DB_PREFIX . "paiement as p";
     $sql .= " WHERE t.fk_control = " . $id . " AND t.fk_cash=" . $terminal . " AND (p.fk_paiement=" . $cash->fk_modepaybank . " OR p.fk_paiement=" . $cash->fk_modepaybank_extra . ")AND t.fk_statut > 0";
     $sql .= " AND p.rowid = pt.fk_paiement AND t.rowid = pt.fk_ticket ";
     $sql .= " UNION SELECT f.facnumber, p.amount, f.type";
     $sql .= " FROM " . MAIN_DB_PREFIX . "pos_facture as pf," . MAIN_DB_PREFIX . "facture as f, " . MAIN_DB_PREFIX . "paiement_facture as pfac, " . MAIN_DB_PREFIX . "paiement as p ";
     $sql .= " WHERE pf.fk_control_cash = " . $id . " AND pf.fk_cash=" . $terminal . " AND (p.fk_paiement=" . $cash->fk_modepaybank . " OR p.fk_paiement=" . $cash->fk_modepaybank_extra . ") AND pf.fk_facture = f.rowid and f.fk_statut > 0";
     $sql .= " AND p.rowid = pfac.fk_paiement AND f.rowid = pfac.fk_facture";
     $result = $db->query($sql);
     if ($result) {
         $num = $db->num_rows($result);
         if ($num > 0) {
             $i = 0;
             $subtotalcard = 0;
             while ($i < $num) {
                 $objp = $db->fetch_object($result);
                 $message .= $objp->ticketnumber . "\t\t" . price($objp->amount) . "\n";
                 $i++;
                 $subtotalcard += $objp->amount;
             }
         } else {
             $message .= $langs->transnoentities("NoTickets") . "\n";
         }
     }
     $message .= $langs->trans("TotalCard") . "\t" . price($subtotalcard) . " " . $langs->trans(currency_name($conf->currency)) . "\n";
     if (!empty($conf->rewards->enabled)) {
         $message .= $langs->trans("Points") . "\n";
         $message .= $langs->trans("Ticket");
         "\t\t" . $langs->trans("Total") . "\n";
         $sql = " SELECT f.facnumber, p.amount, f.type";
         $sql .= " FROM " . MAIN_DB_PREFIX . "pos_facture as pf," . MAIN_DB_PREFIX . "facture as f, " . MAIN_DB_PREFIX . "paiement_facture as pfac, " . MAIN_DB_PREFIX . "paiement as p ";
         $sql .= " WHERE pf.fk_control_cash = " . $id . " AND pf.fk_cash=" . $terminal . " AND p.fk_paiement= 100 AND pf.fk_facture = f.rowid and f.fk_statut > 0";
         $sql .= " AND p.rowid = pfac.fk_paiement AND f.rowid = pfac.fk_facture";
         $result = $db->query($sql);
         if ($result) {
             $num = $db->num_rows($result);
             if ($num > 0) {
                 $i = 0;
                 $subtotalpoint = 0;
                 while ($i < $num) {
                     $objp = $db->fetch_object($result);
                     $message .= $objp->facnumber . "\t\t" . price($objp->amount) . "\n";
                     $i++;
                     $subtotalpoint += $objp->amount;
                 }
             } else {
                 $message .= $langs->transnoentities("NoTickets") . "\n";
             }
         }
         $message .= $langs->trans("TotalPoints") . "\t" . price($subtotalpoint) . " " . $langs->trans(currency_name($conf->currency)) . "\n\n\n";
     }
     $sql = "SELECT t.ticketnumber, t.type, l.total_ht, l.tva_tx, l.total_tva, l.total_localtax1, l.total_localtax2, l.total_ttc";
     $sql .= " FROM " . MAIN_DB_PREFIX . "pos_ticket as t left join " . MAIN_DB_PREFIX . "pos_ticketdet as l on l.fk_ticket= t.rowid";
     $sql .= " WHERE t.fk_control = " . $id . " AND t.fk_cash=" . $terminal . " AND t.fk_statut > 0";
     $sql .= " UNION SELECT f.facnumber, f.type, fd.total_ht, fd.tva_tx, fd.total_tva, fd.total_localtax1, fd.total_localtax2, fd.total_ttc";
     $sql .= " FROM " . MAIN_DB_PREFIX . "pos_facture as pf," . MAIN_DB_PREFIX . "facture as f left join " . MAIN_DB_PREFIX . "facturedet as fd on fd.fk_facture= f.rowid";
     $sql .= " WHERE pf.fk_control_cash = " . $id . " AND pf.fk_cash=" . $terminal . " AND pf.fk_facture = f.rowid and f.fk_statut > 0";
     $result = $db->query($sql);
     if ($result) {
         $num = $db->num_rows($result);
         if ($num > 0) {
             $i = 0;
             $subtotalcardht = 0;
             while ($i < $num) {
                 $objp = $db->fetch_object($result);
                 $i++;
                 if ($objp->type == 1) {
                     $objp->total_ht = $objp->total_ht * -1;
                     $objp->total_tva = $objp->total_tva * -1;
                     $objp->total_ttc = $objp->total_ttc * -1;
                     $objp->total_localtax1 = $objp->total_localtax1 * -1;
                     $objp->total_localtax2 = $objp->total_localtax2 * -1;
                 }
                 $subtotalcardht += $objp->total_ht;
                 $subtotalcardtva[$objp->tva_tx] += $objp->total_tva;
                 $subtotalcardttc += $objp->total_ttc;
                 $subtotalcardlt1 += $objp->total_localtax1;
                 $subtotalcardlt2 += $objp->total_localtax2;
             }
         }
     }
     $message .= "------------------\n";
     if (!empty($subtotalcardht)) {
         $message .= $langs->trans("TotalHT") . "\t" . price($subtotalcardht) . " " . $langs->trans(currency_name($conf->currency)) . "\n";
     }
     if (!empty($subtotalcardtva)) {
         foreach ($subtotalcardtva as $tvakey => $tvaval) {
             if ($tvakey > 0) {
                 $message .= $langs->trans("TotalVAT") . ' ' . round($tvakey) . '%' . "\t" . price($tvaval) . " " . $langs->trans(currency_name($conf->currency)) . "\n";
             }
         }
     }
     if ($subtotalcardlt1) {
         $message .= $langs->transcountrynoentities("TotalLT1", $mysoc->country_code) . "\t" . price($subtotalcardlt1) . " " . $langs->trans(currency_name($conf->currency)) . "\n";
     }
     if ($subtotalcardlt2) {
         $message .= $langs->transcountrynoentities("TotalLT2", $mysoc->country_code) . "\t" . price($subtotalcardlt2) . " " . $langs->trans(currency_name($conf->currency)) . "\n";
     }
     $message .= $langs->trans("TotalPOS") . "\t" . price($subtotalcardttc) . " " . $langs->trans(currency_name($conf->currency)) . "\n";
     return $message;
 }
                $error++;
            }
            if (!$error) {
                $result = $accountfrom->add_url_line($bank_line_id_from, $bank_line_id_to, DOL_URL_ROOT . '/compta/bank/ligne.php?rowid=', '(banktransfert)', 'banktransfert');
            }
            if (!($result > 0)) {
                $error++;
            }
            if (!$error) {
                $result = $accountto->add_url_line($bank_line_id_to, $bank_line_id_from, DOL_URL_ROOT . '/compta/bank/ligne.php?rowid=', '(banktransfert)', 'banktransfert');
            }
            if (!($result > 0)) {
                $error++;
            }
            if (!$error) {
                setEventMessage($langs->trans("TransferFromToDone", $accountfrom->label, $accountto->label, $amount, $langs->trans(currency_name($conf->currency))));
                $db->commit();
            } else {
                setEventMessage($accountfrom->error . ' ' . $accountto->error, "errors");
                $db->rollback();
            }
        } else {
            setEventMessage($langs->trans("ErrorFromToAccountsMustDiffers"), "errors");
        }
    }
}
/*
 * Affichage
 */
$helpurl = 'EN:Module_DoliPos|FR:Module_DoliPos_FR|ES:M&oacute;dulo_DoliPos';
llxHeader('', '', $helpurl);
$terminal = new Cash($db);
$terminal->fetch($object->fk_cash);
$pay = $object->getSommePaiement();
if ($object->customer_pay > $pay) {
    $pay = $object->customer_pay;
}
$diff_payment = $object->total_ttc - $pay;
$listofpayments = $object->getListOfPayments();
foreach ($listofpayments as $paym) {
    if ($paym['type'] != 'LIQ') {
        echo '<tr><th nowrap="nowrap">' . $terminal->select_Paymentname(dol_getIdFromCode($db, $paym['type'], 'c_paiement')) . '</th><td nowrap="nowrap">' . price($paym['amount'], "", "", "", "", 2) . " " . $langs->trans(currency_name($conf->currency)) . "</td></tr>";
    } else {
        echo '<tr><th nowrap="nowrap">' . $terminal->select_Paymentname(dol_getIdFromCode($db, $paym['type'], 'c_paiement')) . '</th><td nowrap="nowrap">' . price($paym['amount'] - ($diff_payment < 0 ? $diff_payment : 0), "", "", "", "", 2) . " " . $langs->trans(currency_name($conf->currency)) . "</td></tr>";
    }
}
echo '<tr><th nowrap="nowrap">' . ($diff_payment < 0 ? $langs->trans("CustomerRet") : $langs->trans("CustomerDeb")) . '</th><td nowrap="nowrap">' . price(abs($diff_payment), "", "", "", "", 2) . " " . $langs->trans(currency_name($conf->currency)) . "</td></tr>";
?>
</table>

<div class="note"><p><?php 
print $conf->global->POS_PREDEF_MSG;
?>
 </p></div>


<script type="text/javascript">

	window.print();
	<?php 
if ($conf->global->POS_CLOSE_WIN) {
    ?>
    echo '<tr><th nowrap="nowrap" style="border-top: 1px solid #000000;">' . $langs->trans("TotalHT") . '</th><td nowrap="nowrap" style="border-top: 1px solid #000000;">' . price($subtotalcardht) . " " . $langs->trans(currency_name($conf->currency)) . "</td></tr>";
}
if (!empty($subtotalcardtva)) {
    foreach ($subtotalcardtva as $tvakey => $tvaval) {
        if ($tvakey > 0) {
            echo '<tr><th nowrap="nowrap">' . $langs->trans("TotalVAT") . ' ' . round($tvakey) . '%' . '</th><td nowrap="nowrap">' . price($tvaval) . " " . $langs->trans(currency_name($conf->currency)) . "</td></tr>";
        }
    }
}
if ($subtotalcardlt1) {
    echo '<tr><th nowrap="nowrap">' . $langs->transcountrynoentities("TotalLT1", $mysoc->country_code) . '</th><td nowrap="nowrap">' . price($subtotalcardlt1) . " " . $langs->trans(currency_name($conf->currency)) . "</td></tr>";
}
if ($subtotalcardlt2) {
    echo '<tr><th nowrap="nowrap">' . $langs->transcountrynoentities("TotalLT2", $mysoc->country_code) . '</th><td nowrap="nowrap">' . price($subtotalcardlt2) . " " . $langs->trans(currency_name($conf->currency)) . "</td></tr>";
}
echo '<tr><th nowrap="nowrap">' . $langs->trans("TotalPOS") . '</th><td nowrap="nowrap">' . price($subtotalcardttc) . " " . $langs->trans(currency_name($conf->currency)) . "</td></tr>";
echo '</table>';
?>
<br><br>
<script type="text/javascript">

	window.print();
	<?php 
if ($conf->global->POS_CLOSE_WIN) {
    ?>
	window.close();
	<?php 
}
?>
	
</script>
Example #5
0
     print getCountry($mysoc->country_code, 1);
 } else {
     print img_warning() . ' <font class="error">' . $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("CompanyCountry")) . '</font>';
 }
 print '</td></tr>';
 $var = !$var;
 print '<tr ' . $bc[$var] . '><td>' . $langs->trans("State") . '</td><td>';
 if ($conf->global->MAIN_INFO_SOCIETE_DEPARTEMENT) {
     print getState($conf->global->MAIN_INFO_SOCIETE_DEPARTEMENT);
 } else {
     print '&nbsp;';
 }
 print '</td></tr>';
 $var = !$var;
 print '<tr ' . $bc[$var] . '><td width="35%">' . $langs->trans("CompanyCurrency") . '</td><td>';
 print currency_name($conf->currency, 1);
 print ' (' . getCurrencySymbol($conf->currency) . ')';
 print '</td></tr>';
 $var = !$var;
 print '<tr ' . $bc[$var] . '><td width="35%">' . $langs->trans("Tel") . '</td><td>' . dol_print_phone($conf->global->MAIN_INFO_SOCIETE_TEL, $mysoc->country_code) . '</td></tr>';
 $var = !$var;
 print '<tr ' . $bc[$var] . '><td width="35%">' . $langs->trans("Fax") . '</td><td>' . dol_print_phone($conf->global->MAIN_INFO_SOCIETE_FAX, $mysoc->country_code) . '</td></tr>';
 $var = !$var;
 print '<tr ' . $bc[$var] . '><td width="35%">' . $langs->trans("Mail") . '</td><td>' . dol_print_email($conf->global->MAIN_INFO_SOCIETE_MAIL, 0, 0, 0, 80) . '</td></tr>';
 // Web
 $var = !$var;
 print '<tr ' . $bc[$var] . '><td width="35%">' . $langs->trans("Web") . '</td><td>' . dol_print_url($conf->global->MAIN_INFO_SOCIETE_WEB, '_blank', 80) . '</td></tr>';
 // Barcode
 if (!empty($conf->barcode->enabled)) {
     $var = !$var;
     print '<tr ' . $bc[$var] . '><td width="35%">' . $langs->trans("Gencod") . '</td><td>' . $conf->global->MAIN_INFO_SOCIETE_GENCOD . '</td></tr>';
        foreach ($subtotalcardtva as $tvakey => $tvaval) {
            if ($tvakey > 0) {
                $desg = $langs->trans("TotalVAT") . ' ' . round($tvakey) . '%' . " " . price($tvaval) . " " . $langs->trans(currency_name($conf->currency));
                $desgs[] = $desg;
            }
        }
    } else {
        $desg = $langs->transnoentities("NoTickets");
        $desgs[] = $desg;
    }
    $json_data['desg_lines'] = $desgs;
    if ($subtotalcardlt1) {
        $json_data['localtax1'] = $langs->transcountrynoentities("TotalLT1", $mysoc->country_code) . " " . price($subtotalcardlt1) . " " . $langs->trans(currency_name($conf->currency));
    } else {
        $json_data['localtax1'] = "";
    }
    if ($subtotalcardlt2) {
        $json_data['localtax2'] = $langs->transcountrynoentities("TotalLT2", $mysoc->country_code) . " " . price($subtotalcardlt2) . " " . $langs->trans(currency_name($conf->currency));
    } else {
        $json_data['localtax2'] = "";
    }
    $json_data['total_pos'] = $langs->trans("TotalPOS") . " " . price($subtotalcardttc) . " " . $langs->trans(currency_name($conf->currency));
}
if ($pending_print[0][0] == "D") {
    $json_data['type'] = "D";
}
$drop = strlen($id);
$drop++;
$drop++;
dolibarr_set_const($db, "POS_PENDING_PRINT", substr($conf->global->POS_PENDING_PRINT, $drop), 'chaine', 0);
print json_encode($json_data);
 /**
  * 
  * Create a pdf with the labels
  *
  */
 function createPdf()
 {
     global $conf, $mysoc, $db, $langs;
     $langs->load("other");
     require_once DOL_DOCUMENT_ROOT . '/includes/tcpdf/tcpdf.php';
     require_once DOL_DOCUMENT_ROOT . "/product/class/product.class.php";
     require_once DOL_DOCUMENT_ROOT . "/core/lib/product.lib.php";
     $pdf = new TCPDF();
     $pdf->SetFont('dejavusans', '', 10);
     $lab_start = $conf->global->LAB_START;
     if ($conf->global->MAIN_MODULE_LABELPRINT_LABELS_0) {
         $PosY = 5 + floor($lab_start / 3) * 36;
     } else {
         $PosY = 4 + floor($lab_start / 3) * 37;
     }
     //$PosY=3;
     $PosX = 5 + $lab_start % 3 * 70;
     //$PosX=5;
     $Line = 5;
     // define barcode style
     $style = array('position' => '', 'align' => 'C', 'stretch' => false, 'fitwidth' => true, 'cellfitalign' => '', 'border' => false, 'hpadding' => 'auto', 'vpadding' => 'auto', 'fgcolor' => array(0, 0, 0), 'bgcolor' => false, 'text' => true, 'font' => 'helvetica', 'fontsize' => 8, 'stretchtext' => 4);
     //First page
     $pdf->AddPage();
     $sql = "SELECT fk_product, qty, price_level";
     $sql .= " FROM " . MAIN_DB_PREFIX . "labelprint";
     $sql .= " WHERE entity=" . $conf->entity;
     $resql = $db->query($sql);
     if ($resql) {
         $num = $db->num_rows($resql);
         $i = 0;
         while ($i < $num) {
             $objp = $db->fetch_object($resql);
             $product = new Product($db);
             $product->fetch($objp->fk_product);
             $qty = $objp->qty;
             $n = 0;
             while ($n < $qty) {
                 //Position X
                 $PosXLabel = $PosX < 70 ? $PosX : $PosX - 3;
                 //Soc Name
                 $pdf->SetFont('dejavusans', 'B', 10);
                 $pdf->SetXY($PosXLabel, $PosY);
                 $pdf->SetFillColor(230, 230, 230);
                 if ($conf->global->LAB_COMP) {
                     $pdf->MultiCell(65, 5, dol_trunc($mysoc->nom, 25), 0, 'L');
                     $flag = 1;
                 } elseif ($conf->global->LAB_PROD_LABEL) {
                     $pdf->MultiCell(65, 5, dol_trunc($product->libelle, 25), 0, 'L');
                     $flag = 2;
                 } else {
                     $pdf->MultiCell(65, 5, dol_trunc($conf->global->LAB_FREE_TEXT, 25), 0, 'L');
                     $flag = 3;
                 }
                 $pdf->SetFont('dejavusans', '', 10);
                 //Position Y
                 $PosYLabel = $PosY + $Line + 2;
                 //Product label
                 $pdf->SetXY($PosXLabel, $PosYLabel);
                 if ($flag == 1) {
                     if ($conf->global->LAB_PROD_LABEL) {
                         $pdf->Cell(25, 5, dol_trunc($product->libelle, 25), 0, 0, 'L');
                     } else {
                         $pdf->Cell(25, 5, dol_trunc($conf->global->LAB_FREE_TEXT, 25), 0, 0, 'L');
                     }
                 }
                 if ($flag == 2) {
                     $pdf->Cell(25, 5, dol_trunc($conf->global->LAB_FREE_TEXT, 25), 0, 0, 'L');
                 } else {
                     $pdf->Cell(25, 5, "", 0, 0, 'L');
                 }
                 //$pdf->Cell(25,5,dol_trunc($product->libelle,25),0,0,'L');
                 //$pdf->Write($Line,dol_trunc($product->libelle,25));
                 $PosYLabel = $PosYLabel + $Line + 2;
                 $pdf->SetXY($PosXLabel, $PosYLabel);
                 //Barcode
                 if ($conf->barcode->enabled) {
                     $product->fetch_barcode();
                     $pdf->write1DBarcode($product->barcode, $product->barcode_type_code, '', '', 35, 18, 0.4, $style, 'N');
                 }
                 //Price
                 $pdf->SetFont('dejavusans', 'B', 10);
                 if (empty($conf->global->PRODUIT_MULTIPRICES)) {
                     $labelPrice = price($product->price_ttc);
                 } else {
                     $labelPrice = price($product->multiprices_ttc[$objp->price_level]);
                 }
                 $pdf->SetXY($PosXLabel + 38, $PosYLabel);
                 $pdf->Cell(25, 5, $labelPrice, 0, 0, 'R');
                 $PosYLabel = $PosYLabel + $Line + 1;
                 $labelPrice = $langs->trans(currency_name($conf->currency));
                 $pdf->SetXY($PosXLabel + 38, $PosYLabel);
                 $pdf->Cell(25, 5, $labelPrice, 0, 0, 'R');
                 $PosYLabel = $PosYLabel + $Line;
                 if ($conf->global->LAB_WEIGHT) {
                     $labelSet = $product->weight;
                     $labelSet .= " " . measuring_units_string($product->weight_units, "weight");
                 } elseif ($conf->global->LAB_LENGTH) {
                     $labelSet = $product->length;
                     $labelSet .= " " . measuring_units_string($product->length_units, "size");
                 } elseif ($conf->global->LAB_AREA) {
                     $labelSet = $product->surface;
                     $labelSet .= " " . measuring_units_string($product->surface_units, "surface");
                 } elseif ($conf->global->LAB_VOLUME) {
                     $labelSet = $product->volume;
                     $labelSet .= " " . measuring_units_string($product->volume_units, "volume");
                 } elseif ($conf->global->LAB_COUNTRY) {
                     $labelSet = getCountry($product->country_id, '', 0, $langs, 0);
                 }
                 $pdf->SetXY($PosXLabel + 38, $PosYLabel);
                 $pdf->Cell(25, 5, $labelSet, 0, 0, 'R');
                 $pdf->SetAutoPageBreak(false);
                 $PosX = $PosX + 70;
                 if ($PosX >= 200) {
                     $PosX = 5;
                     if ($conf->global->MAIN_MODULE_LABELPRINT_LABELS_0) {
                         $PosY = $PosY + 36;
                     } else {
                         $PosY = $PosY + 37;
                     }
                     if ($PosY >= 265) {
                         if ($conf->global->MAIN_MODULE_LABELPRINT_LABELS_0) {
                             $PosY = 5;
                         } else {
                             $PosY = 4;
                         }
                         $pdf->AddPage();
                     }
                 }
                 $n++;
             }
             $i++;
         }
     }
     ini_set('display_errors', 'Off');
     $buf = $pdf->Output("", "S");
     $len = strlen($buf);
     //$file_temp = ini_get("session.save_path")."/".dol_now().".pdf";
     $file_temp = DOL_DATA_ROOT . "/" . dol_now() . ".pdf";
     $gestor = fopen($file_temp, "w");
     fwrite($gestor, $buf);
     fclose($gestor);
     $url = dol_buildpath("/labelprint/download.php", 1) . "?file=" . $file_temp;
     print "<meta http-equiv='refresh' content='0;url=" . $url . "'>";
 }
Example #8
0
				print $form->textwithpicto($object->display_incoterms(), $object->libelle_incoterms, 1);
			}
			else
			{
				print $form->select_incoterms((!empty($object->fk_incoterms) ? $object->fk_incoterms : ''), (!empty($object->location_incoterms)?$object->location_incoterms:''), $_SERVER['PHP_SELF'].'?socid='.$object->id);
			}
            print '</td></tr>';
		}

		// Multicurrency
		if (! empty($conf->multicurrency->enabled))
		{
			print '<tr>';
			print '<td>'.fieldLabel('Currency','multicurrency_code').'</td>';
	        print '<td>';
	        print !empty($object->multicurrency_code) ? currency_name($object->multicurrency_code,1) : '';
			print '</td></tr>';
		}
		
        // Other attributes
        $parameters=array('socid'=>$socid, 'colspan' => ' colspan="3"', 'colspanvalue' => '3');
        $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action);    // Note that $action and $object may have been modified by hook
        print $hookmanager->resPrint;
        if (empty($reshook) && ! empty($extrafields->attribute_label))
        {
        	print $object->showOptionals($extrafields);
        }

        // Ban
        if (empty($conf->global->SOCIETE_DISABLE_BANKACCOUNT))
        {
 print '<td>' . $langs->trans(currency_name($conf->currency)) . '</td></tr>';
 // Amount Local Taxes
 if ($mysoc->country_code == 'ES') {
     if ($mysoc->localtax1_assuj == "1") {
         print '<tr><td>' . $langs->transcountry("AmountLT1", $mysoc->country_code) . '</td>';
         print '<td align="right" colspan="2" nowrap>' . price($object->total_localtax1) . '</td>';
         print '<td>' . $langs->trans(currency_name($conf->currency)) . '</td></tr>';
     }
     if ($mysoc->localtax2_assuj == "1") {
         print '<tr><td>' . $langs->transcountry("AmountLT2", $mysoc->country_code) . '</td>';
         print '<td align="right" colspan="2" nowrap>' . price($object->total_localtax2) . '</td>';
         print '<td>' . $langs->trans(currency_name($conf->currency)) . '</td></tr>';
     }
 }
 print '<tr><td>' . $langs->trans('AmountTTC') . '</td><td align="right" colspan="2" nowrap>' . price($object->total_ttc) . '</td>';
 print '<td>' . $langs->trans(currency_name($conf->currency)) . '</td></tr>';
 // Statut
 print '<tr><td>' . $langs->trans('Status') . '</td>';
 print '<td align="left" colspan="3">' . $object->getLibStatut(1) . '</td></tr>';
 // Note
 print '<tr><td>' . $langs->trans('Note') . '</td>';
 print '<td align="left" colspan="3">' . $object->note . '</td></tr>';
 print '</table><br>';
 /*
  * Lines
  */
 $result = $object->getLinesArray();
 if ($conf->use_javascript_ajax && $object->statut == 0) {
     include DOL_DOCUMENT_ROOT . '/core/tpl/ajaxrow.tpl.php';
 }
 print '<table id="tablelines" class="noborder" width="100%">';
 /**
  *    Show form with multicurrency code
  *
  *    @param	string	$page        	Page
  *    @param    string	$selected    	code pre-selectionne
  *    @param    string	$htmlname    	Name of select html field
  *    @return	void
  */
 function form_multicurrency_code($page, $selected = '', $htmlname = 'multicurrency_code')
 {
     global $langs;
     if ($htmlname != "none") {
         print '<form method="POST" action="' . $page . '">';
         print '<input type="hidden" name="action" value="setmulticurrencycode">';
         print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
         print '<table class="nobordernopadding" cellpadding="0" cellspacing="0">';
         print '<tr><td>';
         print $this->selectMultiCurrency($selected, $htmlname);
         print '</td>';
         print '<td align="left"><input type="submit" class="button" value="' . $langs->trans("Modify") . '"></td>';
         print '</tr></table></form>';
     } else {
         dol_include_once('/core/lib/company.lib.php');
         print !empty($selected) ? currency_name($selected, 1) : '&nbsp;';
     }
 }
                print "</table>";
                //print "</td></tr>\n";
            }
            $db->free($resql);
        } else {
            dol_print_error($db);
        }
        // Bouton Enregistrer
        if ($action != 'add_paiement') {
            print '<center><br><input type="submit" class="button" value="' . $langs->trans('Save') . '"><br></center>';
        }
        // Message d'erreur
        if ($fiche_erreur_message) {
            print $fiche_erreur_message;
        }
        // Form to confirm payment
        if ($action == 'add_paiement') {
            $preselectedchoice = $addwarning ? 'no' : 'yes';
            print '<br>';
            $text = $langs->trans('ConfirmCustomerPayment', $totalpaiement, $langs->trans(currency_name($conf->currency)));
            if (GETPOST('closepaidinvoices')) {
                $text .= '<br>' . $langs->trans("AllCompletelyPayedInvoiceWillBeClosed");
                print '<input type="hidden" name="closepaidinvoices" value="' . GETPOST('closepaidinvoices') . '">';
            }
            $html->form_confirm($_SERVER['PHP_SELF'] . '?ticketid=' . $ticket->id . '&socid=' . $ticket->socid . '&type=' . $ticket->type, $langs->trans('ReceivedCustomersPayments'), $text, 'confirm_paiement', $formquestion, $preselectedchoice);
        }
        print "</form>\n";
    }
}
$db->close();
llxFooter('$Date: 2011/08/08 01:01:46 $ - $Revision: 1.114 $');