Minor - Improve PSR-2 support
This commit is contained in:
parent
6cb69cdaba
commit
066a7acbaa
@ -40,8 +40,7 @@ $langs->load("other");
|
|||||||
|
|
||||||
// Date range
|
// Date range
|
||||||
$year=GETPOST("year");
|
$year=GETPOST("year");
|
||||||
if (empty($year))
|
if (empty($year)) {
|
||||||
{
|
|
||||||
$year_current = strftime("%Y",dol_now());
|
$year_current = strftime("%Y",dol_now());
|
||||||
$year_start = $year_current;
|
$year_start = $year_current;
|
||||||
} else {
|
} else {
|
||||||
@ -51,14 +50,13 @@ if (empty($year))
|
|||||||
$date_start=dol_mktime(0,0,0,$_REQUEST["date_startmonth"],$_REQUEST["date_startday"],$_REQUEST["date_startyear"]);
|
$date_start=dol_mktime(0,0,0,$_REQUEST["date_startmonth"],$_REQUEST["date_startday"],$_REQUEST["date_startyear"]);
|
||||||
$date_end=dol_mktime(23,59,59,$_REQUEST["date_endmonth"],$_REQUEST["date_endday"],$_REQUEST["date_endyear"]);
|
$date_end=dol_mktime(23,59,59,$_REQUEST["date_endmonth"],$_REQUEST["date_endday"],$_REQUEST["date_endyear"]);
|
||||||
// Quarter
|
// Quarter
|
||||||
if (empty($date_start) || empty($date_end)) // We define date_start and date_end
|
if (empty($date_start) || empty($date_end)) {// We define date_start and date_end
|
||||||
{
|
|
||||||
$q=GETPOST("q");
|
$q=GETPOST("q");
|
||||||
if (empty($q))
|
if (empty($q)) {
|
||||||
{
|
if (isset($_REQUEST["month"])) {
|
||||||
if (isset($_REQUEST["month"])) { $date_start=dol_get_first_day($year_start,$_REQUEST["month"],false); $date_end=dol_get_last_day($year_start,$_REQUEST["month"],false); }
|
$date_start=dol_get_first_day($year_start,$_REQUEST["month"],false);
|
||||||
else
|
$date_end=dol_get_last_day($year_start,$_REQUEST["month"],false);
|
||||||
{
|
} else {
|
||||||
$month_current = strftime("%m",dol_now());
|
$month_current = strftime("%m",dol_now());
|
||||||
if ($month_current >= 10) $q=4;
|
if ($month_current >= 10) $q=4;
|
||||||
elseif ($month_current >= 7) $q=3;
|
elseif ($month_current >= 7) $q=3;
|
||||||
@ -66,23 +64,41 @@ if (empty($date_start) || empty($date_end)) // We define date_start and date_end
|
|||||||
else $q=1;
|
else $q=1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ($q==1) { $date_start=dol_get_first_day($year_start,1,false); $date_end=dol_get_last_day($year_start,3,false); }
|
if ($q==1) {
|
||||||
if ($q==2) { $date_start=dol_get_first_day($year_start,4,false); $date_end=dol_get_last_day($year_start,6,false); }
|
$date_start=dol_get_first_day($year_start,1,false);
|
||||||
if ($q==3) { $date_start=dol_get_first_day($year_start,7,false); $date_end=dol_get_last_day($year_start,9,false); }
|
$date_end=dol_get_last_day($year_start,3,false);
|
||||||
if ($q==4) { $date_start=dol_get_first_day($year_start,10,false); $date_end=dol_get_last_day($year_start,12,false); }
|
}
|
||||||
|
if ($q==2) {
|
||||||
|
$date_start=dol_get_first_day($year_start,4,false);
|
||||||
|
$date_end=dol_get_last_day($year_start,6,false);
|
||||||
|
}
|
||||||
|
if ($q==3) {
|
||||||
|
$date_start=dol_get_first_day($year_start,7,false);
|
||||||
|
$date_end=dol_get_last_day($year_start,9,false);
|
||||||
|
}
|
||||||
|
if ($q==4) {
|
||||||
|
$date_start=dol_get_first_day($year_start,10,false);
|
||||||
|
$date_end=dol_get_last_day($year_start,12,false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$min = GETPOST("min");
|
$min = GETPOST("min");
|
||||||
if (empty($min)) $min = 0;
|
if (empty($min)) {
|
||||||
|
$min = 0;
|
||||||
|
}
|
||||||
|
|
||||||
// Define modetax (0 or 1)
|
// Define modetax (0 or 1)
|
||||||
// 0=normal, 1=option vat for services is on debit
|
// 0=normal, 1=option vat for services is on debit
|
||||||
$modetax = $conf->global->TAX_MODE;
|
$modetax = $conf->global->TAX_MODE;
|
||||||
if (isset($_REQUEST["modetax"])) $modetax=$_REQUEST["modetax"];
|
if (isset($_REQUEST["modetax"])) {
|
||||||
|
$modetax=$_REQUEST["modetax"];
|
||||||
|
}
|
||||||
|
|
||||||
// Security check
|
// Security check
|
||||||
$socid = GETPOST('socid','int');
|
$socid = GETPOST('socid','int');
|
||||||
if ($user->societe_id) $socid=$user->societe_id;
|
if ($user->societe_id) {
|
||||||
|
$socid=$user->societe_id;
|
||||||
|
}
|
||||||
$result = restrictedArea($user, 'tax', '', '', 'charges');
|
$result = restrictedArea($user, 'tax', '', '', 'charges');
|
||||||
|
|
||||||
|
|
||||||
@ -96,9 +112,10 @@ $company_static=new Societe($db);
|
|||||||
|
|
||||||
$morequerystring='';
|
$morequerystring='';
|
||||||
$listofparams=array('date_startmonth','date_startyear','date_startday','date_endmonth','date_endyear','date_endday');
|
$listofparams=array('date_startmonth','date_startyear','date_startday','date_endmonth','date_endyear','date_endday');
|
||||||
foreach($listofparams as $param)
|
foreach($listofparams as $param) {
|
||||||
{
|
if (GETPOST($param)!='') {
|
||||||
if (GETPOST($param)!='') $morequerystring.=($morequerystring?'&':'').$param.'='.GETPOST($param);
|
$morequerystring.=($morequerystring?'&':'').$param.'='.GETPOST($param);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
llxHeader('','','','',0,0,'','',$morequerystring);
|
llxHeader('','','','',0,0,'','',$morequerystring);
|
||||||
@ -110,8 +127,7 @@ $fsearch.=' '.$langs->trans("SalesTurnoverMinimum").': ';
|
|||||||
$fsearch.=' <input type="text" name="min" id="min" value="'.$min.'" size="6">';
|
$fsearch.=' <input type="text" name="min" id="min" value="'.$min.'" size="6">';
|
||||||
|
|
||||||
// Affiche en-tete du rapport
|
// Affiche en-tete du rapport
|
||||||
if ($modetax==1) // Calculate on invoice for goods and services
|
if ($modetax==1) { // Calculate on invoice for goods and services
|
||||||
{
|
|
||||||
$name=$langs->trans("VATReportByCustomersInDueDebtMode");
|
$name=$langs->trans("VATReportByCustomersInDueDebtMode");
|
||||||
$calcmode=$langs->trans("CalcModeVATDebt");
|
$calcmode=$langs->trans("CalcModeVATDebt");
|
||||||
$calcmode.='<br>('.$langs->trans("TaxModuleSetupToModifyRules",DOL_URL_ROOT.'/admin/taxes.php').')';
|
$calcmode.='<br>('.$langs->trans("TaxModuleSetupToModifyRules",DOL_URL_ROOT.'/admin/taxes.php').')';
|
||||||
@ -123,8 +139,11 @@ if ($modetax==1) // Calculate on invoice for goods and services
|
|||||||
$description.=$langs->trans("RulesVATDueProducts");
|
$description.=$langs->trans("RulesVATDueProducts");
|
||||||
//if ($conf->global->MAIN_MODULE_COMPTABILITE || $conf->global->MAIN_MODULE_ACCOUNTING) $description.='<br>'.img_warning().' '.$langs->trans('OptionVatInfoModuleComptabilite');
|
//if ($conf->global->MAIN_MODULE_COMPTABILITE || $conf->global->MAIN_MODULE_ACCOUNTING) $description.='<br>'.img_warning().' '.$langs->trans('OptionVatInfoModuleComptabilite');
|
||||||
//if (! empty($conf->global->MAIN_MODULE_COMPTABILITE)) $description.='<br>'.$langs->trans("WarningDepositsNotIncluded");
|
//if (! empty($conf->global->MAIN_MODULE_COMPTABILITE)) $description.='<br>'.$langs->trans("WarningDepositsNotIncluded");
|
||||||
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) $description.='<br>'.$langs->trans("DepositsAreNotIncluded");
|
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
|
||||||
else $description.='<br>'.$langs->trans("DepositsAreIncluded");
|
$description.='<br>'.$langs->trans("DepositsAreNotIncluded");
|
||||||
|
} else {
|
||||||
|
$description.='<br>'.$langs->trans("DepositsAreIncluded");
|
||||||
|
}
|
||||||
$description.=$fsearch;
|
$description.=$fsearch;
|
||||||
$builddate=time();
|
$builddate=time();
|
||||||
//$exportlink=$langs->trans("NotYetAvailable");
|
//$exportlink=$langs->trans("NotYetAvailable");
|
||||||
@ -132,14 +151,17 @@ if ($modetax==1) // Calculate on invoice for goods and services
|
|||||||
$elementcust=$langs->trans("CustomersInvoices");
|
$elementcust=$langs->trans("CustomersInvoices");
|
||||||
$productcust=$langs->trans("Description");
|
$productcust=$langs->trans("Description");
|
||||||
$amountcust=$langs->trans("AmountHT");
|
$amountcust=$langs->trans("AmountHT");
|
||||||
if ($mysoc->tva_assuj) $vatcust.=' ('.$langs->trans("ToPay").')';
|
if ($mysoc->tva_assuj) {
|
||||||
|
$vatcust.=' ('.$langs->trans("ToPay").')';
|
||||||
|
}
|
||||||
$elementsup=$langs->trans("SuppliersInvoices");
|
$elementsup=$langs->trans("SuppliersInvoices");
|
||||||
$productsup=$langs->trans("Description");
|
$productsup=$langs->trans("Description");
|
||||||
$amountsup=$langs->trans("AmountHT");
|
$amountsup=$langs->trans("AmountHT");
|
||||||
if ($mysoc->tva_assuj) $vatsup.=' ('.$langs->trans("ToGetBack").')';
|
if ($mysoc->tva_assuj) {
|
||||||
|
$vatsup.=' ('.$langs->trans("ToGetBack").')';
|
||||||
}
|
}
|
||||||
if ($modetax==0) // Invoice for goods, payment for services
|
}
|
||||||
{
|
if ($modetax==0) { // Invoice for goods, payment for services
|
||||||
$name=$langs->trans("VATReportByCustomersInInputOutputMode");
|
$name=$langs->trans("VATReportByCustomersInInputOutputMode");
|
||||||
$calcmode=$langs->trans("CalcModeVATEngagement");
|
$calcmode=$langs->trans("CalcModeVATEngagement");
|
||||||
$calcmode.='<br>('.$langs->trans("TaxModuleSetupToModifyRules",DOL_URL_ROOT.'/admin/taxes.php').')';
|
$calcmode.='<br>('.$langs->trans("TaxModuleSetupToModifyRules",DOL_URL_ROOT.'/admin/taxes.php').')';
|
||||||
@ -150,8 +172,11 @@ if ($modetax==0) // Invoice for goods, payment for services
|
|||||||
$description.=' '.$langs->trans("DepositsAreIncluded");
|
$description.=' '.$langs->trans("DepositsAreIncluded");
|
||||||
$description.='<br>';
|
$description.='<br>';
|
||||||
$description.=$langs->trans("RulesVATInProducts");
|
$description.=$langs->trans("RulesVATInProducts");
|
||||||
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) $description.=' '.$langs->trans("DepositsAreNotIncluded");
|
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
|
||||||
else $description.=' '.$langs->trans("DepositsAreIncluded");
|
$description .= ' ' . $langs->trans("DepositsAreNotIncluded");
|
||||||
|
} else {
|
||||||
|
$description .= ' ' . $langs->trans("DepositsAreIncluded");
|
||||||
|
}
|
||||||
//if ($conf->global->MAIN_MODULE_COMPTABILITE || $conf->global->MAIN_MODULE_ACCOUNTING) $description.='<br>'.img_warning().' '.$langs->trans('OptionVatInfoModuleComptabilite');
|
//if ($conf->global->MAIN_MODULE_COMPTABILITE || $conf->global->MAIN_MODULE_ACCOUNTING) $description.='<br>'.img_warning().' '.$langs->trans('OptionVatInfoModuleComptabilite');
|
||||||
//if (! empty($conf->global->MAIN_MODULE_COMPTABILITE)) $description.='<br>'.$langs->trans("WarningDepositsNotIncluded");
|
//if (! empty($conf->global->MAIN_MODULE_COMPTABILITE)) $description.='<br>'.$langs->trans("WarningDepositsNotIncluded");
|
||||||
$description.=$fsearch;
|
$description.=$fsearch;
|
||||||
@ -161,11 +186,15 @@ if ($modetax==0) // Invoice for goods, payment for services
|
|||||||
$elementcust=$langs->trans("CustomersInvoices");
|
$elementcust=$langs->trans("CustomersInvoices");
|
||||||
$productcust=$langs->trans("Description");
|
$productcust=$langs->trans("Description");
|
||||||
$amountcust=$langs->trans("AmountHT");
|
$amountcust=$langs->trans("AmountHT");
|
||||||
if ($mysoc->tva_assuj) $vatcust.=' ('.$langs->trans("ToPay").')';
|
if ($mysoc->tva_assuj) {
|
||||||
|
$vatcust.=' ('.$langs->trans("ToPay").')';
|
||||||
|
}
|
||||||
$elementsup=$langs->trans("SuppliersInvoices");
|
$elementsup=$langs->trans("SuppliersInvoices");
|
||||||
$productsup=$langs->trans("Description");
|
$productsup=$langs->trans("Description");
|
||||||
$amountsup=$langs->trans("AmountHT");
|
$amountsup=$langs->trans("AmountHT");
|
||||||
if ($mysoc->tva_assuj) $vatsup.=' ('.$langs->trans("ToGetBack").')';
|
if ($mysoc->tva_assuj) {
|
||||||
|
$vatsup.=' ('.$langs->trans("ToGetBack").')';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
report_header($name,$nomlink,$period,$periodlink,$description,$builddate,$exportlink,array(),$calcmode);
|
report_header($name,$nomlink,$period,$periodlink,$description,$builddate,$exportlink,array(),$calcmode);
|
||||||
|
|
||||||
@ -199,25 +228,18 @@ $parameters["direction"] = 'sell';
|
|||||||
$hookmanager->initHooks(array('externalbalance'));
|
$hookmanager->initHooks(array('externalbalance'));
|
||||||
$reshook=$hookmanager->executeHooks('addStatisticLine',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
|
$reshook=$hookmanager->executeHooks('addStatisticLine',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
|
||||||
|
|
||||||
if (is_array($coll_list))
|
if (is_array($coll_list)) {
|
||||||
{
|
|
||||||
$var=true;
|
$var=true;
|
||||||
$total = 0; $totalamount = 0;
|
$total = 0; $totalamount = 0;
|
||||||
$i = 1;
|
$i = 1;
|
||||||
foreach($coll_list as $coll)
|
foreach ($coll_list as $coll) {
|
||||||
{
|
if ($min == 0 or ($min > 0 && $coll->amount > $min)) {
|
||||||
if($min == 0 or ($min > 0 && $coll->amount > $min))
|
|
||||||
{
|
|
||||||
$var=!$var;
|
$var=!$var;
|
||||||
$intra = str_replace($find,$replace,$coll->tva_intra);
|
$intra = str_replace($find,$replace,$coll->tva_intra);
|
||||||
if(empty($intra))
|
if(empty($intra)) {
|
||||||
{
|
if($coll->assuj == '1') {
|
||||||
if($coll->assuj == '1')
|
|
||||||
{
|
|
||||||
$intra = $langs->trans('Unknown');
|
$intra = $langs->trans('Unknown');
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
//$intra = $langs->trans('NotRegistered');
|
//$intra = $langs->trans('NotRegistered');
|
||||||
$intra = '';
|
$intra = '';
|
||||||
}
|
}
|
||||||
@ -245,17 +267,16 @@ if (is_array($coll_list))
|
|||||||
print '<td class="nowrap" align="right">'.price($totalamount).'</td>';
|
print '<td class="nowrap" align="right">'.price($totalamount).'</td>';
|
||||||
print '<td class="nowrap" align="right">'.price($total).'</td>';
|
print '<td class="nowrap" align="right">'.price($total).'</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
$langs->load("errors");
|
$langs->load("errors");
|
||||||
if ($coll_list == -1)
|
if ($coll_list == -1) {
|
||||||
print '<tr><td colspan="5">' . $langs->trans("ErrorNoAccountancyModuleLoaded") . '</td></tr>';
|
print '<tr><td colspan="5">' . $langs->trans("ErrorNoAccountancyModuleLoaded") . '</td></tr>';
|
||||||
else if ($coll_list == -2)
|
} else if ($coll_list == -2) {
|
||||||
print '<tr><td colspan="5">' . $langs->trans("FeatureNotYetAvailable") . '</td></tr>';
|
print '<tr><td colspan="5">' . $langs->trans("FeatureNotYetAvailable") . '</td></tr>';
|
||||||
else
|
} else {
|
||||||
print '<tr><td colspan="5">' . $langs->trans("Error") . '</td></tr>';
|
print '<tr><td colspan="5">' . $langs->trans("Error") . '</td></tr>';
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//print '</table>';
|
//print '</table>';
|
||||||
|
|
||||||
@ -280,25 +301,18 @@ $coll_list = vat_by_thirdparty($db,0,$date_start,$date_end,$modetax,'buy');
|
|||||||
|
|
||||||
$parameters["direction"] = 'buy';
|
$parameters["direction"] = 'buy';
|
||||||
$reshook=$hookmanager->executeHooks('addStatisticLine',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
|
$reshook=$hookmanager->executeHooks('addStatisticLine',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
|
||||||
if (is_array($coll_list))
|
if (is_array($coll_list)) {
|
||||||
{
|
|
||||||
$var=true;
|
$var=true;
|
||||||
$total = 0; $totalamount = 0;
|
$total = 0; $totalamount = 0;
|
||||||
$i = 1;
|
$i = 1;
|
||||||
foreach($coll_list as $coll)
|
foreach ($coll_list as $coll) {
|
||||||
{
|
if ($min == 0 or ($min > 0 && $coll->amount > $min)) {
|
||||||
if($min == 0 or ($min > 0 && $coll->amount > $min))
|
|
||||||
{
|
|
||||||
$var=!$var;
|
$var=!$var;
|
||||||
$intra = str_replace($find,$replace,$coll->tva_intra);
|
$intra = str_replace($find,$replace,$coll->tva_intra);
|
||||||
if(empty($intra))
|
if (empty($intra)) {
|
||||||
{
|
if ($coll->assuj == '1') {
|
||||||
if($coll->assuj == '1')
|
|
||||||
{
|
|
||||||
$intra = $langs->trans('Unknown');
|
$intra = $langs->trans('Unknown');
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
//$intra = $langs->trans('NotRegistered');
|
//$intra = $langs->trans('NotRegistered');
|
||||||
$intra = '';
|
$intra = '';
|
||||||
}
|
}
|
||||||
@ -338,17 +352,16 @@ if (is_array($coll_list))
|
|||||||
print '<td class="liste_total nowrap" align="right"><b>'.price(price2num($diff,'MT'))."</b></td>\n";
|
print '<td class="liste_total nowrap" align="right"><b>'.price(price2num($diff,'MT'))."</b></td>\n";
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
|
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
$langs->load("errors");
|
$langs->load("errors");
|
||||||
if ($coll_list == -1)
|
if ($coll_list == -1) {
|
||||||
print '<tr><td colspan="5">' . $langs->trans("ErrorNoAccountancyModuleLoaded") . '</td></tr>';
|
print '<tr><td colspan="5">' . $langs->trans("ErrorNoAccountancyModuleLoaded") . '</td></tr>';
|
||||||
else if ($coll_list == -2)
|
} else if ($coll_list == -2) {
|
||||||
print '<tr><td colspan="5">' . $langs->trans("FeatureNotYetAvailable") . '</td></tr>';
|
print '<tr><td colspan="5">' . $langs->trans("FeatureNotYetAvailable") . '</td></tr>';
|
||||||
else
|
} else {
|
||||||
print '<tr><td colspan="5">' . $langs->trans("Error") . '</td></tr>';
|
print '<tr><td colspan="5">' . $langs->trans("Error") . '</td></tr>';
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
print '</table>';
|
print '</table>';
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user