|
noalyss
Version-6.7.2
|
Parent class for the print_ledger class. More...
Static Public Member Functions | |
| static | factory (Database $cn, $p_type_export, $p_format_output, Acc_Ledger $p_ledger) |
| Create an object Print_Ledger* depending on $p_type_export ( 0 => accounting 1-> one row per operation 2-> detail of item) | |
Parent class for the print_ledger class.
Definition at line 38 of file class_print_ledger.php.
| static Print_Ledger::factory | ( | Database $ | cn, |
| $ | p_type_export, | ||
| $ | p_format_output, | ||
| Acc_Ledger $ | p_ledger | ||
| ) | [static] |
Create an object Print_Ledger* depending on $p_type_export ( 0 => accounting 1-> one row per operation 2-> detail of item)
| type | $cn | |
| type | $p_type_export | |
| type | $p_format_output | CSV or PDF |
| Acc_Ledger | $ledger |
For PDF output
Definition at line 48 of file class_print_ledger.php.
References $jrn_type, $own, $pdf, Acc_Ledger\get_type(), and Database\get_value().
{
/**
* For PDF output
*/
if ($p_format_output == 'PDF') {
switch ($p_type_export) {
case 0:
//---------------------------------------------
// Detailled Printing (accounting )
//---------------------------------------------
return new Print_Ledger_Detail($cn, $p_ledger);
break;
case 1:
//----------------------------------------------------------------------
// Simple Printing Purchase Ledger
//---------------------------------------------------------------------
$own = new Own($cn);
$jrn_type = $p_ledger->get_type();
if ($jrn_type == 'ACH' || $jrn_type == 'VEN') {
if (
($jrn_type == 'ACH' && $cn->get_value('select count(qp_id) from quant_purchase') == 0) ||
($jrn_type == 'VEN' && $cn->get_value('select count(qs_id) from quant_sold') == 0)
) {
$pdf = new Print_Ledger_Simple_without_vat($cn, $p_ledger);
$pdf->set_error('Ce journal ne peut être imprimé en mode simple');
return $pdf;
}
if ($own->MY_TVA_USE == 'Y') {
$pdf = new Print_Ledger_Simple($cn, $p_ledger);
return $pdf;
}
if ($own->MY_TVA_USE == 'N') {
$pdf = new Print_Ledger_Simple_without_vat($cn, $p_ledger);
return $pdf;
}
}
if ($jrn_type == 'FIN') {
$pdf = new Print_Ledger_Financial($cn, $p_ledger);
return $pdf;
}
if ($jrn_type == 'ODS' || $p_ledger->id == 0) {
$pdf = new Print_Ledger_Misc($cn, $p_ledger);
return $pdf;
}
break;
case 2:
/**********************************************************
* Print Detail Operation + Item
********************************************************** */
$own = new Own($cn);
$jrn_type = $p_ledger->get_type();
if ($jrn_type == 'FIN') {
$pdf = new Print_Ledger_Financial($cn, $p_ledger);
return $pdf;
;
}
if ($jrn_type == 'ODS' || $p_ledger->id == 0) {
$pdf = new Print_Ledger_Misc($cn, $p_ledger);
return $pdf;
}
if (
($jrn_type == 'ACH' && $cn->get_value('select count(qp_id) from quant_purchase') == 0) ||
($jrn_type == 'VEN' && $cn->get_value('select count(qs_id) from quant_sold') == 0)
) {
$pdf = new Print_Ledger_Simple_without_vat($cn, $p_ledger);
$pdf->set_error('Ce journal ne peut être imprimé en mode simple');
return $pdf;
}
$pdf = new Print_Ledger_Detail_Item($cn,$p_ledger);
return $pdf;
} // end switch
} // end $p_format == PDF
}