Review ER : remove fk_c_tva and add option MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT
This commit is contained in:
parent
2895241420
commit
0ff97da1ea
@ -341,10 +341,13 @@ class pdf_standard extends ModeleExpenseReport
|
||||
$pdf->MultiCell($this->posxtva-$this->posxprojet-1, 3,$object->lines[$i]->projet_ref, 0, 'C');
|
||||
|
||||
// VAT Rate
|
||||
$vat_rate = pdf_getlinevatrate($object, $i, $outputlangs, $hidedetails);
|
||||
$pdf->SetFont('','', $default_font_size - 1);
|
||||
$pdf->SetXY($this->posxtva, $curY);
|
||||
$pdf->MultiCell($this->posxup-$this->posxtva-1, 3,$vat_rate, 0, 'R');
|
||||
if (empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT))
|
||||
{
|
||||
$vat_rate = pdf_getlinevatrate($object, $i, $outputlangs, $hidedetails);
|
||||
$pdf->SetFont('','', $default_font_size - 1);
|
||||
$pdf->SetXY($this->posxtva, $curY);
|
||||
$pdf->MultiCell($this->posxup-$this->posxtva-1, 3,$vat_rate, 0, 'R');
|
||||
}
|
||||
|
||||
// Unit price
|
||||
$pdf->SetFont('','', $default_font_size - 1);
|
||||
@ -441,12 +444,15 @@ class pdf_standard extends ModeleExpenseReport
|
||||
$pdf->MultiCell($this->page_largeur - $this->marge_gauche - 160, 5, price($object->total_ht), 1, 'R');
|
||||
$pdf->SetFillColor(248,248,248);
|
||||
|
||||
$posy+=5;
|
||||
$pdf->SetXY(100, $posy);
|
||||
$pdf->SetTextColor(0,0,60);
|
||||
$pdf->MultiCell(60, 5, $outputlangs->transnoentities("TotalVAT"), 1,'L');
|
||||
$pdf->SetXY(160, $posy);
|
||||
$pdf->MultiCell($this->page_largeur - $this->marge_gauche - 160, 5, price($object->total_tva),1, 'R');
|
||||
if (empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT))
|
||||
{
|
||||
$posy+=5;
|
||||
$pdf->SetXY(100, $posy);
|
||||
$pdf->SetTextColor(0,0,60);
|
||||
$pdf->MultiCell(60, 5, $outputlangs->transnoentities("TotalVAT"), 1,'L');
|
||||
$pdf->SetXY(160, $posy);
|
||||
$pdf->MultiCell($this->page_largeur - $this->marge_gauche - 160, 5, price($object->total_tva),1, 'R');
|
||||
}
|
||||
|
||||
$posy+=5;
|
||||
$pdf->SetXY(100, $posy);
|
||||
@ -768,9 +774,12 @@ class pdf_standard extends ModeleExpenseReport
|
||||
$pdf->MultiCell($this->posxtva-$this->posxprojet-1,2, $outputlangs->transnoentities("Project"),'','C');
|
||||
|
||||
// VAT
|
||||
$pdf->line($this->posxtva-1, $tab_top, $this->posxtva-1, $tab_top + $tab_height);
|
||||
$pdf->SetXY($this->posxtva-1, $tab_top+1);
|
||||
$pdf->MultiCell($this->posxup-$this->posxtva-1,2, $outputlangs->transnoentities("VAT"),'','C');
|
||||
if (empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT))
|
||||
{
|
||||
$pdf->line($this->posxtva-1, $tab_top, $this->posxtva-1, $tab_top + $tab_height);
|
||||
$pdf->SetXY($this->posxtva-1, $tab_top+1);
|
||||
$pdf->MultiCell($this->posxup-$this->posxtva-1,2, $outputlangs->transnoentities("VAT"),'','C');
|
||||
}
|
||||
|
||||
// Unit price
|
||||
$pdf->line($this->posxup-1, $tab_top, $this->posxup-1, $tab_top + $tab_height);
|
||||
|
||||
@ -203,8 +203,8 @@ class modExpenseReport extends DolibarrModules
|
||||
$this->export_label[$r]='ListTripsAndExpenses';
|
||||
$this->export_icon[$r]='trip';
|
||||
$this->export_permission[$r]=array(array("expensereport","export"));
|
||||
$this->export_fields_array[$r]=array('d.rowid'=>"TripId",'d.ref'=>'Ref','d.date_debut'=>'DateStart','d.date_fin'=>'DateEnd','d.date_create'=>'DateCreation','d.date_approve'=>'DateApprove','d.total_ht'=>"TotalHT",'d.total_tva'=>'TotalVAT','d.total_ttc'=>'TotalTTC','d.note_private'=>'NotePrivate','d.note_public'=>'NotePublic','u.lastname'=>'Lastname','u.firstname'=>'Firstname','u.login'=>"Login",'ed.rowid'=>'LineId','tf.code'=>'Type','ed.date'=>'Date','ed.fk_c_tva'=>'VATRate','ed.total_ht'=>'TotalHT','ed.total_tva'=>'TotalVAT','ed.total_ttc'=>'TotalTTC','ed.comments'=>'Comment','p.rowid'=>'ProjectId','p.ref'=>'Ref');
|
||||
$this->export_entities_array[$r]=array('u.lastname'=>'user','u.firstname'=>'user','u.login'=>'user','ed.rowid'=>'expensereport_line','ed.date'=>'expensereport_line','ed.fk_c_tva'=>'expensereport_line','ed.total_ht'=>'expensereport_line','ed.total_tva'=>'expensereport_line','ed.total_ttc'=>'expensereport_line','ed.comments'=>'expensereport_line','tf.code'=>'expensereport_line','p.project_ref'=>'expensereport_line','p.rowid'=>'project','p.ref'=>'project');
|
||||
$this->export_fields_array[$r]=array('d.rowid'=>"TripId",'d.ref'=>'Ref','d.date_debut'=>'DateStart','d.date_fin'=>'DateEnd','d.date_create'=>'DateCreation','d.date_approve'=>'DateApprove','d.total_ht'=>"TotalHT",'d.total_tva'=>'TotalVAT','d.total_ttc'=>'TotalTTC','d.note_private'=>'NotePrivate','d.note_public'=>'NotePublic','u.lastname'=>'Lastname','u.firstname'=>'Firstname','u.login'=>"Login",'ed.rowid'=>'LineId','tf.code'=>'Type','ed.date'=>'Date','ed.tva_tx'=>'VATRate','ed.total_ht'=>'TotalHT','ed.total_tva'=>'TotalVAT','ed.total_ttc'=>'TotalTTC','ed.comments'=>'Comment','p.rowid'=>'ProjectId','p.ref'=>'Ref');
|
||||
$this->export_entities_array[$r]=array('u.lastname'=>'user','u.firstname'=>'user','u.login'=>'user','ed.rowid'=>'expensereport_line','ed.date'=>'expensereport_line','ed.tva_tx'=>'expensereport_line','ed.total_ht'=>'expensereport_line','ed.total_tva'=>'expensereport_line','ed.total_ttc'=>'expensereport_line','ed.comments'=>'expensereport_line','tf.code'=>'expensereport_line','p.project_ref'=>'expensereport_line','p.rowid'=>'project','p.ref'=>'project');
|
||||
$this->export_alias_array[$r]=array('d.rowid'=>"idtrip",'d.type'=>"type",'d.note_private'=>'note_private','d.note_public'=>'note_public','u.lastname'=>'name','u.firstname'=>'firstname','u.login'=>'login');
|
||||
$this->export_dependencies_array[$r]=array('expensereport_line'=>'ed.rowid','type_fees'=>'tf.rowid'); // To add unique key if we ask a field of a child to avoid the DISTINCT to discard them
|
||||
|
||||
|
||||
@ -859,7 +859,6 @@ if ($action == "addline")
|
||||
|
||||
$object_ligne->fk_c_type_fees = GETPOST('fk_c_type_fees');
|
||||
|
||||
$object_ligne->fk_c_tva = GETPOST('fk_c_tva');
|
||||
$object_ligne->vatrate = price2num(GETPOST('vatrate'));
|
||||
|
||||
$object_ligne->fk_projet = $fk_projet;
|
||||
@ -980,7 +979,6 @@ if ($action == "updateligne" )
|
||||
|
||||
$rowid = $_POST['rowid'];
|
||||
$type_fees_id = GETPOST('fk_c_type_fees');
|
||||
$object_ligne->fk_c_tva = GETPOST('fk_c_tva');
|
||||
$object_ligne->vatrate = price2num(GETPOST('vatrate'));
|
||||
$projet_id = $fk_projet;
|
||||
$comments = GETPOST('comments');
|
||||
@ -1622,7 +1620,7 @@ else
|
||||
|
||||
// Fetch Lines of current expense report
|
||||
$sql = 'SELECT fde.rowid, fde.fk_expensereport, fde.fk_c_type_fees, fde.fk_projet, fde.date,';
|
||||
$sql.= ' fde.fk_c_tva as fk_c_tva, fde.tva_tx as vatrate, fde.comments, fde.qty, fde.value_unit, fde.total_ht, fde.total_tva, fde.total_ttc,';
|
||||
$sql.= ' fde.tva_tx as vatrate, fde.comments, fde.qty, fde.value_unit, fde.total_ht, fde.total_tva, fde.total_ttc,';
|
||||
$sql.= ' ctf.code as type_fees_code, ctf.label as type_fees_libelle,';
|
||||
$sql.= ' pjt.rowid as projet_id, pjt.title as projet_title, pjt.ref as projet_ref';
|
||||
$sql.= ' FROM '.MAIN_DB_PREFIX.'expensereport_det as fde';
|
||||
|
||||
@ -744,7 +744,7 @@ class ExpenseReport extends CommonObject
|
||||
$this->lines=array();
|
||||
|
||||
$sql = ' SELECT de.rowid, de.comments, de.qty, de.value_unit, de.date,';
|
||||
$sql.= ' de.'.$this->fk_element.', de.fk_c_type_fees, de.fk_projet, de.fk_c_tva, de.tva_tx as vatrate,';
|
||||
$sql.= ' de.'.$this->fk_element.', de.fk_c_type_fees, de.fk_projet, de.tva_tx as vatrate,';
|
||||
$sql.= ' de.total_ht, de.total_tva, de.total_ttc,';
|
||||
$sql.= ' ctf.code as code_type_fees, ctf.label as libelle_type_fees,';
|
||||
$sql.= ' p.ref as ref_projet, p.title as title_projet';
|
||||
@ -774,7 +774,6 @@ class ExpenseReport extends CommonObject
|
||||
$deplig->fk_expensereport = $objp->fk_expensereport;
|
||||
$deplig->fk_c_type_fees = $objp->fk_c_type_fees;
|
||||
$deplig->fk_projet = $objp->fk_projet;
|
||||
$deplig->fk_c_tva = $objp->fk_c_tva;
|
||||
|
||||
$deplig->total_ht = $objp->total_ht;
|
||||
$deplig->total_tva = $objp->total_tva;
|
||||
@ -1506,7 +1505,6 @@ class ExpenseReportLine
|
||||
var $value_unit;
|
||||
var $date;
|
||||
|
||||
var $fk_c_tva;
|
||||
var $fk_c_type_fees;
|
||||
var $fk_projet;
|
||||
var $fk_expensereport;
|
||||
@ -1541,7 +1539,7 @@ class ExpenseReportLine
|
||||
function fetch($rowid)
|
||||
{
|
||||
$sql = 'SELECT fde.rowid, fde.fk_expensereport, fde.fk_c_type_fees, fde.fk_projet, fde.date,';
|
||||
$sql.= ' fde.fk_c_tva as fk_c_tva, fde.tva_tx as vatrate, fde.comments, fde.qty, fde.value_unit, fde.total_ht, fde.total_tva, fde.total_ttc,';
|
||||
$sql.= ' fde.tva_tx as vatrate, fde.comments, fde.qty, fde.value_unit, fde.total_ht, fde.total_tva, fde.total_ttc,';
|
||||
$sql.= ' ctf.code as type_fees_code, ctf.label as type_fees_libelle,';
|
||||
$sql.= ' pjt.rowid as projet_id, pjt.title as projet_title, pjt.ref as projet_ref';
|
||||
$sql.= ' FROM '.MAIN_DB_PREFIX.'expensereport_det as fde';
|
||||
@ -1561,7 +1559,6 @@ class ExpenseReportLine
|
||||
$this->qty = $objp->qty;
|
||||
$this->date = $objp->date;
|
||||
$this->value_unit = $objp->value_unit;
|
||||
$this->fk_c_tva = $objp->fk_c_tva;
|
||||
$this->fk_c_type_fees = $objp->fk_c_type_fees;
|
||||
$this->fk_projet = $objp->fk_projet;
|
||||
$this->type_fees_code = $objp->type_fees_code;
|
||||
@ -1603,11 +1600,10 @@ class ExpenseReportLine
|
||||
|
||||
$sql = 'INSERT INTO '.MAIN_DB_PREFIX.'expensereport_det';
|
||||
$sql.= ' (fk_expensereport, fk_c_type_fees, fk_projet,';
|
||||
$sql.= ' fk_c_tva, tva_tx, comments, qty, value_unit, total_ht, total_tva, total_ttc, date)';
|
||||
$sql.= ' tva_tx, comments, qty, value_unit, total_ht, total_tva, total_ttc, date)';
|
||||
$sql.= " VALUES (".$this->fk_expensereport.",";
|
||||
$sql.= " ".$this->fk_c_type_fees.",";
|
||||
$sql.= " ".($this->fk_projet>0?$this->fk_projet:'null').",";
|
||||
$sql.= " ".($this->fk_c_tva?$this->fk_c_tva:"null").",";
|
||||
$sql.= " ".$this->vatrate.",";
|
||||
$sql.= " '".$this->db->escape($this->comments)."',";
|
||||
$sql.= " ".$this->qty.",";
|
||||
@ -1682,8 +1678,6 @@ class ExpenseReportLine
|
||||
else $sql.= ",fk_c_type_fees=null";
|
||||
if ($this->fk_projet) $sql.= ",fk_projet=".$this->fk_projet;
|
||||
else $sql.= ",fk_projet=null";
|
||||
if ($this->fk_c_tva) $sql.= ",fk_c_tva=".$this->fk_c_tva;
|
||||
else $sql.= ",fk_c_tva=null";
|
||||
$sql.= " WHERE rowid = ".$this->rowid;
|
||||
|
||||
dol_syslog("ExpenseReportLine::update sql=".$sql);
|
||||
|
||||
@ -260,17 +260,16 @@ CREATE TABLE llx_expensereport_det
|
||||
fk_expensereport integer NOT NULL,
|
||||
fk_c_type_fees integer NOT NULL,
|
||||
fk_projet integer,
|
||||
fk_c_tva integer,
|
||||
comments text NOT NULL,
|
||||
product_type integer DEFAULT -1,
|
||||
qty real NOT NULL,
|
||||
value_unit real NOT NULL,
|
||||
remise_percent real,
|
||||
tva_tx double(6,3), -- Vat rat
|
||||
localtax1_tx double(6,3) DEFAULT 0, -- localtax1 rate
|
||||
localtax1_type varchar(10) NULL, -- localtax1 type
|
||||
localtax2_tx double(6,3) DEFAULT 0, -- localtax2 rate
|
||||
localtax2_type varchar(10) NULL, -- localtax2 type
|
||||
tva_tx double(6,3), -- Vat rat
|
||||
localtax1_tx double(6,3) DEFAULT 0, -- localtax1 rate
|
||||
localtax1_type varchar(10) NULL, -- localtax1 type
|
||||
localtax2_tx double(6,3) DEFAULT 0, -- localtax2 rate
|
||||
localtax2_type varchar(10) NULL, -- localtax2 type
|
||||
total_ht double(24,8) DEFAULT 0 NOT NULL,
|
||||
total_tva double(24,8) DEFAULT 0 NOT NULL,
|
||||
total_localtax1 double(24,8) DEFAULT 0, -- Total LocalTax1 for total quantity of line
|
||||
|
||||
@ -22,17 +22,16 @@ CREATE TABLE llx_expensereport_det
|
||||
fk_expensereport integer NOT NULL,
|
||||
fk_c_type_fees integer NOT NULL,
|
||||
fk_projet integer,
|
||||
fk_c_tva integer NOT NULL,
|
||||
comments text NOT NULL,
|
||||
product_type integer DEFAULT -1,
|
||||
qty real NOT NULL,
|
||||
value_unit real NOT NULL,
|
||||
remise_percent real,
|
||||
tva_tx double(6,3), -- Vat rate
|
||||
localtax1_tx double(6,3) DEFAULT 0, -- localtax1 rate
|
||||
localtax1_type varchar(10) NULL, -- localtax1 type
|
||||
localtax2_tx double(6,3) DEFAULT 0, -- localtax2 rate
|
||||
localtax2_type varchar(10) NULL, -- localtax2 type
|
||||
tva_tx double(6,3), -- Vat rate
|
||||
localtax1_tx double(6,3) DEFAULT 0, -- localtax1 rate
|
||||
localtax1_type varchar(10) NULL, -- localtax1 type
|
||||
localtax2_tx double(6,3) DEFAULT 0, -- localtax2 rate
|
||||
localtax2_type varchar(10) NULL, -- localtax2 type
|
||||
total_ht double(24,8) DEFAULT 0 NOT NULL,
|
||||
total_tva double(24,8) DEFAULT 0 NOT NULL,
|
||||
total_localtax1 double(24,8) DEFAULT 0, -- Total LocalTax1 for total quantity of line
|
||||
|
||||
Loading…
Reference in New Issue
Block a user