Clean code
This commit is contained in:
parent
a0cdf784da
commit
f23a681dc0
@ -232,14 +232,11 @@ if (GETPOST('actionadd') || GETPOST('actionmodify'))
|
||||
$i=0;
|
||||
foreach ($listfieldinsert as $f => $value)
|
||||
{
|
||||
if ($value == 'price' || preg_match('/^amount/i',$value) || $value == 'taux') {
|
||||
$_POST[$listfieldvalue[$i]] = price2num($_POST[$listfieldvalue[$i]],'MU');
|
||||
}
|
||||
else if ($value == 'entity') {
|
||||
if ($value == 'entity') {
|
||||
$_POST[$listfieldvalue[$i]] = $conf->entity;
|
||||
}
|
||||
if ($i) $sql.=",";
|
||||
if ($_POST[$listfieldvalue[$i]] == '' && ! ($listfieldvalue[$i] == 'code' && $id == 10)) $sql.="null"; // For vat, we want/accept code = ''
|
||||
if ($_POST[$listfieldvalue[$i]] == '' && ! $listfieldvalue[$i] == 'formula') $sql.="null"; // For vat, we want/accept code = ''
|
||||
else $sql.="'".$db->escape($_POST[$listfieldvalue[$i]])."'";
|
||||
$i++;
|
||||
}
|
||||
|
||||
@ -85,7 +85,6 @@ if (empty($date_start) || empty($date_end)) // We define date_start and date_end
|
||||
}
|
||||
|
||||
$name=$langs->trans("PurchasesJournal");
|
||||
$namelink='';
|
||||
$periodlink='';
|
||||
$exportlink='';
|
||||
$builddate=dol_now();
|
||||
@ -94,7 +93,7 @@ if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) $description.= $
|
||||
else $description.= $langs->trans("DepositsAreIncluded");
|
||||
$period=$form->select_date($date_start,'date_start',0,0,0,'',1,0,1).' - '.$form->select_date($date_end,'date_end',0,0,0,'',1,0,1);
|
||||
|
||||
report_header($name,$namelink,$period,$periodlink,$description,$builddate,$exportlink);
|
||||
report_header($name,'',$period,$periodlink,$description,$builddate,$exportlink);
|
||||
|
||||
$p = explode(":", $conf->global->MAIN_INFO_SOCIETE_COUNTRY);
|
||||
$idpays = $p[0];
|
||||
|
||||
@ -89,7 +89,6 @@ if (empty($date_start) || empty($date_end)) // We define date_start and date_end
|
||||
}
|
||||
|
||||
$nom=$langs->trans("SellsJournal");
|
||||
$namelink='';
|
||||
$periodlink='';
|
||||
$exportlink='';
|
||||
$builddate=dol_now();
|
||||
@ -97,7 +96,7 @@ $description=$langs->trans("DescSellsJournal").'<br>';
|
||||
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) $description.= $langs->trans("DepositsAreNotIncluded");
|
||||
else $description.= $langs->trans("DepositsAreIncluded");
|
||||
$period=$form->select_date($date_start,'date_start',0,0,0,'',1,0,1).' - '.$form->select_date($date_end,'date_end',0,0,0,'',1,0,1);
|
||||
report_header($name,$namelink,$period,$periodlink,$description,$builddate,$exportlink);
|
||||
report_header($name,'',$period,$periodlink,$description,$builddate,$exportlink);
|
||||
|
||||
$p = explode(":", $conf->global->MAIN_INFO_SOCIETE_COUNTRY);
|
||||
$idpays = $p[0];
|
||||
|
||||
@ -142,7 +142,7 @@ if ($calc==2) // Invoice for goods, payment for services
|
||||
$productsup=$langs->trans("Description");
|
||||
$amountsup=$langs->trans("AmountHT");
|
||||
}
|
||||
report_header($name,$namelink,$period,$periodlink,$description,$builddate,$exportlink,array(),$calcmode);
|
||||
report_header($name,'',$period,$periodlink,$description,$builddate,$exportlink,array(),$calcmode);
|
||||
|
||||
|
||||
$vatcust=$langs->transcountry($local==1?"LT1":"LT2",$mysoc->country_code);
|
||||
|
||||
@ -177,7 +177,7 @@ if ($conf->global->$calc==2) // Invoice for goods, payment for services
|
||||
$vatsup=$langs->trans("VATPaid");
|
||||
if ($mysoc->tva_assuj) $vatsup.=' ('.$langs->trans("ToGetBack").')';
|
||||
}
|
||||
report_header($name,$namelink,$period,$periodlink,$description,$builddate,$exportlink,array(),$calcmode);
|
||||
report_header($name,'',$period,$periodlink,$description,$builddate,$exportlink,array(),$calcmode);
|
||||
|
||||
|
||||
if($local==1){
|
||||
|
||||
@ -147,7 +147,6 @@ llxHeader();
|
||||
|
||||
$form=new Form($db);
|
||||
|
||||
$namelink='';
|
||||
$periodlink='';
|
||||
$exportlink='';
|
||||
|
||||
@ -200,7 +199,7 @@ elseif ($modecompta=="BOOKKEEPING")
|
||||
|
||||
$hselected = 'report';
|
||||
|
||||
report_header($name,$namelink,$period,$periodlink,$description,$builddate,$exportlink,array('modecompta'=>$modecompta),$calcmode);
|
||||
report_header($name,'',$period,$periodlink,$description,$builddate,$exportlink,array('modecompta'=>$modecompta),$calcmode);
|
||||
|
||||
if (! empty($conf->accounting->enabled) && $modecompta != 'BOOKKEEPING')
|
||||
{
|
||||
|
||||
@ -113,7 +113,6 @@ llxHeader();
|
||||
|
||||
$form=new Form($db);
|
||||
|
||||
$namelink='';
|
||||
$exportlink='';
|
||||
|
||||
// Affiche en-tete du rapport
|
||||
@ -160,7 +159,7 @@ else if ($modecompta=="BOOKKEEPING")
|
||||
|
||||
$hselected='report';
|
||||
|
||||
report_header($name,$namelink,$period,$periodlink,$description,$builddate,$exportlink,array('modecompta'=>$modecompta),$calcmode);
|
||||
report_header($name,'',$period,$periodlink,$description,$builddate,$exportlink,array('modecompta'=>$modecompta),$calcmode);
|
||||
|
||||
if (! empty($conf->accounting->enabled) && $modecompta != 'BOOKKEEPING')
|
||||
{
|
||||
|
||||
@ -194,7 +194,6 @@ else if ($modecompta=="BOOKKEEPING")
|
||||
$calcmode=$langs->trans("CalcModeBookkeeping");
|
||||
//$calcmode.='<br>('.$langs->trans("SeeReportInDueDebtMode",'<a href="'.$_SERVER["PHP_SELF"].'?year_start='.$year_start.'&modecompta=CREANCES-DETTES">','</a>').')';
|
||||
//$calcmode.='<br>('.$langs->trans("SeeReportInInputOutputMode",'<a href="'.$_SERVER["PHP_SELF"].'?year_start='.$year_start.'&modecompta=RECETTES-DEPENSES">','</a>').')';
|
||||
$nomlink = '';
|
||||
$period=$form->select_date($date_start,'date_start',0,0,0,'',1,0,1).' - '.$form->select_date($date_end,'date_end',0,0,0,'',1,0,1);
|
||||
$period.=' '.$langs->trans("DetailByAccount").' '. $form->selectyesno('showaccountdetail',$showaccountdetail,0);
|
||||
$periodlink = $textprevyear . " " . $langs->trans("Year") . " " . $start_year . " " . $textnextyear ;
|
||||
@ -206,7 +205,7 @@ else if ($modecompta=="BOOKKEEPING")
|
||||
$builddate=dol_now();
|
||||
}
|
||||
|
||||
report_header($name, $nomlink, $period, $periodlink, $description, $builddate, $exportlink, array('modecompta'=>$modecompta, 'action' => ''), $calcmode);
|
||||
report_header($name, '', $period, $periodlink, $description, $builddate, $exportlink, array('modecompta'=>$modecompta, 'action' => ''), $calcmode);
|
||||
|
||||
|
||||
if (! empty($conf->accounting->enabled) && $modecompta != 'BOOKKEEPING')
|
||||
@ -259,10 +258,10 @@ else if ($modecompta=="BOOKKEEPING")
|
||||
|
||||
$formula = $cat['formula'];
|
||||
|
||||
print "<tr>";
|
||||
print '<tr class="liste_total">';
|
||||
|
||||
// Year NP
|
||||
print '<td class="width200">';
|
||||
print '<td class="liste_total width200">';
|
||||
print $cat['code'];
|
||||
print '</td><td>';
|
||||
print $cat['label'];
|
||||
@ -283,7 +282,7 @@ else if ($modecompta=="BOOKKEEPING")
|
||||
$r = dol_eval($result, 1);
|
||||
//var_dump($r);
|
||||
|
||||
print '<td align="right"><font color="blue">' . price($r) . '</font></td>';
|
||||
print '<td class="liste_total right">' . price($r) . '</td>';
|
||||
|
||||
// Year N
|
||||
$code = $cat['code']; // code of categorie ('VTE', 'MAR', ...)
|
||||
@ -301,7 +300,7 @@ else if ($modecompta=="BOOKKEEPING")
|
||||
//$r = $AccCat->calculate($result);
|
||||
$r = dol_eval($result, 1);
|
||||
|
||||
print '<td align="right"><font color="blue">' . price($r) . '</font></td>';
|
||||
print '<td class="liste_total right">' . price($r) . '</td>';
|
||||
$sommes[$code]['N'] += $r;
|
||||
|
||||
// Detail by month
|
||||
@ -315,7 +314,7 @@ else if ($modecompta=="BOOKKEEPING")
|
||||
//$r = $AccCat->calculate($result);
|
||||
$r = dol_eval($result, 1);
|
||||
|
||||
print '<td align="right"><font color="blue">' . price($r) . '</font></td>';
|
||||
print '<td class="liste_total right">' . price($r) . '</td>';
|
||||
$sommes[$code]['M'][$k] += $r;
|
||||
}
|
||||
|
||||
|
||||
@ -220,7 +220,7 @@ if ($modetax==0) { // Invoice for goods, payment for services
|
||||
$vatsup.=' ('.$langs->trans("ToGetBack").')';
|
||||
}
|
||||
}
|
||||
report_header($name,$namelink,$period,$periodlink,$description,$builddate,$exportlink,array(),$calcmode);
|
||||
report_header($name,'',$period,$periodlink,$description,$builddate,$exportlink,array(),$calcmode);
|
||||
|
||||
$vatcust=$langs->trans("VATReceived");
|
||||
$vatsup=$langs->trans("VATPaid");
|
||||
|
||||
@ -210,7 +210,7 @@ if ($modetax==0) // Invoice for goods, payment for services
|
||||
if ($mysoc->tva_assuj) $vatsup.=' ('.$langs->trans("ToGetBack").')';
|
||||
|
||||
}
|
||||
report_header($name,$namelink,$period,$periodlink,$description,$builddate,$exportlink,array(),$calcmode);
|
||||
report_header($name,'',$period,$periodlink,$description,$builddate,$exportlink,array(),$calcmode);
|
||||
|
||||
$vatcust=$langs->trans("VATReceived");
|
||||
$vatsup=$langs->trans("VATPaid");
|
||||
|
||||
@ -244,7 +244,7 @@ if ($modetax==0) { // Invoice for goods, payment for services
|
||||
$vatsup.=' ('.$langs->trans("ToGetBack").')';
|
||||
}
|
||||
}
|
||||
report_header($name,$namelink,$period,$periodlink,$description,$builddate,$exportlink,array(),$calcmode);
|
||||
report_header($name,'',$period,$periodlink,$description,$builddate,$exportlink,array(),$calcmode);
|
||||
|
||||
$vatcust=$langs->trans("VATReceived");
|
||||
$vatsup=$langs->trans("VATPaid");
|
||||
|
||||
@ -24,10 +24,10 @@
|
||||
|
||||
|
||||
/**
|
||||
* Show header of a VAT report
|
||||
* Show header of a report
|
||||
*
|
||||
* @param string $nom Name of report
|
||||
* @param string $variante Link for alternate report
|
||||
* @param string $reportname Name of report
|
||||
* @param string $notused Not used
|
||||
* @param string $period Period of report
|
||||
* @param string $periodlink Link to switch period
|
||||
* @param string $description Description
|
||||
@ -38,13 +38,13 @@
|
||||
* @param string $varlink Add a variable into the address of the page
|
||||
* @return void
|
||||
*/
|
||||
function report_header($nom,$variante,$period,$periodlink,$description,$builddate,$exportlink='',$moreparam=array(),$calcmode='', $varlink='')
|
||||
function report_header($reportname,$notused,$period,$periodlink,$description,$builddate,$exportlink='',$moreparam=array(),$calcmode='', $varlink='')
|
||||
{
|
||||
global $langs;
|
||||
|
||||
if (empty($hselected)) $hselected='report';
|
||||
|
||||
print "\n\n<!-- debut cartouche rapport -->\n";
|
||||
print "\n\n<!-- start banner of report -->\n";
|
||||
|
||||
if(! empty($varlink)) $varlink = '?'.$varlink;
|
||||
|
||||
@ -53,23 +53,25 @@ function report_header($nom,$variante,$period,$periodlink,$description,$builddat
|
||||
$head[$h][1] = $langs->trans("Report");
|
||||
$head[$h][2] = 'report';
|
||||
|
||||
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].$varlink.'">';
|
||||
|
||||
dol_fiche_head($head, 'report');
|
||||
|
||||
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].$varlink.'">';
|
||||
foreach($moreparam as $key => $value)
|
||||
{
|
||||
print '<input type="hidden" name="'.$key.'" value="'.$value.'">';
|
||||
}
|
||||
print '<table width="100%" class="border">';
|
||||
|
||||
$variante = ($periodlink || $exportlink);
|
||||
|
||||
// Ligne de titre
|
||||
print '<tr>';
|
||||
print '<td width="110">'.$langs->trans("ReportName").'</td>';
|
||||
if (! $variantexxx) print '<td colspan="3">';
|
||||
else print '<td>';
|
||||
print $nom;
|
||||
if ($variantexxx) print '</td><td colspan="2">'.$variantexxx;
|
||||
print '<td>';
|
||||
print $reportname;
|
||||
print '</td>';
|
||||
if ($variante) print '<td></td>';
|
||||
print '</tr>';
|
||||
|
||||
// Calculation mode
|
||||
@ -77,10 +79,9 @@ function report_header($nom,$variante,$period,$periodlink,$description,$builddat
|
||||
{
|
||||
print '<tr>';
|
||||
print '<td width="110">'.$langs->trans("CalculationMode").'</td>';
|
||||
if (! $variante) print '<td colspan="3">';
|
||||
else print '<td>';
|
||||
print '<td>';
|
||||
print $calcmode;
|
||||
if ($variante) print '</td><td colspan="2">'.$variante;
|
||||
if ($variante) print '<td></td>';
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
@ -88,35 +89,37 @@ function report_header($nom,$variante,$period,$periodlink,$description,$builddat
|
||||
// Ligne de la periode d'analyse du rapport
|
||||
print '<tr>';
|
||||
print '<td>'.$langs->trans("ReportPeriod").'</td>';
|
||||
if (! $periodlink) print '<td colspan="3">';
|
||||
else print '<td>';
|
||||
print '<td>';
|
||||
if ($period) print $period;
|
||||
if ($periodlink) print '</td><td colspan="2">'.$periodlink;
|
||||
if ($variante) print '<td>'.$periodlink.'</td>';
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
// Ligne de description
|
||||
print '<tr>';
|
||||
print '<td>'.$langs->trans("ReportDescription").'</td>';
|
||||
print '<td colspan="3">'.$description.'</td>';
|
||||
print '<td>'.$description.'</td>';
|
||||
if ($variante) print '<td></td>';
|
||||
print '</tr>';
|
||||
|
||||
// Ligne d'export
|
||||
print '<tr>';
|
||||
print '<td>'.$langs->trans("GeneratedOn").'</td>';
|
||||
if (! $exportlink) print '<td colspan="3">';
|
||||
else print '<td>';
|
||||
print '<td>';
|
||||
print dol_print_date($builddate, 'dayhour');
|
||||
if ($exportlink) print '</td><td>'.$langs->trans("Export").'</td><td>'.$exportlink;
|
||||
print '</td></tr>';
|
||||
print '</td>';
|
||||
if ($variante) print '<td>'.($exportlink ? $langs->trans("Export").': '.$exportlink : '').'</td>';
|
||||
print '</tr>';
|
||||
|
||||
print '</table>';
|
||||
|
||||
print '<br><div class="center"><input type="submit" class="button" name="submit" value="'.$langs->trans("Refresh").'"></div>';
|
||||
print '</form>';
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
print "\n<!-- fin cartouche rapport -->\n\n";
|
||||
print '<div class="center"><input type="submit" class="button" name="submit" value="'.$langs->trans("Refresh").'"></div>';
|
||||
|
||||
print '</form>';
|
||||
print '<br>';
|
||||
|
||||
print "\n<!-- end banner of report -->\n\n";
|
||||
}
|
||||
|
||||
|
||||
@ -31,7 +31,7 @@ ConfirmDeleteCptCategory=Are you sure you want to remove this accounting account
|
||||
JournalizationInLedgerStatus=Status of journalization
|
||||
AlreadyInGeneralLedger=Already journalized in ledgers
|
||||
NotYetInGeneralLedger=Not yet journalized in ledgers
|
||||
GroupIsEmptyCheckSetup=Group is empty, check setup of the accounting group
|
||||
GroupIsEmptyCheckSetup=Group is empty, check setup of the personalized accounting group
|
||||
DetailByAccount=Show detail by account
|
||||
|
||||
MainAccountForCustomersNotDefined=Main accounting account for customers not defined in setup
|
||||
|
||||
Loading…
Reference in New Issue
Block a user