diff --git a/htdocs/compta/tva/clients.php b/htdocs/compta/tva/clients.php index 5cff8a4b94d..e0a863a4f28 100644 --- a/htdocs/compta/tva/clients.php +++ b/htdocs/compta/tva/clients.php @@ -118,6 +118,11 @@ foreach($listofparams as $param) { } } +$special_report = false; +if (isset($_REQUEST['extra_report']) && $_REQUEST['extra_report'] == 1) { + $special_report = true; +} + llxHeader('','','','',0,0,'','',$morequerystring); $fsearch.='
'; @@ -145,6 +150,15 @@ if ($modetax==1) { // Calculate on invoice for goods and services $description.='
'.$langs->trans("DepositsAreIncluded"); } $description.=$fsearch; + $description.='
' + . ' ' + . $langs->trans('SimpleReport') + . '' + . '
' + . ' ' + . $langs->trans('AddExtraReport') + . '' + . '
'; $builddate=time(); //$exportlink=$langs->trans("NotYetAvailable"); @@ -180,6 +194,15 @@ if ($modetax==0) { // Invoice for goods, payment for services //if ($conf->global->MAIN_MODULE_COMPTABILITE || $conf->global->MAIN_MODULE_ACCOUNTING) $description.='
'.img_warning().' '.$langs->trans('OptionVatInfoModuleComptabilite'); //if (! empty($conf->global->MAIN_MODULE_COMPTABILITE)) $description.='
'.$langs->trans("WarningDepositsNotIncluded"); $description.=$fsearch; + $description.='
' + . ' ' + . $langs->trans('SimpleReport') + . '' + . '
' + . ' ' + . $langs->trans('AddExtraReport') + . '' + . '
'; $builddate=time(); //$exportlink=$langs->trans("NotYetAvailable"); @@ -365,153 +388,164 @@ if (is_array($coll_list)) { print ''; -// Get country 2-letters code -global $mysoc; -$country_id = $mysoc->country_id; -$country = new Ccountry($db); -$country->fetch($country_id); +if ($special_report) { + // Get country 2-letters code + global $mysoc; + $country_id = $mysoc->country_id; + $country = new Ccountry($db); + $country->fetch($country_id); -// Print listing of other-country customers as additional report -// This matches tax requirements to list all same-country customers (only) -print '

Other countries customers

'; -print 'Based on 2 first letters of VAT number being different from your company\'s country'; -$coll_list = vat_by_thirdparty($db,0,$date_start,$date_end,$modetax,'sell'); + // Print listing of other-country customers as additional report + // This matches tax requirements to list all same-country customers (only) + print '

'.$langs->trans('OtherCountriesCustomersReport').'

'; + print $langs->trans('BasedOnTwoFirstLettersOfVATNumberBeingDifferentFromYourCompanyCountry'); + $coll_list = vat_by_thirdparty($db, 0, $date_start, $date_end, $modetax, + 'sell'); -print ""; -print ""; -print '"; -print '"; -print ""; -print ""; -print ""; -print "\n"; + print "
'.$langs->trans("Num")."'.$langs->trans("Customer")."".$langs->trans("VATIntra")."".$langs->trans("AmountHTVATRealReceived")."".$vatcust."
"; + print ""; + print '"; + print '"; + print ""; + print ""; + print ""; + print "\n"; -if (is_array($coll_list)) { - $var=true; - $total = 0; - $totalamount = 0; - $i = 1; - foreach($coll_list as $coll) { - if (substr($coll->tva_intra, 0, 2) == $country->code) { - // Only use different-country VAT codes - continue; - } - if ($min == 0 or ($min > 0 && $coll->amount > $min)) { - $var=!$var; - $intra = str_replace($find,$replace,$coll->tva_intra); - if (empty($intra)) { - if ($coll->assuj == '1') { - $intra = $langs->trans('Unknown'); - } else { - //$intra = $langs->trans('NotRegistered'); - $intra = ''; - } + if (is_array($coll_list)) { + $var = true; + $total = 0; + $totalamount = 0; + $i = 1; + foreach ($coll_list as $coll) { + if (substr($coll->tva_intra, 0, 2) == $country->code) { + // Only use different-country VAT codes + continue; } - print ""; - print '"; - $company_static->id=$coll->socid; - $company_static->name=$coll->name; - $company_static->client=1; - print ''; - $find = array(' ','.'); - $replace = array('',''); - print '"; - print ""; - print ""; - $totalamount = $totalamount + $coll->amount; - $total = $total + $coll->tva; - print "\n"; - $i++; - } - } - $x_coll_sum = $total; - - print ''; - print ''; - print ''; - print ''; -} else { - $langs->load("errors"); - if ($coll_list == -1) { - print ''; - } else if ($coll_list == -2) { - print ''; - } else { - print ''; - } -} -print '
' . $langs->trans("Num") . "' . $langs->trans("Customer") . "" . $langs->trans("VATIntra") . "" . $langs->trans("AmountHTVATRealReceived") . "" . $vatcust . "
'.$i."'.$company_static->getNomUrl(1,'customer').''.$intra."".price($coll->amount)."".price($coll->tva)."
'.$langs->trans("Total").':'.price($totalamount).''.price($total).'
' . $langs->trans("ErrorNoAccountancyModuleLoaded") . '
' . $langs->trans("FeatureNotYetAvailable") . '
' . $langs->trans("Error") . '
'; - -// Print listing of same-country customers as additional report -// This matches tax requirements to list all same-country customers (only) -print '

Same country customers with VAT

'; -print 'Based on 2 first letters of VAT number being the same as your company\'s country'; -$coll_list = vat_by_thirdparty($db,0,$date_start,$date_end,$modetax,'sell'); - -print ""; -print ""; -print '"; -print '"; -print ""; -print ""; -print ""; -print "\n"; - -if (is_array($coll_list)) { - $var=true; - $total = 0; $totalamount = 0; - $i = 1; - foreach ($coll_list as $coll) { - if (substr($coll->tva_intra, 0, 2) != $country->code) { - // Only use same-country VAT codes - continue; - } - if ($min == 0 or ($min > 0 && $coll->amount > $min)) { - $var=!$var; - $intra = str_replace($find,$replace,$coll->tva_intra); - if (empty($intra)) { - if ($coll->assuj == '1') { - $intra = $langs->trans('Unknown'); - } else { - //$intra = $langs->trans('NotRegistered'); - $intra = ''; + if ($min == 0 or ($min > 0 && $coll->amount > $min)) { + $var = !$var; + $intra = str_replace($find, $replace, $coll->tva_intra); + if (empty($intra)) { + if ($coll->assuj == '1') { + $intra = $langs->trans('Unknown'); + } else { + //$intra = $langs->trans('NotRegistered'); + $intra = ''; + } } + print ""; + print '"; + $company_static->id = $coll->socid; + $company_static->name = $coll->name; + $company_static->client = 1; + print ''; + $find = array(' ', '.'); + $replace = array('', ''); + print '"; + print ""; + print ""; + $totalamount = $totalamount + $coll->amount; + $total = $total + $coll->tva; + print "\n"; + $i++; + } + } + $x_coll_sum = $total; + + print ''; + print ''; + print ''; + print ''; + } else { + $langs->load("errors"); + if ($coll_list == -1) { + print ''; + } else { + if ($coll_list == -2) { + print ''; + } else { + print ''; } - print ""; - print '"; - $company_static->id=$coll->socid; - $company_static->name=$coll->name; - $company_static->client=1; - print ''; - $find = array(' ', '.'); - $replace = array('', ''); - print '"; - print ""; - print ""; - $totalamount = $totalamount + $coll->amount; - $total = $total + $coll->tva; - print "\n"; - $i++; } } - $x_coll_sum = $total; + print '
'.$langs->trans("Num")."'.$langs->trans("Customer")."".$langs->trans("VATIntra")."".$langs->trans("AmountHTVATRealReceived")."".$vatcust."
' . $i . "' . $company_static->getNomUrl(1, + 'customer') . '' . $intra . "" . price($coll->amount) . "" . price($coll->tva) . "
' . $langs->trans("Total") . ':' . price($totalamount) . '' . price($total) . '
' . $langs->trans("ErrorNoAccountancyModuleLoaded") . '
' . $langs->trans("FeatureNotYetAvailable") . '
' . $langs->trans("Error") . '
'.$i."'.$company_static->getNomUrl(1, 'customer').''.$intra."".price($coll->amount)."".price($coll->tva)."
'; - print ''.$langs->trans("Total").':'; - print ''.price($totalamount).''; - print ''.price($total).''; - print ''; -} else { - $langs->load("errors"); - if ($coll_list == -1) { - print ''.$langs->trans("ErrorNoAccountancyModuleLoaded").''; - } else if ($coll_list == -2) { - print ''.$langs->trans("FeatureNotYetAvailable").''; + // Print listing of same-country customers as additional report + // This matches tax requirements to list all same-country customers (only) + print '

'.$langs->trans('SameCountryCustomersWithVAT').'

'; + print $langs->trans('BasedOnTwoFirstLettersOfVATNumberBeingTheSameAsYourCompanyCountry'); + $coll_list = vat_by_thirdparty($db, 0, $date_start, $date_end, $modetax, + 'sell'); + + print ""; + print ""; + print '"; + print '"; + print ""; + print ""; + print ""; + print "\n"; + + if (is_array($coll_list)) { + $var = true; + $total = 0; + $totalamount = 0; + $i = 1; + foreach ($coll_list as $coll) { + if (substr($coll->tva_intra, 0, 2) != $country->code) { + // Only use same-country VAT codes + continue; + } + if ($min == 0 or ($min > 0 && $coll->amount > $min)) { + $var = !$var; + $intra = str_replace($find, $replace, $coll->tva_intra); + if (empty($intra)) { + if ($coll->assuj == '1') { + $intra = $langs->trans('Unknown'); + } else { + //$intra = $langs->trans('NotRegistered'); + $intra = ''; + } + } + print ""; + print '"; + $company_static->id = $coll->socid; + $company_static->name = $coll->name; + $company_static->client = 1; + print ''; + $find = array(' ', '.'); + $replace = array('', ''); + print '"; + print ""; + print ""; + $totalamount = $totalamount + $coll->amount; + $total = $total + $coll->tva; + print "\n"; + $i++; + } + } + $x_coll_sum = $total; + + print ''; + print ''; + print ''; + print ''; } else { - print ''; + $langs->load("errors"); + if ($coll_list == -1) { + print ''; + } else { + if ($coll_list == -2) { + print ''; + } else { + print ''; + } + } } + print '
' . $langs->trans("Num") . "' . $langs->trans("Customer") . "" . $langs->trans("VATIntra") . "" . $langs->trans("AmountHTVATRealReceived") . "" . $vatcust . "
' . $i . "' . $company_static->getNomUrl(1, + 'customer') . '' . $intra . "" . price($coll->amount) . "" . price($coll->tva) . "
' . $langs->trans("Total") . ':' . price($totalamount) . '' . price($total) . '
'.$langs->trans("Error").'
' . $langs->trans("ErrorNoAccountancyModuleLoaded") . '
' . $langs->trans("FeatureNotYetAvailable") . '
' . $langs->trans("Error") . '
'; } - llxFooter(); $db->close();