Convert " " to \t to match custom coding conventions

This commit is contained in:
Yannick Warnier 2015-06-28 23:28:04 -05:00
parent 486a1547df
commit 3a8c93522f
4 changed files with 1170 additions and 1181 deletions

File diff suppressed because it is too large Load Diff

View File

@ -21,7 +21,7 @@
/** /**
* \file htdocs/compta/tva/clients.php * \file htdocs/compta/tva/clients.php
* \ingroup tax * \ingroup tax
* \brief Page des societes * \brief Page des societes
*/ */
@ -51,53 +51,53 @@ $date_start=dol_mktime(0,0,0,$_REQUEST["date_startmonth"],$_REQUEST["date_startd
$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_start=dol_get_first_day($year_start,$_REQUEST["month"],false);
$date_end=dol_get_last_day($year_start,$_REQUEST["month"],false); $date_end=dol_get_last_day($year_start,$_REQUEST["month"],false);
} else { } 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;
elseif ($month_current >= 4) $q=2; elseif ($month_current >= 4) $q=2;
else $q=1; else $q=1;
} }
} }
if ($q==1) { if ($q==1) {
$date_start=dol_get_first_day($year_start,1,false); $date_start=dol_get_first_day($year_start,1,false);
$date_end=dol_get_last_day($year_start,3,false); $date_end=dol_get_last_day($year_start,3,false);
} }
if ($q==2) { if ($q==2) {
$date_start=dol_get_first_day($year_start,4,false); $date_start=dol_get_first_day($year_start,4,false);
$date_end=dol_get_last_day($year_start,6,false); $date_end=dol_get_last_day($year_start,6,false);
} }
if ($q==3) { if ($q==3) {
$date_start=dol_get_first_day($year_start,7,false); $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,9,false);
} }
if ($q==4) { if ($q==4) {
$date_start=dol_get_first_day($year_start,10,false); $date_start=dol_get_first_day($year_start,10,false);
$date_end=dol_get_last_day($year_start,12,false); $date_end=dol_get_last_day($year_start,12,false);
} }
} }
$min = GETPOST("min"); $min = GETPOST("min");
if (empty($min)) { if (empty($min)) {
$min = 0; $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"])) { if (isset($_REQUEST["modetax"])) {
$modetax=$_REQUEST["modetax"]; $modetax=$_REQUEST["modetax"];
} }
// Security check // Security check
$socid = GETPOST('socid','int'); $socid = GETPOST('socid','int');
if ($user->societe_id) { if ($user->societe_id) {
$socid=$user->societe_id; $socid=$user->societe_id;
} }
$result = restrictedArea($user, 'tax', '', '', 'charges'); $result = restrictedArea($user, 'tax', '', '', 'charges');
@ -113,14 +113,14 @@ $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);
} }
} }
$special_report = false; $special_report = false;
if (isset($_REQUEST['extra_report']) && $_REQUEST['extra_report'] == 1) { if (isset($_REQUEST['extra_report']) && $_REQUEST['extra_report'] == 1) {
$special_report = true; $special_report = true;
} }
llxHeader('','','','',0,0,'','',$morequerystring); llxHeader('','','','',0,0,'','',$morequerystring);
@ -133,91 +133,91 @@ $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').')';
//$name.='<br>('.$langs->trans("SeeVATReportInInputOutputMode",'<a href="'.$_SERVER["PHP_SELF"].'?year='.$year_start.'&modetax=0">','</a>').')'; //$name.='<br>('.$langs->trans("SeeVATReportInInputOutputMode",'<a href="'.$_SERVER["PHP_SELF"].'?year='.$year_start.'&modetax=0">','</a>').')';
$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=$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);
//$periodlink=($year_start?"<a href='".$_SERVER["PHP_SELF"]."?year=".($year_start-1)."&modetax=".$modetax."'>".img_previous()."</a> <a href='".$_SERVER["PHP_SELF"]."?year=".($year_start+1)."&modetax=".$modetax."'>".img_next()."</a>":""); //$periodlink=($year_start?"<a href='".$_SERVER["PHP_SELF"]."?year=".($year_start-1)."&modetax=".$modetax."'>".img_previous()."</a> <a href='".$_SERVER["PHP_SELF"]."?year=".($year_start+1)."&modetax=".$modetax."'>".img_next()."</a>":"");
$description=$langs->trans("RulesVATDueServices"); $description=$langs->trans("RulesVATDueServices");
$description.='<br>'; $description.='<br>';
$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)) { if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
$description.='<br>'.$langs->trans("DepositsAreNotIncluded"); $description.='<br>'.$langs->trans("DepositsAreNotIncluded");
} else { } else {
$description.='<br>'.$langs->trans("DepositsAreIncluded"); $description.='<br>'.$langs->trans("DepositsAreIncluded");
} }
$description.=$fsearch; $description.=$fsearch;
$description.='<br>' $description.='<br>'
. '<input type="radio" name="extra_report" value="0" '.($special_report?'':'checked="checked"').'> ' . '<input type="radio" name="extra_report" value="0" '.($special_report?'':'checked="checked"').'> '
. $langs->trans('SimpleReport') . $langs->trans('SimpleReport')
. '</input>' . '</input>'
. '<br>' . '<br>'
. '<input type="radio" name="extra_report" value="1" '.($special_report?'checked="checked"':'').'> ' . '<input type="radio" name="extra_report" value="1" '.($special_report?'checked="checked"':'').'> '
. $langs->trans('AddExtraReport') . $langs->trans('AddExtraReport')
. '</input>' . '</input>'
. '<br>'; . '<br>';
$builddate=time(); $builddate=time();
//$exportlink=$langs->trans("NotYetAvailable"); //$exportlink=$langs->trans("NotYetAvailable");
$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) { if ($mysoc->tva_assuj) {
$vatcust.=' ('.$langs->trans("ToPay").')'; $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) { if ($mysoc->tva_assuj) {
$vatsup.=' ('.$langs->trans("ToGetBack").')'; $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').')';
//$name.='<br>('.$langs->trans("SeeVATReportInDueDebtMode",'<a href="'.$_SERVER["PHP_SELF"].'?year='.$year_start.'&modetax=1">','</a>').')'; //$name.='<br>('.$langs->trans("SeeVATReportInDueDebtMode",'<a href="'.$_SERVER["PHP_SELF"].'?year='.$year_start.'&modetax=1">','</a>').')';
$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=$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);
//$periodlink=($year_start?"<a href='".$_SERVER["PHP_SELF"]."?year=".($year_start-1)."&modetax=".$modetax."'>".img_previous()."</a> <a href='".$_SERVER["PHP_SELF"]."?year=".($year_start+1)."&modetax=".$modetax."'>".img_next()."</a>":""); //$periodlink=($year_start?"<a href='".$_SERVER["PHP_SELF"]."?year=".($year_start-1)."&modetax=".$modetax."'>".img_previous()."</a> <a href='".$_SERVER["PHP_SELF"]."?year=".($year_start+1)."&modetax=".$modetax."'>".img_next()."</a>":"");
$description=$langs->trans("RulesVATInServices"); $description=$langs->trans("RulesVATInServices");
$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)) { if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
$description .= ' ' . $langs->trans("DepositsAreNotIncluded"); $description .= ' ' . $langs->trans("DepositsAreNotIncluded");
} else { } else {
$description .= ' ' . $langs->trans("DepositsAreIncluded"); $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;
$description.='<br>' $description.='<br>'
. '<input type="radio" name="extra_report" value="0" '.($special_report?'':'checked="checked"').'> ' . '<input type="radio" name="extra_report" value="0" '.($special_report?'':'checked="checked"').'> '
. $langs->trans('SimpleReport') . $langs->trans('SimpleReport')
. '</input>' . '</input>'
. '<br>' . '<br>'
. '<input type="radio" name="extra_report" value="1" '.($special_report?'checked="checked"':'').'> ' . '<input type="radio" name="extra_report" value="1" '.($special_report?'checked="checked"':'').'> '
. $langs->trans('AddExtraReport') . $langs->trans('AddExtraReport')
. '</input>' . '</input>'
. '<br>'; . '<br>';
$builddate=time(); $builddate=time();
//$exportlink=$langs->trans("NotYetAvailable"); //$exportlink=$langs->trans("NotYetAvailable");
$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) { if ($mysoc->tva_assuj) {
$vatcust.=' ('.$langs->trans("ToPay").')'; $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) { if ($mysoc->tva_assuj) {
$vatsup.=' ('.$langs->trans("ToGetBack").')'; $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);
@ -278,27 +278,27 @@ if (is_array($coll_list)) {
print '<td class="nowrap">'.$intra."</td>"; print '<td class="nowrap">'.$intra."</td>";
print "<td class=\"nowrap\" align=\"right\">".price($coll->amount)."</td>"; print "<td class=\"nowrap\" align=\"right\">".price($coll->amount)."</td>";
print "<td class=\"nowrap\" align=\"right\">".price($coll->tva)."</td>"; print "<td class=\"nowrap\" align=\"right\">".price($coll->tva)."</td>";
$totalamount = $totalamount + $coll->amount; $totalamount = $totalamount + $coll->amount;
$total = $total + $coll->tva; $total = $total + $coll->tva;
print "</tr>\n"; print "</tr>\n";
$i++; $i++;
} }
} }
$x_coll_sum = $total; $x_coll_sum = $total;
print '<tr class="liste_total"><td align="right" colspan="3">'.$langs->trans("Total").':</td>'; print '<tr class="liste_total"><td align="right" colspan="3">'.$langs->trans("Total").':</td>';
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>';
@ -351,199 +351,196 @@ if (is_array($coll_list)) {
print '<td class="nowrap">'.$intra."</td>"; print '<td class="nowrap">'.$intra."</td>";
print "<td class=\"nowrap\" align=\"right\">".price($coll->amount)."</td>"; print "<td class=\"nowrap\" align=\"right\">".price($coll->amount)."</td>";
print "<td class=\"nowrap\" align=\"right\">".price($coll->tva)."</td>"; print "<td class=\"nowrap\" align=\"right\">".price($coll->tva)."</td>";
$totalamount = $totalamount + $coll->amount; $totalamount = $totalamount + $coll->amount;
$total = $total + $coll->tva; $total = $total + $coll->tva;
print "</tr>\n"; print "</tr>\n";
$i++; $i++;
} }
} }
$x_paye_sum = $total; $x_paye_sum = $total;
print '<tr class="liste_total"><td align="right" colspan="3">'.$langs->trans("Total").':</td>'; print '<tr class="liste_total"><td align="right" colspan="3">'.$langs->trans("Total").':</td>';
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>';
print '</table>'; print '</table>';
// Total to pay // Total to pay
print '<br><br>'; print '<br><br>';
print '<table class="noborder" width="100%">'; print '<table class="noborder" width="100%">';
$diff = $x_coll_sum - $x_paye_sum; $diff = $x_coll_sum - $x_paye_sum;
print '<tr class="liste_total">'; print '<tr class="liste_total">';
print '<td class="liste_total" colspan="4">'.$langs->trans("TotalToPay").($q?', '.$langs->trans("Quadri").' '.$q:'').'</td>'; print '<td class="liste_total" colspan="4">'.$langs->trans("TotalToPay").($q?', '.$langs->trans("Quadri").' '.$q:'').'</td>';
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>';
if ($special_report) { if ($special_report) {
// Get country 2-letters code // Get country 2-letters code
global $mysoc; global $mysoc;
$country_id = $mysoc->country_id; $country_id = $mysoc->country_id;
$country = new Ccountry($db); $country = new Ccountry($db);
$country->fetch($country_id); $country->fetch($country_id);
// Print listing of other-country customers as additional report // Print listing of other-country customers as additional report
// This matches tax requirements to list all same-country customers (only) // This matches tax requirements to list all same-country customers (only)
print '<h3>'.$langs->trans('OtherCountriesCustomersReport').'</h3>'; print '<h3>'.$langs->trans('OtherCountriesCustomersReport').'</h3>';
print $langs->trans('BasedOnTwoFirstLettersOfVATNumberBeingDifferentFromYourCompanyCountry'); print $langs->trans('BasedOnTwoFirstLettersOfVATNumberBeingDifferentFromYourCompanyCountry');
$coll_list = vat_by_thirdparty($db, 0, $date_start, $date_end, $modetax, $coll_list = vat_by_thirdparty($db, 0, $date_start, $date_end, $modetax, 'sell');
'sell');
print "<table class=\"noborder\" width=\"100%\">"; print "<table class=\"noborder\" width=\"100%\">";
print "<tr class=\"liste_titre\">"; print "<tr class=\"liste_titre\">";
print '<td align="left">' . $langs->trans("Num") . "</td>"; print '<td align="left">' . $langs->trans("Num") . "</td>";
print '<td align="left">' . $langs->trans("Customer") . "</td>"; print '<td align="left">' . $langs->trans("Customer") . "</td>";
print "<td>" . $langs->trans("VATIntra") . "</td>"; print "<td>" . $langs->trans("VATIntra") . "</td>";
print "<td align=\"right\">" . $langs->trans("AmountHTVATRealReceived") . "</td>"; print "<td align=\"right\">" . $langs->trans("AmountHTVATRealReceived") . "</td>";
print "<td align=\"right\">" . $vatcust . "</td>"; print "<td align=\"right\">" . $vatcust . "</td>";
print "</tr>\n"; print "</tr>\n";
if (is_array($coll_list)) { if (is_array($coll_list)) {
$var = true; $var = true;
$total = 0; $total = 0;
$totalamount = 0; $totalamount = 0;
$i = 1; $i = 1;
foreach ($coll_list as $coll) { foreach ($coll_list as $coll) {
if (substr($coll->tva_intra, 0, 2) == $country->code) { if (substr($coll->tva_intra, 0, 2) == $country->code) {
// Only use different-country VAT codes // Only use different-country VAT codes
continue; continue;
} }
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 = '';
} }
} }
print "<tr " . $bc[$var] . ">"; print "<tr " . $bc[$var] . ">";
print '<td class="nowrap">' . $i . "</td>"; print '<td class="nowrap">' . $i . "</td>";
$company_static->id = $coll->socid; $company_static->id = $coll->socid;
$company_static->name = $coll->name; $company_static->name = $coll->name;
$company_static->client = 1; $company_static->client = 1;
print '<td class="nowrap">' . $company_static->getNomUrl(1, print '<td class="nowrap">' . $company_static->getNomUrl(1,
'customer') . '</td>'; 'customer') . '</td>';
$find = array(' ', '.'); $find = array(' ', '.');
$replace = array('', ''); $replace = array('', '');
print '<td class="nowrap">' . $intra . "</td>"; print '<td class="nowrap">' . $intra . "</td>";
print "<td class=\"nowrap\" align=\"right\">" . price($coll->amount) . "</td>"; print "<td class=\"nowrap\" align=\"right\">" . price($coll->amount) . "</td>";
print "<td class=\"nowrap\" align=\"right\">" . price($coll->tva) . "</td>"; print "<td class=\"nowrap\" align=\"right\">" . price($coll->tva) . "</td>";
$totalamount = $totalamount + $coll->amount; $totalamount = $totalamount + $coll->amount;
$total = $total + $coll->tva; $total = $total + $coll->tva;
print "</tr>\n"; print "</tr>\n";
$i++; $i++;
} }
} }
$x_coll_sum = $total; $x_coll_sum = $total;
print '<tr class="liste_total"><td align="right" colspan="3">' . $langs->trans("Total") . ':</td>'; print '<tr class="liste_total"><td align="right" colspan="3">' . $langs->trans("Total") . ':</td>';
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 { } else {
if ($coll_list == -2) { 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>';
// Print listing of same-country customers as additional report // Print listing of same-country customers as additional report
// This matches tax requirements to list all same-country customers (only) // This matches tax requirements to list all same-country customers (only)
print '<h3>'.$langs->trans('SameCountryCustomersWithVAT').'</h3>'; print '<h3>'.$langs->trans('SameCountryCustomersWithVAT').'</h3>';
print $langs->trans('BasedOnTwoFirstLettersOfVATNumberBeingTheSameAsYourCompanyCountry'); print $langs->trans('BasedOnTwoFirstLettersOfVATNumberBeingTheSameAsYourCompanyCountry');
$coll_list = vat_by_thirdparty($db, 0, $date_start, $date_end, $modetax, $coll_list = vat_by_thirdparty($db, 0, $date_start, $date_end, $modetax, 'sell');
'sell');
print "<table class=\"noborder\" width=\"100%\">"; print "<table class=\"noborder\" width=\"100%\">";
print "<tr class=\"liste_titre\">"; print "<tr class=\"liste_titre\">";
print '<td align="left">' . $langs->trans("Num") . "</td>"; print '<td align="left">' . $langs->trans("Num") . "</td>";
print '<td align="left">' . $langs->trans("Customer") . "</td>"; print '<td align="left">' . $langs->trans("Customer") . "</td>";
print "<td>" . $langs->trans("VATIntra") . "</td>"; print "<td>" . $langs->trans("VATIntra") . "</td>";
print "<td align=\"right\">" . $langs->trans("AmountHTVATRealReceived") . "</td>"; print "<td align=\"right\">" . $langs->trans("AmountHTVATRealReceived") . "</td>";
print "<td align=\"right\">" . $vatcust . "</td>"; print "<td align=\"right\">" . $vatcust . "</td>";
print "</tr>\n"; print "</tr>\n";
if (is_array($coll_list)) { if (is_array($coll_list)) {
$var = true; $var = true;
$total = 0; $total = 0;
$totalamount = 0; $totalamount = 0;
$i = 1; $i = 1;
foreach ($coll_list as $coll) { foreach ($coll_list as $coll) {
if (substr($coll->tva_intra, 0, 2) != $country->code) { if (substr($coll->tva_intra, 0, 2) != $country->code) {
// Only use same-country VAT codes // Only use same-country VAT codes
continue; continue;
} }
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 = '';
} }
} }
print "<tr " . $bc[$var] . ">"; print "<tr " . $bc[$var] . ">";
print '<td class="nowrap">' . $i . "</td>"; print '<td class="nowrap">' . $i . "</td>";
$company_static->id = $coll->socid; $company_static->id = $coll->socid;
$company_static->name = $coll->name; $company_static->name = $coll->name;
$company_static->client = 1; $company_static->client = 1;
print '<td class="nowrap">' . $company_static->getNomUrl(1, print '<td class="nowrap">' . $company_static->getNomUrl(1, 'customer') . '</td>';
'customer') . '</td>'; $find = array(' ', '.');
$find = array(' ', '.'); $replace = array('', '');
$replace = array('', ''); print '<td class="nowrap">' . $intra . "</td>";
print '<td class="nowrap">' . $intra . "</td>"; print "<td class=\"nowrap\" align=\"right\">" . price($coll->amount) . "</td>";
print "<td class=\"nowrap\" align=\"right\">" . price($coll->amount) . "</td>"; print "<td class=\"nowrap\" align=\"right\">" . price($coll->tva) . "</td>";
print "<td class=\"nowrap\" align=\"right\">" . price($coll->tva) . "</td>"; $totalamount = $totalamount + $coll->amount;
$totalamount = $totalamount + $coll->amount; $total = $total + $coll->tva;
$total = $total + $coll->tva; print "</tr>\n";
print "</tr>\n"; $i++;
$i++; }
} }
} $x_coll_sum = $total;
$x_coll_sum = $total;
print '<tr class="liste_total"><td align="right" colspan="3">' . $langs->trans("Total") . ':</td>'; print '<tr class="liste_total"><td align="right" colspan="3">' . $langs->trans("Total") . ':</td>';
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 { } else {
if ($coll_list == -2) { 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>';
} }
llxFooter(); llxFooter();

View File

@ -286,7 +286,7 @@ if (!is_array($x_coll) || !is_array($x_paye)) {
$invoice_customer->id=$x_coll[$my_coll_rate]['facid'][$id]; $invoice_customer->id=$x_coll[$my_coll_rate]['facid'][$id];
$invoice_customer->ref=$x_coll[$my_coll_rate]['facnum'][$id]; $invoice_customer->ref=$x_coll[$my_coll_rate]['facnum'][$id];
$invoice_customer->type=$x_coll[$my_coll_rate]['type'][$id]; $invoice_customer->type=$x_coll[$my_coll_rate]['type'][$id];
$company_static->fetch($x_coll[$my_coll_rate]['company_id'][$id]); $company_static->fetch($x_coll[$my_coll_rate]['company_id'][$id]);
$x_both[$my_coll_rate]['coll']['detail'][] = array( $x_both[$my_coll_rate]['coll']['detail'][] = array(
'id' =>$x_coll[$my_coll_rate]['facid'][$id], 'id' =>$x_coll[$my_coll_rate]['facid'][$id],
'descr' =>$x_coll[$my_coll_rate]['descr'][$id], 'descr' =>$x_coll[$my_coll_rate]['descr'][$id],
@ -323,7 +323,7 @@ if (!is_array($x_coll) || !is_array($x_paye)) {
$invoice_supplier->id=$x_paye[$my_paye_rate]['facid'][$id]; $invoice_supplier->id=$x_paye[$my_paye_rate]['facid'][$id];
$invoice_supplier->ref=$x_paye[$my_paye_rate]['facnum'][$id]; $invoice_supplier->ref=$x_paye[$my_paye_rate]['facnum'][$id];
$invoice_supplier->type=$x_paye[$my_paye_rate]['type'][$id]; $invoice_supplier->type=$x_paye[$my_paye_rate]['type'][$id];
$company_static->fetch($x_paye[$my_paye_rate]['company_id'][$id]); $company_static->fetch($x_paye[$my_paye_rate]['company_id'][$id]);
$x_both[$my_paye_rate]['paye']['detail'][] = array( $x_both[$my_paye_rate]['paye']['detail'][] = array(
'id' =>$x_paye[$my_paye_rate]['facid'][$id], 'id' =>$x_paye[$my_paye_rate]['facid'][$id],
'descr' =>$x_paye[$my_paye_rate]['descr'][$id], 'descr' =>$x_paye[$my_paye_rate]['descr'][$id],
@ -336,7 +336,7 @@ if (!is_array($x_coll) || !is_array($x_paye)) {
'dtotal_ttc'=>price2num($x_paye[$my_paye_rate]['dtotal_ttc'][$id]), 'dtotal_ttc'=>price2num($x_paye[$my_paye_rate]['dtotal_ttc'][$id]),
'dtype' =>$x_paye[$my_paye_rate]['dtype'][$id], 'dtype' =>$x_paye[$my_paye_rate]['dtype'][$id],
'datef' =>$x_paye[$my_paye_rate]['datef'][$id], 'datef' =>$x_paye[$my_paye_rate]['datef'][$id],
'company_link'=>$company_static->getNomUrl(1,'',20), 'company_link'=>$company_static->getNomUrl(1,'',20),
'ddate_start'=>$x_paye[$my_paye_rate]['ddate_start'][$id], 'ddate_start'=>$x_paye[$my_paye_rate]['ddate_start'][$id],
'ddate_end' =>$x_paye[$my_paye_rate]['ddate_end'][$id], 'ddate_end' =>$x_paye[$my_paye_rate]['ddate_end'][$id],
'totalht' =>price2num($x_paye[$my_paye_rate]['totalht_list'][$id]), 'totalht' =>price2num($x_paye[$my_paye_rate]['totalht_list'][$id]),
@ -414,8 +414,8 @@ if (!is_array($x_coll) || !is_array($x_paye)) {
// Invoice date // Invoice date
print '<td align="left">' . $fields['datef'] . '</td>'; print '<td align="left">' . $fields['datef'] . '</td>';
// Company name // Company name
print '<td align="left">' . $fields['company_link'] . '</td>'; print '<td align="left">' . $fields['company_link'] . '</td>';
// Description // Description
print '<td align="left">'; print '<td align="left">';
@ -524,7 +524,7 @@ if (!is_array($x_coll) || !is_array($x_paye)) {
if (count($x_coll) == 0) { // Show a total ine if nothing shown if (count($x_coll) == 0) { // Show a total ine if nothing shown
print '<tr class="liste_total">'; print '<tr class="liste_total">';
print '<td colspan="'.$span.'"></td>'; print '<td colspan="'.$span.'"></td>';
print '<td align="right">'.$langs->trans("Total").':</td>'; print '<td align="right">'.$langs->trans("Total").':</td>';
if ($modetax == 0) { if ($modetax == 0) {
print '<td class="nowrap" align="right">&nbsp;</td>'; print '<td class="nowrap" align="right">&nbsp;</td>';
@ -582,8 +582,8 @@ if (!is_array($x_coll) || !is_array($x_paye)) {
print '<td class="nowrap" align="left">'.$fields['link'].'</td>'; print '<td class="nowrap" align="left">'.$fields['link'].'</td>';
// Invoice date // Invoice date
print '<td align="left">' . $fields['datef'] . '</td>'; print '<td align="left">' . $fields['datef'] . '</td>';
// Company name // Company name
print '<td align="left">' . $fields['company_link'] . '</td>'; print '<td align="left">' . $fields['company_link'] . '</td>';
// Description // Description
print '<td align="left">'; print '<td align="left">';
@ -669,7 +669,7 @@ if (!is_array($x_coll) || !is_array($x_paye)) {
} }
// Total suppliers for this vat rate // Total suppliers for this vat rate
print '<tr class="liste_total">'; print '<tr class="liste_total">';
print '<td colspan="'.$span.'"></td>'; print '<td colspan="'.$span.'"></td>';
print '<td align="right">'.$langs->trans("Total").':</td>'; print '<td align="right">'.$langs->trans("Total").':</td>';
if ($modetax == 0) { if ($modetax == 0) {
print '<td class="nowrap" align="right">&nbsp;</td>'; print '<td class="nowrap" align="right">&nbsp;</td>';
@ -682,7 +682,7 @@ if (!is_array($x_coll) || !is_array($x_paye)) {
if (count($x_paye) == 0) { // Show a total ine if nothing shown if (count($x_paye) == 0) { // Show a total ine if nothing shown
print '<tr class="liste_total">'; print '<tr class="liste_total">';
print '<td colspan="'.$span.'"></td>'; print '<td colspan="'.$span.'"></td>';
print '<td align="right">'.$langs->trans("Total").':</td>'; print '<td align="right">'.$langs->trans("Total").':</td>';
if ($modetax == 0) { if ($modetax == 0) {
print '<td class="nowrap" align="right">&nbsp;</td>'; print '<td class="nowrap" align="right">&nbsp;</td>';

View File

@ -24,18 +24,18 @@
/** /**
* Show header of a VAT report * Show header of a VAT report
* *
* @param string $nom Name of report * @param string $nom Name of report
* @param string $variante Link for alternate report * @param string $variante Link for alternate report
* @param string $period Period of report * @param string $period Period of report
* @param string $periodlink Link to switch period * @param string $periodlink Link to switch period
* @param string $description Description * @param string $description Description
* @param timestamp|integer $builddate Date generation * @param timestamp|integer $builddate Date generation
* @param string $exportlink Link for export or '' * @param string $exportlink Link for export or ''
* @param array $moreparam Array with list of params to add into form * @param array $moreparam Array with list of params to add into form
* @param string $calcmode Calculation mode * @param string $calcmode Calculation mode
* @return void * @return void
*/ */
function report_header($nom,$variante,$period,$periodlink,$description,$builddate,$exportlink='',$moreparam=array(),$calcmode='') function report_header($nom,$variante,$period,$periodlink,$description,$builddate,$exportlink='',$moreparam=array(),$calcmode='')
{ {
@ -55,7 +55,7 @@ function report_header($nom,$variante,$period,$periodlink,$description,$builddat
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">'; print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
foreach($moreparam as $key => $value) foreach($moreparam as $key => $value)
{ {
print '<input type="hidden" name="'.$key.'" value="'.$value.'">'; print '<input type="hidden" name="'.$key.'" value="'.$value.'">';
} }
print '<table width="100%" class="border">'; print '<table width="100%" class="border">';