25 require
'../../main.inc.php';
27 require_once DOL_DOCUMENT_ROOT.
'/compta/facture/class/facture.class.php';
28 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formaccounting.class.php';
31 $langs->loadLangs(array(
"bills",
"accountancy"));
33 $action =
GETPOST(
'action',
'aZ09');
34 $cancel =
GETPOST(
'cancel',
'alpha');
35 $backtopage =
GETPOST(
'backtopage',
'alpha');
37 $codeventil =
GETPOST(
'codeventil',
'int');
49 if ($action ==
'ventil' && $user->rights->accounting->bind->write)
53 if ($codeventil < 0) $codeventil = 0;
55 $sql =
" UPDATE ".MAIN_DB_PREFIX.
"facturedet";
56 $sql .=
" SET fk_code_ventilation = ".$codeventil;
57 $sql .=
" WHERE rowid = ".$id;
63 setEventMessages($langs->trans(
"RecordModifiedSuccessfully"), null,
'mesgs');
66 header(
"Location: ".$backtopage);
71 header(
"Location: ./lines.php");
81 llxHeader(
"", $langs->trans(
'FicheVentilation'));
83 if ($cancel == $langs->trans(
"Cancel")) {
90 $form =
new Form($db);
91 $facture_static =
new Facture($db);
95 $sql =
"SELECT f.ref, f.rowid as facid, l.fk_product, l.description, l.price,";
96 $sql .=
" l.qty, l.rowid, l.tva_tx, l.remise_percent, l.subprice, p.accountancy_code_sell as code_sell,";
97 $sql .=
" l.fk_code_ventilation, aa.account_number, aa.label";
98 $sql .=
" FROM ".MAIN_DB_PREFIX.
"facturedet as l";
99 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"product as p ON p.rowid = l.fk_product";
100 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"accounting_account as aa ON l.fk_code_ventilation = aa.rowid";
101 $sql .=
" INNER JOIN ".MAIN_DB_PREFIX.
"facture as f ON f.rowid = l.fk_facture";
102 $sql .=
" WHERE f.fk_statut > 0 AND l.rowid = ".$id;
103 $sql .=
" AND f.entity IN (".getEntity(
'invoice', 0).
")";
105 dol_syslog(
"/accounting/customer/card.php sql=".$sql, LOG_DEBUG);
106 $result = $db->query($sql);
109 $num_lines = $db->num_rows($result);
113 $objp = $db->fetch_object($result);
115 print '<form action="'.$_SERVER[
"PHP_SELF"].
'?id='.$id.
'" method="post">'.
"\n";
116 print '<input type="hidden" name="token" value="'.newToken().
'">';
117 print '<input type="hidden" name="action" value="ventil">';
118 print '<input type="hidden" name="backtopage" value="'.dol_escape_htmltag($backtopage).
'">';
124 print '<table class="border centpercent">';
127 print '<tr><td>'.$langs->trans(
"Invoice").
'</td>';
128 $facture_static->ref = $objp->ref;
129 $facture_static->id = $objp->facid;
130 print '<td>'.$facture_static->getNomUrl(1).
'</td>';
133 print '<tr><td width="20%">'.$langs->trans(
"Line").
'</td>';
134 print '<td>'.nl2br($objp->description).
'</td></tr>';
135 print '<tr><td width="20%">'.$langs->trans(
"Account").
'</td><td>';
136 print $formaccounting->select_account($objp->fk_code_ventilation,
'codeventil', 1);
142 print '<div class="center">';
143 print '<input class="button button-save" type="submit" value="'.$langs->trans(
"Save").
'">';
144 print ' ';
145 print '<input class="button button-cancel" type="submit" name="cancel" value="'.$langs->trans(
"Cancel").
'">';
156 print "Error ID incorrect";
GETPOST($paramname, $check= 'alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
setEventMessages($mesg, $mesgs, $style= 'mesgs', $messagekey= '')
Set event messages in dol_events session object.
load_fiche_titre($titre, $morehtmlright= '', $picto= 'generic', $pictoisfullpath=0, $id= '', $morecssontable= '', $morehtmlcenter= '')
Load a title with picto.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename= '', $restricttologhandler= '', $logcontext=null)
Write log message into outputs.
accessforbidden($message= '', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program Calling this function terminate execution ...
dol_get_fiche_head($links=array(), $active= '', $title= '', $notab=0, $picto= '', $pictoisfullpath=0, $morehtmlright= '', $morecss= '', $limittoshow=0, $moretabssuffix= '')
Show tabs of a record.
print
Draft customers invoices.
if(!empty($conf->facture->enabled)&&$user->rights->facture->lire) if((!empty($conf->fournisseur->enabled)&&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)||!empty($conf->supplier_invoice->enabled))&&$user->rights->fournisseur->facture->lire) if(!empty($conf->don->enabled)&&$user->rights->don->lire) if(!empty($conf->tax->enabled)&&$user->rights->tax->charges->lire) if(!empty($conf->facture->enabled)&&!empty($conf->commande->enabled)&&$user->rights->commande->lire &&empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) if(!empty($conf->facture->enabled)&&$user->rights->facture->lire) if((!empty($conf->fournisseur->enabled)&&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)||!empty($conf->supplier_invoice->enabled))&&$user->rights->fournisseur->facture->lire) $resql
Social contributions to pay.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
Class to manage invoices.