Debug v17
This commit is contained in:
parent
247d950e6a
commit
285a5e38f1
@ -189,7 +189,7 @@ print '<script type="text/javascript">
|
||||
/*
|
||||
* Customer Invoice lines
|
||||
*/
|
||||
$sql = "SELECT f.rowid as facid, f.ref as ref, f.type, f.datef, f.ref_client,";
|
||||
$sql = "SELECT f.rowid as facid, f.ref as ref, f.type as ftype, f.datef, f.ref_client,";
|
||||
$sql .= " fd.rowid, fd.description, fd.product_type as line_type, fd.total_ht, fd.total_tva, fd.tva_tx, fd.vat_src_code, fd.total_ttc,";
|
||||
$sql .= " s.rowid as socid, s.nom as name, s.code_client,";
|
||||
if (!empty($conf->global->MAIN_COMPANY_PERENTITY_SHARED)) {
|
||||
@ -199,7 +199,7 @@ if (!empty($conf->global->MAIN_COMPANY_PERENTITY_SHARED)) {
|
||||
$sql .= " s.code_compta as code_compta_client,";
|
||||
$sql .= " s.code_compta_fournisseur,";
|
||||
}
|
||||
$sql .= " p.rowid as product_id, p.fk_product_type as product_type, p.ref as product_ref, p.label as product_label,";
|
||||
$sql .= " p.rowid as product_id, p.fk_product_type as product_type, p.ref as product_ref, p.label as product_label, p.tobuy, p.tosell,";
|
||||
if (!empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) {
|
||||
$sql .= " ppe.accountancy_code_sell, ppe.accountancy_code_sell_intra, ppe.accountancy_code_sell_export,";
|
||||
} else {
|
||||
|
||||
@ -496,7 +496,7 @@ if ($result) {
|
||||
print '<td class="liste_titre right"><input type="text" class="flat maxwidth50 right" name="search_vat" placeholder="%" size="1" value="'.dol_escape_htmltag($search_vat).'"></td>';
|
||||
print '<td class="liste_titre"><input type="text" class="flat maxwidth75imp" name="search_societe" value="'.dol_escape_htmltag($search_societe).'"></td>';
|
||||
print '<td class="liste_titre">';
|
||||
print $form->select_country($search_country, 'search_country', '', 0, 'maxwidth125', 'code2', 1, 0, 1, null, 1);
|
||||
print $form->select_country($search_country, 'search_country', '', 0, 'maxwidth100', 'code2', 1, 0, 1);
|
||||
//print '<input type="text" class="flat maxwidth50" name="search_country" value="' . dol_escape_htmltag($search_country) . '">';
|
||||
print '</td>';
|
||||
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_tvaintra" value="'.dol_escape_htmltag($search_tvaintra).'"></td>';
|
||||
|
||||
@ -49,7 +49,7 @@ $search_societe = GETPOST('search_societe', 'alpha');
|
||||
$search_lineid = GETPOST('search_lineid', 'int');
|
||||
$search_ref = GETPOST('search_ref', 'alpha');
|
||||
$search_invoice = GETPOST('search_invoice', 'alpha');
|
||||
$search_ref_supplier = GETPOST('search_ref_supplier', 'alpha');
|
||||
//$search_ref_supplier = GETPOST('search_ref_supplier', 'alpha');
|
||||
$search_label = GETPOST('search_label', 'alpha');
|
||||
$search_desc = GETPOST('search_desc', 'alpha');
|
||||
$search_amount = GETPOST('search_amount', 'alpha');
|
||||
@ -113,7 +113,7 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x'
|
||||
$search_lineid = '';
|
||||
$search_ref = '';
|
||||
$search_invoice = '';
|
||||
$search_ref_supplier = '';
|
||||
//$search_ref_supplier = '';
|
||||
$search_label = '';
|
||||
$search_desc = '';
|
||||
$search_amount = '';
|
||||
@ -194,9 +194,9 @@ print '<script type="text/javascript">
|
||||
/*
|
||||
* Supplier Invoice lines
|
||||
*/
|
||||
$sql = "SELECT f.rowid as facid, f.ref as ref, f.ref_supplier, f.libelle as invoice_label, f.datef, f.fk_soc,";
|
||||
$sql = "SELECT f.rowid as facid, f.ref as ref, f.ref_supplier, f.type as ftype, f.libelle as invoice_label, f.datef, f.fk_soc,";
|
||||
$sql .= " l.rowid, l.fk_product, l.product_type as line_type, l.description, l.total_ht , l.qty, l.tva_tx, l.vat_src_code,";
|
||||
$sql .= " aa.label as label_account, aa.labelshort as labelshort_account, aa.account_number,";
|
||||
$sql .= " aa.rowid as fk_compte, aa.label as label_account, aa.labelshort as labelshort_account, aa.account_number,";
|
||||
$sql .= " p.rowid as product_id, p.fk_product_type as product_type, p.ref as product_ref, p.label as product_label, p.fk_product_type as type, p.tobuy, p.tosell,";
|
||||
if (!empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) {
|
||||
$sql .= " ppe.accountancy_code_buy, ppe.accountancy_code_buy_intra, ppe.accountancy_code_buy_export,";
|
||||
@ -236,11 +236,11 @@ if ($search_lineid) {
|
||||
$sql .= natural_search("l.rowid", $search_lineid, 1);
|
||||
}
|
||||
if (strlen(trim($search_invoice))) {
|
||||
$sql .= natural_search("f.ref", $search_invoice);
|
||||
$sql .= natural_search(array("f.ref", "f.ref_supplier"), $search_invoice);
|
||||
}
|
||||
if (strlen(trim($search_ref_supplier))) {
|
||||
/*if (strlen(trim($search_ref_supplier))) {
|
||||
$sql .= natural_search("f.ref_supplier", $search_ref_supplier);
|
||||
}
|
||||
}*/
|
||||
if (strlen(trim($search_label))) {
|
||||
$sql .= natural_search("f.libelle", $search_label);
|
||||
}
|
||||
@ -333,9 +333,9 @@ if ($result) {
|
||||
if ($search_ref) {
|
||||
$param .= "&search_ref=".urlencode($search_ref);
|
||||
}
|
||||
if ($search_ref_supplier) {
|
||||
/*if ($search_ref_supplier) {
|
||||
$param .= '&search_ref_supplier='.urlencode($search_ref_supplier);
|
||||
}
|
||||
}*/
|
||||
if ($search_label) {
|
||||
$param .= "&search_label=".urlencode($search_label);
|
||||
}
|
||||
@ -400,7 +400,7 @@ if ($result) {
|
||||
print '<tr class="liste_titre_filter">';
|
||||
print '<td class="liste_titre"><input type="text" class="flat maxwidth25" name="search_lineid" value="'.dol_escape_htmltag($search_lineid).'"></td>';
|
||||
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_invoice" value="'.dol_escape_htmltag($search_invoice).'"></td>';
|
||||
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_ref_supplier" value="'.dol_escape_htmltag($search_ref_supplier).'"></td>';
|
||||
//print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_ref_supplier" value="'.dol_escape_htmltag($search_ref_supplier).'"></td>';
|
||||
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_label" value="'.dol_escape_htmltag($search_label).'"></td>';
|
||||
print '<td class="liste_titre center">';
|
||||
print '<div class="nowrap">';
|
||||
@ -416,11 +416,11 @@ if ($result) {
|
||||
print '<td class="liste_titre right"><input type="text" class="right flat maxwidth50" name="search_vat" placeholder="%" size="1" value="'.dol_escape_htmltag($search_vat).'"></td>';
|
||||
print '<td class="liste_titre"><input type="text" class="flat maxwidth75imp" name="search_societe" value="'.dol_escape_htmltag($search_societe).'"></td>';
|
||||
print '<td class="liste_titre">';
|
||||
print $form->select_country($search_country, 'search_country', '', 0, 'maxwidth150', 'code2', 1, 0, 1);
|
||||
print $form->select_country($search_country, 'search_country', '', 0, 'maxwidth100', 'code2', 1, 0, 1);
|
||||
// print '<input type="text" class="flat maxwidth50" name="search_country" value="' . dol_escape_htmltag($search_country) . '">';
|
||||
print '</td>';
|
||||
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_tvaintra" value="'.dol_escape_htmltag($search_tvaintra).'"></td>';
|
||||
print '<td class="liste_titre center"><input type="text" class="flat maxwidth50" name="search_account" value="'.dol_escape_htmltag($search_account).'"></td>';
|
||||
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_account" value="'.dol_escape_htmltag($search_account).'"></td>';
|
||||
print '<td class="liste_titre center">';
|
||||
$searchpicto = $form->showFilterButtons();
|
||||
print $searchpicto;
|
||||
@ -429,7 +429,7 @@ if ($result) {
|
||||
print '<tr class="liste_titre">';
|
||||
print_liste_field_titre("LineId", $_SERVER["PHP_SELF"], "l.rowid", "", $param, '', $sortfield, $sortorder);
|
||||
print_liste_field_titre("Invoice", $_SERVER["PHP_SELF"], "f.ref", "", $param, '', $sortfield, $sortorder);
|
||||
print_liste_field_titre("RefSupplier", $_SERVER["PHP_SELF"], "f.ref_supplier", "", $param, '', $sortfield, $sortorder);
|
||||
//print_liste_field_titre("RefSupplier", $_SERVER["PHP_SELF"], "f.ref_supplier", "", $param, '', $sortfield, $sortorder);
|
||||
print_liste_field_titre("InvoiceLabel", $_SERVER["PHP_SELF"], "f.libelle", "", $param, '', $sortfield, $sortorder);
|
||||
print_liste_field_titre("Date", $_SERVER["PHP_SELF"], "f.datef, f.ref, l.rowid", "", $param, '', $sortfield, $sortorder, 'center ');
|
||||
print_liste_field_titre("ProductRef", $_SERVER["PHP_SELF"], "p.ref", "", $param, '', $sortfield, $sortorder);
|
||||
@ -478,8 +478,8 @@ if ($result) {
|
||||
$productstatic->status = $objp->tosell;
|
||||
$productstatic->status_buy = $objp->tobuy;
|
||||
$productstatic->accountancy_code_buy = $objp->accountancy_code_buy;
|
||||
$productstatic->accountancy_code_buy_intra = $objp->accountancy_code_sell_buy_intra;
|
||||
$productstatic->accountancy_code_buy_export = $objp->accountancy_code_sell_buy_export;
|
||||
$productstatic->accountancy_code_buy_intra = $objp->accountancy_code_buy_intra;
|
||||
$productstatic->accountancy_code_buy_export = $objp->accountancy_code_buy_export;
|
||||
|
||||
$accountingaccountstatic->rowid = $objp->fk_compte;
|
||||
$accountingaccountstatic->label = $objp->label_account;
|
||||
@ -492,12 +492,18 @@ if ($result) {
|
||||
print '<td>'.$objp->rowid.'</td>';
|
||||
|
||||
// Ref Invoice
|
||||
print '<td class="nowraponall">'.$facturefournisseur_static->getNomUrl(1).'</td>';
|
||||
print '<td class="nowraponall">'.$facturefournisseur_static->getNomUrl(1);
|
||||
if ($objp->ref_supplier) {
|
||||
print '<br><span class="opacitymedium small">'.dol_escape_htmltag($objp->ref_supplier).'</span>';
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
// Ref supplier invoice
|
||||
/*
|
||||
print '<td class="tdoverflowmax100" title="'.dol_escape_htmltag($objp->ref_supplier).'">';
|
||||
print $objp->ref_supplier;
|
||||
print '</td>';
|
||||
*/
|
||||
|
||||
// Supplier invoice label
|
||||
print '<td class="tdoverflowonsmartphone small" title="'.dol_escape_htmltag($objp->invoice_label).'">';
|
||||
|
||||
@ -289,14 +289,14 @@ if ($search_lineid) {
|
||||
$sql .= natural_search("l.rowid", $search_lineid, 1);
|
||||
}
|
||||
if (strlen(trim($search_invoice))) {
|
||||
$sql .= natural_search("f.ref", $search_invoice);
|
||||
$sql .= natural_search(array("f.ref", "f.ref_supplier"), $search_invoice);
|
||||
}
|
||||
if (strlen(trim($search_ref))) {
|
||||
$sql .= natural_search("p.ref", $search_ref);
|
||||
}
|
||||
if (strlen(trim($search_ref_supplier))) {
|
||||
/*if (strlen(trim($search_ref_supplier))) {
|
||||
$sql .= natural_search("f.ref_supplier", $search_ref_supplier);
|
||||
}
|
||||
}*/
|
||||
if (strlen(trim($search_label))) {
|
||||
$sql .= natural_search(array("p.label", "f.libelle"), $search_label);
|
||||
}
|
||||
@ -490,7 +490,7 @@ if ($result) {
|
||||
print '<tr class="liste_titre_filter">';
|
||||
print '<td class="liste_titre"><input type="text" class="flat maxwidth25" name="search_lineid" value="'.dol_escape_htmltag($search_lineid).'"></td>';
|
||||
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_invoice" value="'.dol_escape_htmltag($search_invoice).'"></td>';
|
||||
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_ref_supplier" value="'.dol_escape_htmltag($search_ref_supplier).'"></td>';
|
||||
//print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_ref_supplier" value="'.dol_escape_htmltag($search_ref_supplier).'"></td>';
|
||||
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_label" value="'.dol_escape_htmltag($search_label).'"></td>';
|
||||
print '<td class="liste_titre center">';
|
||||
print '<div class="nowrap">';
|
||||
@ -506,7 +506,7 @@ if ($result) {
|
||||
print '<td class="liste_titre right"><input type="text" class="flat maxwidth50 right" name="search_vat" placeholder="%" size="1" value="'.dol_escape_htmltag($search_vat).'"></td>';
|
||||
print '<td class="liste_titre"><input type="text" class="flat maxwidth75imp" name="search_societe" value="'.dol_escape_htmltag($search_societe).'"></td>';
|
||||
print '<td class="liste_titre">';
|
||||
print $form->select_country($search_country, 'search_country', '', 0, 'maxwidth125', 'code2', 1, 0, 1, null, 1);
|
||||
print $form->select_country($search_country, 'search_country', '', 0, 'maxwidth100', 'code2', 1, 0, 1);
|
||||
//print '<input type="text" class="flat maxwidth50" name="search_country" value="' . dol_escape_htmltag($search_country) . '">';
|
||||
print '</td>';
|
||||
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_tvaintra" value="'.dol_escape_htmltag($search_tvaintra).'"></td>';
|
||||
@ -521,7 +521,7 @@ if ($result) {
|
||||
print '<tr class="liste_titre">';
|
||||
print_liste_field_titre("LineId", $_SERVER["PHP_SELF"], "l.rowid", "", $param, '', $sortfield, $sortorder);
|
||||
print_liste_field_titre("Invoice", $_SERVER["PHP_SELF"], "f.ref", "", $param, '', $sortfield, $sortorder);
|
||||
print_liste_field_titre("RefSupplier", $_SERVER["PHP_SELF"], "f.ref_supplier", "", $param, '', $sortfield, $sortorder);
|
||||
//print_liste_field_titre("RefSupplier", $_SERVER["PHP_SELF"], "f.ref_supplier", "", $param, '', $sortfield, $sortorder);
|
||||
print_liste_field_titre("InvoiceLabel", $_SERVER["PHP_SELF"], "f.libelle", "", $param, '', $sortfield, $sortorder);
|
||||
print_liste_field_titre("Date", $_SERVER["PHP_SELF"], "f.datef, f.ref, l.rowid", "", $param, '', $sortfield, $sortorder, 'center ');
|
||||
print_liste_field_titre("ProductRef", $_SERVER["PHP_SELF"], "p.ref", "", $param, '', $sortfield, $sortorder);
|
||||
@ -648,16 +648,20 @@ if ($result) {
|
||||
print '<td>'.$facturefourn_static_det->id.'</td>';
|
||||
|
||||
// Ref Invoice
|
||||
print '<td class="nowraponall">'.$facturefourn_static->getNomUrl(1).'</td>';
|
||||
|
||||
// Ref supplier invoice
|
||||
print '<td class="tdoverflowmax100" title="'.dol_escape_htmltag($objp->ref_supplier).'">';
|
||||
print $objp->ref_supplier;
|
||||
print '<td class="nowraponall">'.$facturefourn_static->getNomUrl(1);
|
||||
if ($objp->ref_supplier) {
|
||||
print '<br><span class="opacitymedium small">'.dol_escape_htmltag($objp->ref_supplier).'</span>';
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
// Ref supplier invoice
|
||||
/*print '<td class="tdoverflowmax100" title="'.dol_escape_htmltag($objp->ref_supplier).'">';
|
||||
print $objp->ref_supplier;
|
||||
print '</td>';*/
|
||||
|
||||
// Supplier invoice label
|
||||
print '<td class="tdoverflowmax125 small" title="'.dol_escape_htmltag($objp->invoice_label).'">';
|
||||
print $objp->invoice_label;
|
||||
print '<td class="tdoverflowmax100 small" title="'.dol_escape_htmltag($objp->invoice_label).'">';
|
||||
print dol_escape_htmltag($objp->invoice_label);
|
||||
print '</td>';
|
||||
|
||||
// Date
|
||||
@ -669,11 +673,11 @@ if ($result) {
|
||||
print $product_static->getNomUrl(1);
|
||||
}
|
||||
if ($product_static->label) {
|
||||
print '<br><span class="opacitymedium small">'.$product_static->label.'</span>';
|
||||
print '<br><span class="opacitymedium small">'.dol_escape_htmltag($product_static->label).'</span>';
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
// Description
|
||||
// Description of line
|
||||
print '<td class="tdoverflowonsmartphone small">';
|
||||
$text = dolGetFirstLineOfText(dol_string_nohtmltag($facturefourn_static_det->desc, 1));
|
||||
$trunclength = empty($conf->global->ACCOUNTING_LENGTH_DESCRIPTION) ? 32 : $conf->global->ACCOUNTING_LENGTH_DESCRIPTION;
|
||||
@ -686,11 +690,11 @@ if ($result) {
|
||||
|
||||
// Vat rate
|
||||
$code_vat_differ = '';
|
||||
if ($objp->vat_tx_l != $objp->vat_tx_p && price2num($objp->vat_tx_p) && price2num($objp->vat_tx_l)) { // Note: having a vat rate of 0 is often the normal case when sells is intra b2b or to export
|
||||
$code_vat_differ = 'warning bold';
|
||||
}
|
||||
//if ($objp->vat_tx_l != $objp->vat_tx_p && price2num($objp->vat_tx_p) && price2num($objp->vat_tx_l)) { // Note: having a vat rate of 0 is often the normal case when sells is intra b2b or to export
|
||||
// $code_vat_differ = 'warning bold';
|
||||
//}
|
||||
print '<td class="right'.($code_vat_differ?' '.$code_vat_differ:'').'">';
|
||||
print vatrate($facturefourn_static_det->tva_tx.($facturefourn_static_det->vat_src_code ? ' ('.$facturefourn_static_det->vat_src_code.')' : ''));
|
||||
print vatrate($facturefourn_static_det->tva_tx.($facturefourn_static_det->vat_src_code ? ' ('.$facturefourn_static_det->vat_src_code.')' : ''), false, 0, 0, 1);
|
||||
print '</td>';
|
||||
|
||||
// Thirdparty
|
||||
|
||||
@ -295,11 +295,13 @@ if ($result) {
|
||||
$num = $db->num_rows($result);
|
||||
$i = 0;
|
||||
while ($i < $num) {
|
||||
$obj = $db->fetch_object($result);
|
||||
$amount_ht[$obj->rowid] = $obj->amount;
|
||||
$obj = $db->fetch_object($result);
|
||||
|
||||
$amount_ht[$obj->rowid] = (empty($obj->amount) ? 0 : $obj->amount);
|
||||
$amount[$obj->rowid] = $obj->amount_ttc;
|
||||
$name[$obj->rowid] = $obj->name.' '.$obj->firstname;
|
||||
$catotal_ht += $obj->amount;
|
||||
|
||||
$catotal_ht += (empty($obj->amount) ? 0 : $obj->amount);
|
||||
$catotal += $obj->amount_ttc;
|
||||
$i++;
|
||||
}
|
||||
|
||||
@ -360,19 +360,23 @@ if ($result) {
|
||||
$i = 0;
|
||||
while ($i < $num) {
|
||||
$obj = $db->fetch_object($result);
|
||||
$amount_ht[$obj->socid] = $obj->amount;
|
||||
$amount[$obj->socid] = $obj->amount_ttc;
|
||||
$fullname = $obj->name;
|
||||
|
||||
$amount_ht[$obj->socid] = (empty($obj->amount) ? 0 : $obj->amount);
|
||||
$amount[$obj->socid] = $obj->amount_ttc;
|
||||
$fullname = $obj->name;
|
||||
if (!empty($obj->name_alias)) {
|
||||
$fullname .= ' ('.$obj->name_alias.')';
|
||||
}
|
||||
$name[$obj->socid] = $fullname;
|
||||
$address_zip[$obj->socid] = $obj->zip;
|
||||
$address_town[$obj->socid] = $obj->town;
|
||||
$address_pays[$obj->socid] = getCountry($obj->fk_pays);
|
||||
$catotal_ht += $obj->amount;
|
||||
$catotal += $obj->amount_ttc;
|
||||
$i++;
|
||||
$name[$obj->socid] = $fullname;
|
||||
|
||||
$address_zip[$obj->socid] = $obj->zip;
|
||||
$address_town[$obj->socid] = $obj->town;
|
||||
$address_pays[$obj->socid] = getCountry($obj->fk_pays);
|
||||
|
||||
$catotal_ht += (empty($obj->amount) ? 0 : $obj->amount);
|
||||
$catotal += $obj->amount_ttc;
|
||||
|
||||
$i++;
|
||||
}
|
||||
} else {
|
||||
dol_print_error($db);
|
||||
@ -401,12 +405,16 @@ if ($modecompta == "RECETTES-DEPENSES") {
|
||||
$i = 0;
|
||||
while ($i < $num) {
|
||||
$obj = $db->fetch_object($result);
|
||||
|
||||
$amount[$obj->rowid] += $obj->amount_ttc;
|
||||
|
||||
$name[$obj->rowid] = $obj->name;
|
||||
$address_zip[$obj->rowid] = $obj->zip;
|
||||
$address_town[$obj->rowid] = $obj->town;
|
||||
$address_pays[$obj->rowid] = getCountry($obj->fk_pays);
|
||||
|
||||
$catotal += $obj->amount_ttc;
|
||||
|
||||
$i++;
|
||||
}
|
||||
} else {
|
||||
|
||||
@ -431,7 +431,7 @@ for ($mois = 1 + $nb_mois_decalage; $mois <= 12 + $nb_mois_decalage; $mois++) {
|
||||
// Value turnover of month
|
||||
print '<td class="right">';
|
||||
if ($annee < $year_end || ($annee == $year_end && $mois <= $month_end)) {
|
||||
if ($cum[$case]) {
|
||||
if (!empty($cum[$case])) {
|
||||
$now_show_delta = 1; // On a trouve le premier mois de la premiere annee generant du chiffre.
|
||||
if ($modecompta != 'BOOKKEEPING') {
|
||||
print '<a href="casoc.php?year='.$annee_decalage.'&month='.$mois_modulo.($modecompta ? '&modecompta='.$modecompta : '').'">';
|
||||
@ -455,22 +455,22 @@ for ($mois = 1 + $nb_mois_decalage; $mois <= 12 + $nb_mois_decalage; $mois++) {
|
||||
//var_dump($annee.' '.$year_end.' '.$mois.' '.$month_end);
|
||||
if ($annee < $year_end || ($annee == $year_end && $mois <= $month_end)) {
|
||||
if ($annee_decalage > $minyear && $case <= $casenow) {
|
||||
if ($cum[$caseprev] && $cum[$case]) {
|
||||
if (!empty($cum[$caseprev]) && !empty($cum[$case])) {
|
||||
$percent = (round(($cum[$case] - $cum[$caseprev]) / $cum[$caseprev], 4) * 100);
|
||||
//print "X $cum[$case] - $cum[$caseprev] - $cum[$caseprev] - $percent X";
|
||||
print ($percent >= 0 ? "+$percent" : "$percent").'%';
|
||||
}
|
||||
if ($cum[$caseprev] && !$cum[$case]) {
|
||||
if (!empty($cum[$caseprev]) && empty($cum[$case])) {
|
||||
print '-100%';
|
||||
}
|
||||
if (!$cum[$caseprev] && $cum[$case]) {
|
||||
if (empty($cum[$caseprev]) && !empty($cum[$case])) {
|
||||
//print '<td class="right">+Inf%</td>';
|
||||
print '-';
|
||||
}
|
||||
if (isset($cum[$caseprev]) && !$cum[$caseprev] && !$cum[$case]) {
|
||||
if (isset($cum[$caseprev]) && empty($cum[$caseprev]) && empty($cum[$case])) {
|
||||
print '+0%';
|
||||
}
|
||||
if (!isset($cum[$caseprev]) && !$cum[$case]) {
|
||||
if (!isset($cum[$caseprev]) && empty($cum[$case])) {
|
||||
print '-';
|
||||
}
|
||||
} else {
|
||||
@ -489,8 +489,16 @@ for ($mois = 1 + $nb_mois_decalage; $mois <= 12 + $nb_mois_decalage; $mois++) {
|
||||
}
|
||||
|
||||
if ($annee < $year_end || ($annee == $year_end && $mois <= $month_end)) {
|
||||
$total_ht[$annee] += ((!empty($cum_ht[$case])) ? $cum_ht[$case] : 0);
|
||||
$total[$annee] += $cum[$case];
|
||||
if (empty($total_ht[$annee])) {
|
||||
$total_ht[$annee] = (empty($cum_ht[$case]) ? 0 : $cum_ht[$case]);
|
||||
} else {
|
||||
$total_ht[$annee] += (empty($cum_ht[$case]) ? 0 : $cum_ht[$case]);
|
||||
}
|
||||
if (empty($total[$annee])) {
|
||||
$total[$annee] = empty($cum[$case]) ? 0 : $cum[$case];
|
||||
} else {
|
||||
$total[$annee] += empty($cum[$case]) ? 0 : $cum[$case];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -577,7 +585,7 @@ for ($annee = $year_start; $annee <= $year_end; $annee++) {
|
||||
}
|
||||
|
||||
// Total amount
|
||||
if ($total[$annee] || ($annee >= $minyear && $annee <= max($nowyear, $maxyear))) {
|
||||
if (!empty($total[$annee]) || ($annee >= $minyear && $annee <= max($nowyear, $maxyear))) {
|
||||
print '<td class="nowrap right">';
|
||||
print ($total[$annee] ?price($total[$annee]) : "0");
|
||||
print "</td>";
|
||||
@ -604,7 +612,7 @@ for ($annee = $year_start; $annee <= $year_end; $annee++) {
|
||||
}
|
||||
} else {
|
||||
print '<td class="borderrightlight right">';
|
||||
if ($total[$annee] || ($minyear <= $annee && $annee <= max($nowyear, $maxyear))) {
|
||||
if (!empty($total[$annee]) || ($minyear <= $annee && $annee <= max($nowyear, $maxyear))) {
|
||||
print '-';
|
||||
} else {
|
||||
print ' ';
|
||||
|
||||
@ -186,7 +186,10 @@ $moreparam = array();
|
||||
if (!empty($modecompta)) {
|
||||
$moreparam['modecompta'] = $modecompta;
|
||||
}
|
||||
report_header($name, $namelink, $period, $periodlink, $description, $builddate, $exportlink, $moreparam, $calcmode);
|
||||
|
||||
$exportlink = '';
|
||||
|
||||
report_header($name, '', $period, $periodlink, $description, $builddate, $exportlink, $moreparam, $calcmode);
|
||||
|
||||
if (isModEnabled('accounting') && $modecompta != 'BOOKKEEPING') {
|
||||
print info_admin($langs->trans("WarningReportNotReliable"), 0, 0, 1);
|
||||
@ -347,7 +350,7 @@ for ($mois = 1 + $nb_mois_decalage; $mois <= 12 + $nb_mois_decalage; $mois++) {
|
||||
if ($modecompta == 'CREANCES-DETTES') {
|
||||
// Valeur CA du mois w/o VAT
|
||||
print '<td class="right">';
|
||||
if ($cum_ht[$case]) {
|
||||
if (!empty($cum_ht[$case])) {
|
||||
$now_show_delta = 1; // On a trouve le premier mois de la premiere annee generant du chiffre.
|
||||
print '<a href="supplier_turnover_by_thirdparty.php?year='.$annee_decalage.'&month='.$mois_modulo.($modecompta ? '&modecompta='.$modecompta : '').'">'.price($cum_ht[$case], 1).'</a>';
|
||||
} else {
|
||||
@ -362,7 +365,7 @@ for ($mois = 1 + $nb_mois_decalage; $mois <= 12 + $nb_mois_decalage; $mois++) {
|
||||
|
||||
// Valeur CA du mois
|
||||
print '<td class="right">';
|
||||
if ($cum[$case]) {
|
||||
if (!empty($cum[$case])) {
|
||||
$now_show_delta = 1; // On a trouve le premier mois de la premiere annee generant du chiffre.
|
||||
if ($modecompta != 'BOOKKEEPING') {
|
||||
print '<a href="supplier_turnover_by_thirdparty.php?year='.$annee_decalage.'&month='.$mois_modulo.($modecompta ? '&modecompta='.$modecompta : '').'">';
|
||||
@ -382,22 +385,22 @@ for ($mois = 1 + $nb_mois_decalage; $mois <= 12 + $nb_mois_decalage; $mois++) {
|
||||
|
||||
// Pourcentage du mois
|
||||
if ($annee_decalage > $minyear && $case <= $casenow) {
|
||||
if ($cum[$caseprev] && $cum[$case]) {
|
||||
if (!empty($cum[$caseprev]) && !empty($cum[$case])) {
|
||||
$percent = (round(($cum[$case] - $cum[$caseprev]) / $cum[$caseprev], 4) * 100);
|
||||
//print "X $cum[$case] - $cum[$caseprev] - $cum[$caseprev] - $percent X";
|
||||
print '<td class="borderrightlight right">'.($percent >= 0 ? "+$percent" : "$percent").'%</td>';
|
||||
}
|
||||
if ($cum[$caseprev] && !$cum[$case]) {
|
||||
if (!empty($cum[$caseprev]) && empty($cum[$case])) {
|
||||
print '<td class="borderrightlight right">-100%</td>';
|
||||
}
|
||||
if (!$cum[$caseprev] && $cum[$case]) {
|
||||
if (empty($cum[$caseprev]) && !empty($cum[$case])) {
|
||||
//print '<td class="right">+Inf%</td>';
|
||||
print '<td class="borderrightlight right">-</td>';
|
||||
}
|
||||
if (isset($cum[$caseprev]) && !$cum[$caseprev] && !$cum[$case]) {
|
||||
if (isset($cum[$caseprev]) && empty($cum[$caseprev]) && empty($cum[$case])) {
|
||||
print '<td class="borderrightlight right">+0%</td>';
|
||||
}
|
||||
if (!isset($cum[$caseprev]) && !$cum[$case]) {
|
||||
if (!isset($cum[$caseprev]) && empty($cum[$case])) {
|
||||
print '<td class="borderrightlight right">-</td>';
|
||||
}
|
||||
} else {
|
||||
@ -415,8 +418,16 @@ for ($mois = 1 + $nb_mois_decalage; $mois <= 12 + $nb_mois_decalage; $mois++) {
|
||||
}
|
||||
}
|
||||
|
||||
$total_ht[$annee] += ((!empty($cum_ht[$case])) ? $cum_ht[$case] : 0);
|
||||
$total[$annee] += $cum[$case];
|
||||
if (empty($total_ht[$annee])) {
|
||||
$total_ht[$annee] = ((!empty($cum_ht[$case])) ? $cum_ht[$case] : 0);
|
||||
} else {
|
||||
$total_ht[$annee] += ((!empty($cum_ht[$case])) ? $cum_ht[$case] : 0);
|
||||
}
|
||||
if (empty($total[$annee])) {
|
||||
$total[$annee] = (empty($cum[$case]) ? 0 : $cum[$case]);
|
||||
} else {
|
||||
$total[$annee] += (empty($cum[$case]) ? 0 : $cum[$case]);
|
||||
}
|
||||
}
|
||||
|
||||
print '</tr>';
|
||||
|
||||
@ -188,6 +188,7 @@ $allparams = array_merge($commonparams, $headerparams, $tableparams);
|
||||
$headerparams = array_merge($commonparams, $headerparams);
|
||||
$tableparams = array_merge($commonparams, $tableparams);
|
||||
|
||||
$paramslink = '';
|
||||
foreach ($allparams as $key => $value) {
|
||||
$paramslink .= '&'.$key.'='.$value;
|
||||
}
|
||||
@ -251,7 +252,9 @@ if ($date_end == dol_time_plus_duree($date_start, 1, 'y') - 1) {
|
||||
$periodlink = '';
|
||||
}
|
||||
|
||||
report_header($name, $namelink, $period, $periodlink, $description, $builddate, $exportlink, $tableparams, $calcmode);
|
||||
$exportlink = '';
|
||||
|
||||
report_header($name, '', $period, $periodlink, $description, $builddate, $exportlink, $tableparams, $calcmode);
|
||||
|
||||
if (isModEnabled('accounting') && $modecompta != 'BOOKKEEPING') {
|
||||
print info_admin($langs->trans("WarningReportNotReliable"), 0, 0, 1);
|
||||
@ -309,20 +312,23 @@ if ($modecompta == 'CREANCES-DETTES') {
|
||||
$sql .= $db->order($sortfield, $sortorder);
|
||||
|
||||
dol_syslog("supplier_turnover_by_prodserv", LOG_DEBUG);
|
||||
$result = $db->query($sql);
|
||||
if ($result) {
|
||||
$num = $db->num_rows($result);
|
||||
$resql = $db->query($sql);
|
||||
if ($resql) {
|
||||
$num = $db->num_rows($resql);
|
||||
$i = 0;
|
||||
while ($i < $num) {
|
||||
$obj = $db->fetch_object($result);
|
||||
$obj = $db->fetch_object($resql);
|
||||
|
||||
$amount_ht[$obj->rowid] = $obj->amount;
|
||||
$amount[$obj->rowid] = $obj->amount_ttc;
|
||||
$qty[$obj->rowid] = $obj->qty;
|
||||
$name[$obj->rowid] = $obj->ref.' - '.$obj->label;
|
||||
$type[$obj->rowid] = $obj->product_type;
|
||||
|
||||
$catotal_ht += $obj->amount;
|
||||
$catotal += $obj->amount_ttc;
|
||||
$qtytotal += $obj->qty;
|
||||
|
||||
$i++;
|
||||
}
|
||||
} else {
|
||||
@ -407,7 +413,7 @@ if ($modecompta == 'CREANCES-DETTES') {
|
||||
$_SERVER["PHP_SELF"],
|
||||
"amount",
|
||||
"",
|
||||
$classslink,
|
||||
$paramslink,
|
||||
'class="right"',
|
||||
$sortfield,
|
||||
$sortorder
|
||||
|
||||
@ -153,7 +153,6 @@ $headerparams['date_startday'] = $date_startday;
|
||||
$headerparams['date_endyear'] = $date_endyear;
|
||||
$headerparams['date_endmonth'] = $date_endmonth;
|
||||
$headerparams['date_endday'] = $date_endday;
|
||||
$headerparams['q'] = $q;
|
||||
|
||||
$tableparams = array();
|
||||
$tableparams['search_categ'] = $selected_cat;
|
||||
@ -168,6 +167,7 @@ $allparams = array_merge($commonparams, $headerparams, $tableparams);
|
||||
$headerparams = array_merge($commonparams, $headerparams);
|
||||
$tableparams = array_merge($commonparams, $tableparams);
|
||||
|
||||
$paramslink = '';
|
||||
foreach ($allparams as $key => $value) {
|
||||
$paramslink .= '&'.$key.'='.$value;
|
||||
}
|
||||
@ -230,6 +230,8 @@ if ($date_end == dol_time_plus_duree($date_start, 1, 'y') - 1) {
|
||||
$periodlink = '';
|
||||
}
|
||||
|
||||
$exportlink = '';
|
||||
|
||||
report_header($name, '', $period, $periodlink, $description, $builddate, $exportlink, $tableparams, $calcmode);
|
||||
|
||||
if (isModEnabled('accounting') && $modecompta != 'BOOKKEEPING') {
|
||||
@ -315,22 +317,29 @@ $sql .= " GROUP BY s.rowid, s.nom, s.zip, s.town, s.fk_pays";
|
||||
$sql .= " ORDER BY s.rowid";
|
||||
//echo $sql;
|
||||
|
||||
$catotal_ht = 0;
|
||||
$catotal = 0;
|
||||
|
||||
dol_syslog("supplier_turnover_by_thirdparty", LOG_DEBUG);
|
||||
$result = $db->query($sql);
|
||||
if ($result) {
|
||||
$num = $db->num_rows($result);
|
||||
$resql = $db->query($sql);
|
||||
if ($resql) {
|
||||
$num = $db->num_rows($resql);
|
||||
$i = 0;
|
||||
while ($i < $num) {
|
||||
$obj = $db->fetch_object($result);
|
||||
$amount_ht[$obj->socid] = $obj->amount;
|
||||
$amount[$obj->socid] = $obj->amount_ttc;
|
||||
$name[$obj->socid] = $obj->name.' '.$obj->firstname;
|
||||
$address_zip[$obj->socid] = $obj->zip;
|
||||
$address_town[$obj->socid] = $obj->town;
|
||||
$address_pays[$obj->socid] = getCountry($obj->fk_pays);
|
||||
$catotal_ht += $obj->amount;
|
||||
$catotal += $obj->amount_ttc;
|
||||
$i++;
|
||||
$obj = $db->fetch_object($resql);
|
||||
|
||||
$amount_ht[$obj->socid] = (empty($obj->amount) ? 0 : $obj->amount);
|
||||
$amount[$obj->socid] = $obj->amount_ttc;
|
||||
//$name[$obj->socid] = $obj->name.' '.$obj->firstname;
|
||||
|
||||
$address_zip[$obj->socid] = $obj->zip;
|
||||
$address_town[$obj->socid] = $obj->town;
|
||||
$address_pays[$obj->socid] = getCountry($obj->fk_pays);
|
||||
|
||||
$catotal_ht += (empty($obj->amount) ? 0 : $obj->amount);
|
||||
$catotal += $obj->amount_ttc;
|
||||
|
||||
$i++;
|
||||
}
|
||||
} else {
|
||||
dol_print_error($db);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user