Merge remote-tracking branch 'Upstream/develop' into develop-38
This commit is contained in:
commit
390c670c5c
@ -3066,6 +3066,8 @@ class Facture extends CommonInvoice
|
|||||||
*/
|
*/
|
||||||
function demande_prelevement($user)
|
function demande_prelevement($user)
|
||||||
{
|
{
|
||||||
|
global $langs;
|
||||||
|
|
||||||
$error=0;
|
$error=0;
|
||||||
|
|
||||||
dol_syslog(get_class($this)."::demande_prelevement", LOG_DEBUG);
|
dol_syslog(get_class($this)."::demande_prelevement", LOG_DEBUG);
|
||||||
@ -3080,7 +3082,7 @@ class Facture extends CommonInvoice
|
|||||||
$sql.= ' FROM '.MAIN_DB_PREFIX.'prelevement_facture_demande';
|
$sql.= ' FROM '.MAIN_DB_PREFIX.'prelevement_facture_demande';
|
||||||
$sql.= ' WHERE fk_facture = '.$this->id;
|
$sql.= ' WHERE fk_facture = '.$this->id;
|
||||||
$sql.= ' AND traite = 0';
|
$sql.= ' AND traite = 0';
|
||||||
|
|
||||||
dol_syslog(get_class($this)."::demande_prelevement", LOG_DEBUG);
|
dol_syslog(get_class($this)."::demande_prelevement", LOG_DEBUG);
|
||||||
$resql=$this->db->query($sql);
|
$resql=$this->db->query($sql);
|
||||||
if ($resql)
|
if ($resql)
|
||||||
@ -3099,27 +3101,36 @@ class Facture extends CommonInvoice
|
|||||||
// For example print 239.2 - 229.3 - 9.9; does not return 0.
|
// For example print 239.2 - 229.3 - 9.9; does not return 0.
|
||||||
//$resteapayer=bcadd($this->total_ttc,$totalpaye,$conf->global->MAIN_MAX_DECIMALS_TOT);
|
//$resteapayer=bcadd($this->total_ttc,$totalpaye,$conf->global->MAIN_MAX_DECIMALS_TOT);
|
||||||
//$resteapayer=bcadd($resteapayer,$totalavoir,$conf->global->MAIN_MAX_DECIMALS_TOT);
|
//$resteapayer=bcadd($resteapayer,$totalavoir,$conf->global->MAIN_MAX_DECIMALS_TOT);
|
||||||
$resteapayer = price2num($this->total_ttc - $totalpaye - $totalcreditnotes - $totaldeposits,'MT');
|
|
||||||
|
//$resteapayer = price2num($this->total_ttc - $totalpaye - $totalcreditnotes - $totaldeposits,'MT');
|
||||||
|
|
||||||
$sql = 'INSERT INTO '.MAIN_DB_PREFIX.'prelevement_facture_demande';
|
$amount = GETPOST('withdraw_request_amount');
|
||||||
$sql .= ' (fk_facture, amount, date_demande, fk_user_demande, code_banque, code_guichet, number, cle_rib)';
|
|
||||||
$sql .= ' VALUES ('.$this->id;
|
if (is_numeric($amount) && $amount != 0) {
|
||||||
$sql .= ",'".price2num($resteapayer)."'";
|
$sql = 'INSERT INTO '.MAIN_DB_PREFIX.'prelevement_facture_demande';
|
||||||
$sql .= ",'".$this->db->idate($now)."'";
|
$sql .= ' (fk_facture, amount, date_demande, fk_user_demande, code_banque, code_guichet, number, cle_rib)';
|
||||||
$sql .= ",".$user->id;
|
$sql .= ' VALUES ('.$this->id;
|
||||||
$sql .= ",'".$bac->code_banque."'";
|
$sql .= ",'".price2num($amount)."'";
|
||||||
$sql .= ",'".$bac->code_guichet."'";
|
$sql .= ",'".$this->db->idate($now)."'";
|
||||||
$sql .= ",'".$bac->number."'";
|
$sql .= ",".$user->id;
|
||||||
$sql .= ",'".$bac->cle_rib."')";
|
$sql .= ",'".$bac->code_banque."'";
|
||||||
|
$sql .= ",'".$bac->code_guichet."'";
|
||||||
dol_syslog(get_class($this)."::demande_prelevement", LOG_DEBUG);
|
$sql .= ",'".$bac->number."'";
|
||||||
$resql=$this->db->query($sql);
|
$sql .= ",'".$bac->cle_rib."')";
|
||||||
if (! $resql)
|
|
||||||
{
|
dol_syslog(get_class($this)."::demande_prelevement", LOG_DEBUG);
|
||||||
$this->error=$this->db->lasterror();
|
$resql=$this->db->query($sql);
|
||||||
dol_syslog(get_class($this).'::demandeprelevement Erreur');
|
if (! $resql)
|
||||||
$error++;
|
{
|
||||||
}
|
$this->error=$this->db->lasterror();
|
||||||
|
dol_syslog(get_class($this).'::demandeprelevement Erreur');
|
||||||
|
$error++;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$this->error=$langs->trans('WithdrawRequestErrorNilAmount');
|
||||||
|
dol_syslog(get_class($this).'::demandeprelevement ' . $langs->trans('WithdrawRequestErrorNilAmount'));
|
||||||
|
$error++;
|
||||||
|
}
|
||||||
|
|
||||||
if (! $error)
|
if (! $error)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -478,7 +478,13 @@ if ($object->id > 0)
|
|||||||
{
|
{
|
||||||
if ($user->rights->prelevement->bons->creer)
|
if ($user->rights->prelevement->bons->creer)
|
||||||
{
|
{
|
||||||
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&action=new">'.$langs->trans("MakeWithdrawRequest").'</a>';
|
print '<form method="POST" action="">';
|
||||||
|
print '<input type="hidden" name="id" value="' . $object->id . '" />';
|
||||||
|
print '<input type="hidden" name="action" value="new" />';
|
||||||
|
print '<label for="withdraw_request_amount">' . $langs->trans('WithdrawRequestAmount') . ' </label>';
|
||||||
|
print '<input type="text" id="withdraw_request_amount" name="withdraw_request_amount" value="' . $resteapayer . '" size="10" />';
|
||||||
|
print '<input type="submit" class="butAction" value="'.$langs->trans("MakeWithdrawRequest").'" />';
|
||||||
|
print '</form>';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@ -446,8 +446,17 @@ class BonPrelevement extends CommonObject
|
|||||||
$fac = new Facture($this->db);
|
$fac = new Facture($this->db);
|
||||||
$fac->fetch($facs[$i][0]);
|
$fac->fetch($facs[$i][0]);
|
||||||
$amounts[$fac->id] = $facs[$i][1];
|
$amounts[$fac->id] = $facs[$i][1];
|
||||||
$result = $fac->set_paid($user);
|
|
||||||
|
$totalpaye = $fac->getSommePaiement();
|
||||||
|
$totalcreditnotes = $fac->getSumCreditNotesUsed();
|
||||||
|
$totaldeposits = $fac->getSumDepositsUsed();
|
||||||
|
$alreadypayed = $totalpaye + $totalcreditnotes + $totaldeposits;
|
||||||
|
|
||||||
|
if ($alreadypayed + $facs[$i][1] >= $fac->total_ttc) {
|
||||||
|
$result = $fac->set_paid($user);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$paiement = new Paiement($this->db);
|
$paiement = new Paiement($this->db);
|
||||||
$paiement->datepaye = $date ;
|
$paiement->datepaye = $date ;
|
||||||
$paiement->amounts = $amounts;
|
$paiement->amounts = $amounts;
|
||||||
@ -651,7 +660,7 @@ class BonPrelevement extends CommonObject
|
|||||||
{
|
{
|
||||||
global $conf;
|
global $conf;
|
||||||
|
|
||||||
$sql = "SELECT sum(f.total_ttc) as nb";
|
$sql = "SELECT sum(pfd.amount) as nb";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."facture as f,";
|
$sql.= " FROM ".MAIN_DB_PREFIX."facture as f,";
|
||||||
$sql.= " ".MAIN_DB_PREFIX."prelevement_facture_demande as pfd";
|
$sql.= " ".MAIN_DB_PREFIX."prelevement_facture_demande as pfd";
|
||||||
//$sql.= " ,".MAIN_DB_PREFIX."c_paiement as cp";
|
//$sql.= " ,".MAIN_DB_PREFIX."c_paiement as cp";
|
||||||
@ -759,7 +768,7 @@ class BonPrelevement extends CommonObject
|
|||||||
$factures_result = array();
|
$factures_result = array();
|
||||||
$factures_prev_id=array();
|
$factures_prev_id=array();
|
||||||
$factures_errors=array();
|
$factures_errors=array();
|
||||||
|
|
||||||
if (! $error)
|
if (! $error)
|
||||||
{
|
{
|
||||||
$sql = "SELECT f.rowid, pfd.rowid as pfdrowid, f.fk_soc";
|
$sql = "SELECT f.rowid, pfd.rowid as pfdrowid, f.fk_soc";
|
||||||
@ -813,7 +822,7 @@ class BonPrelevement extends CommonObject
|
|||||||
// Check RIB
|
// Check RIB
|
||||||
$i = 0;
|
$i = 0;
|
||||||
dol_syslog(__METHOD__."::Check RIB", LOG_DEBUG);
|
dol_syslog(__METHOD__."::Check RIB", LOG_DEBUG);
|
||||||
|
|
||||||
if (count($factures) > 0)
|
if (count($factures) > 0)
|
||||||
{
|
{
|
||||||
foreach ($factures as $key => $fac)
|
foreach ($factures as $key => $fac)
|
||||||
@ -825,7 +834,7 @@ class BonPrelevement extends CommonObject
|
|||||||
{
|
{
|
||||||
$bac = new CompanyBankAccount($this->db);
|
$bac = new CompanyBankAccount($this->db);
|
||||||
$bac->fetch(0,$soc->id);
|
$bac->fetch(0,$soc->id);
|
||||||
|
|
||||||
if ($bac->verif() >= 1)
|
if ($bac->verif() >= 1)
|
||||||
//if (true)
|
//if (true)
|
||||||
{
|
{
|
||||||
@ -924,7 +933,8 @@ class BonPrelevement extends CommonObject
|
|||||||
if ($resql)
|
if ($resql)
|
||||||
{
|
{
|
||||||
$prev_id = $this->db->last_insert_id(MAIN_DB_PREFIX."prelevement_bons");
|
$prev_id = $this->db->last_insert_id(MAIN_DB_PREFIX."prelevement_bons");
|
||||||
|
$this->id = $prev_id;
|
||||||
|
|
||||||
$dir=$conf->prelevement->dir_output.'/receipts';
|
$dir=$conf->prelevement->dir_output.'/receipts';
|
||||||
$file=$filebonprev;
|
$file=$filebonprev;
|
||||||
if (! is_dir($dir)) dol_mkdir($dir);
|
if (! is_dir($dir)) dol_mkdir($dir);
|
||||||
@ -981,6 +991,7 @@ class BonPrelevement extends CommonObject
|
|||||||
|
|
||||||
dol_syslog(__METHOD__."::Update Orders::Sql=".$sql, LOG_DEBUG);
|
dol_syslog(__METHOD__."::Update Orders::Sql=".$sql, LOG_DEBUG);
|
||||||
$resql=$this->db->query($sql);
|
$resql=$this->db->query($sql);
|
||||||
|
|
||||||
if (! $resql)
|
if (! $resql)
|
||||||
{
|
{
|
||||||
$error++;
|
$error++;
|
||||||
|
|||||||
@ -161,7 +161,7 @@ print '<br>';
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
$sql = "SELECT f.facnumber, f.rowid, f.total_ttc, s.nom as name, s.rowid as socid,";
|
$sql = "SELECT f.facnumber, f.rowid, f.total_ttc, s.nom as name, s.rowid as socid,";
|
||||||
$sql.= " pfd.date_demande";
|
$sql.= " pfd.date_demande, pfd.amount";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."facture as f,";
|
$sql.= " FROM ".MAIN_DB_PREFIX."facture as f,";
|
||||||
$sql.= " ".MAIN_DB_PREFIX."societe as s,";
|
$sql.= " ".MAIN_DB_PREFIX."societe as s,";
|
||||||
$sql.= " ".MAIN_DB_PREFIX."prelevement_facture_demande as pfd";
|
$sql.= " ".MAIN_DB_PREFIX."prelevement_facture_demande as pfd";
|
||||||
@ -212,7 +212,7 @@ if ($resql)
|
|||||||
print '</td>';
|
print '</td>';
|
||||||
// Amount
|
// Amount
|
||||||
print '<td align="right">';
|
print '<td align="right">';
|
||||||
print price($obj->total_ttc,0,$langs,0,0,-1,$conf->currency);
|
print price($obj->amount,0,$langs,0,0,-1,$conf->currency);
|
||||||
print '</td>';
|
print '</td>';
|
||||||
// Date
|
// Date
|
||||||
print '<td align="right">';
|
print '<td align="right">';
|
||||||
|
|||||||
@ -96,7 +96,7 @@ print '</td></tr></table><br>';
|
|||||||
* Invoices waiting for withdraw
|
* Invoices waiting for withdraw
|
||||||
*/
|
*/
|
||||||
$sql = "SELECT f.facnumber, f.rowid, f.total_ttc, f.fk_statut, f.paye, f.type,";
|
$sql = "SELECT f.facnumber, f.rowid, f.total_ttc, f.fk_statut, f.paye, f.type,";
|
||||||
$sql.= " pfd.date_demande,";
|
$sql.= " pfd.date_demande, pfd.amount,";
|
||||||
$sql.= " s.nom as name, s.rowid as socid";
|
$sql.= " s.nom as name, s.rowid as socid";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."facture as f,";
|
$sql.= " FROM ".MAIN_DB_PREFIX."facture as f,";
|
||||||
$sql.= " ".MAIN_DB_PREFIX."societe as s";
|
$sql.= " ".MAIN_DB_PREFIX."societe as s";
|
||||||
@ -143,7 +143,7 @@ if ($resql)
|
|||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
print '<td align="right">';
|
print '<td align="right">';
|
||||||
print price($obj->total_ttc);
|
print price($obj->amount);
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
print '<td align="right">';
|
print '<td align="right">';
|
||||||
|
|||||||
@ -341,10 +341,13 @@ class pdf_standard extends ModeleExpenseReport
|
|||||||
$pdf->MultiCell($this->posxtva-$this->posxprojet-1, 3,$object->lines[$i]->projet_ref, 0, 'C');
|
$pdf->MultiCell($this->posxtva-$this->posxprojet-1, 3,$object->lines[$i]->projet_ref, 0, 'C');
|
||||||
|
|
||||||
// VAT Rate
|
// VAT Rate
|
||||||
$vat_rate = pdf_getlinevatrate($object, $i, $outputlangs, $hidedetails);
|
if (empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT))
|
||||||
$pdf->SetFont('','', $default_font_size - 1);
|
{
|
||||||
$pdf->SetXY($this->posxtva, $curY);
|
$vat_rate = pdf_getlinevatrate($object, $i, $outputlangs, $hidedetails);
|
||||||
$pdf->MultiCell($this->posxup-$this->posxtva-1, 3,$vat_rate, 0, 'R');
|
$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
|
// Unit price
|
||||||
$pdf->SetFont('','', $default_font_size - 1);
|
$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->MultiCell($this->page_largeur - $this->marge_gauche - 160, 5, price($object->total_ht), 1, 'R');
|
||||||
$pdf->SetFillColor(248,248,248);
|
$pdf->SetFillColor(248,248,248);
|
||||||
|
|
||||||
$posy+=5;
|
if (empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT))
|
||||||
$pdf->SetXY(100, $posy);
|
{
|
||||||
$pdf->SetTextColor(0,0,60);
|
$posy+=5;
|
||||||
$pdf->MultiCell(60, 5, $outputlangs->transnoentities("TotalVAT"), 1,'L');
|
$pdf->SetXY(100, $posy);
|
||||||
$pdf->SetXY(160, $posy);
|
$pdf->SetTextColor(0,0,60);
|
||||||
$pdf->MultiCell($this->page_largeur - $this->marge_gauche - 160, 5, price($object->total_tva),1, 'R');
|
$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;
|
$posy+=5;
|
||||||
$pdf->SetXY(100, $posy);
|
$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');
|
$pdf->MultiCell($this->posxtva-$this->posxprojet-1,2, $outputlangs->transnoentities("Project"),'','C');
|
||||||
|
|
||||||
// VAT
|
// VAT
|
||||||
$pdf->line($this->posxtva-1, $tab_top, $this->posxtva-1, $tab_top + $tab_height);
|
if (empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT))
|
||||||
$pdf->SetXY($this->posxtva-1, $tab_top+1);
|
{
|
||||||
$pdf->MultiCell($this->posxup-$this->posxtva-1,2, $outputlangs->transnoentities("VAT"),'','C');
|
$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
|
// Unit price
|
||||||
$pdf->line($this->posxup-1, $tab_top, $this->posxup-1, $tab_top + $tab_height);
|
$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_label[$r]='ListTripsAndExpenses';
|
||||||
$this->export_icon[$r]='trip';
|
$this->export_icon[$r]='trip';
|
||||||
$this->export_permission[$r]=array(array("expensereport","export"));
|
$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_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.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_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_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
|
$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_type_fees = GETPOST('fk_c_type_fees');
|
||||||
|
|
||||||
$object_ligne->fk_c_tva = GETPOST('fk_c_tva');
|
|
||||||
$object_ligne->vatrate = price2num(GETPOST('vatrate'));
|
$object_ligne->vatrate = price2num(GETPOST('vatrate'));
|
||||||
|
|
||||||
$object_ligne->fk_projet = $fk_projet;
|
$object_ligne->fk_projet = $fk_projet;
|
||||||
@ -980,7 +979,6 @@ if ($action == "updateligne" )
|
|||||||
|
|
||||||
$rowid = $_POST['rowid'];
|
$rowid = $_POST['rowid'];
|
||||||
$type_fees_id = GETPOST('fk_c_type_fees');
|
$type_fees_id = GETPOST('fk_c_type_fees');
|
||||||
$object_ligne->fk_c_tva = GETPOST('fk_c_tva');
|
|
||||||
$object_ligne->vatrate = price2num(GETPOST('vatrate'));
|
$object_ligne->vatrate = price2num(GETPOST('vatrate'));
|
||||||
$projet_id = $fk_projet;
|
$projet_id = $fk_projet;
|
||||||
$comments = GETPOST('comments');
|
$comments = GETPOST('comments');
|
||||||
@ -1622,7 +1620,7 @@ else
|
|||||||
|
|
||||||
// Fetch Lines of current expense report
|
// Fetch Lines of current expense report
|
||||||
$sql = 'SELECT fde.rowid, fde.fk_expensereport, fde.fk_c_type_fees, fde.fk_projet, fde.date,';
|
$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.= ' 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.= ' pjt.rowid as projet_id, pjt.title as projet_title, pjt.ref as projet_ref';
|
||||||
$sql.= ' FROM '.MAIN_DB_PREFIX.'expensereport_det as fde';
|
$sql.= ' FROM '.MAIN_DB_PREFIX.'expensereport_det as fde';
|
||||||
|
|||||||
@ -744,7 +744,7 @@ class ExpenseReport extends CommonObject
|
|||||||
$this->lines=array();
|
$this->lines=array();
|
||||||
|
|
||||||
$sql = ' SELECT de.rowid, de.comments, de.qty, de.value_unit, de.date,';
|
$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.= ' de.total_ht, de.total_tva, de.total_ttc,';
|
||||||
$sql.= ' ctf.code as code_type_fees, ctf.label as libelle_type_fees,';
|
$sql.= ' ctf.code as code_type_fees, ctf.label as libelle_type_fees,';
|
||||||
$sql.= ' p.ref as ref_projet, p.title as title_projet';
|
$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_expensereport = $objp->fk_expensereport;
|
||||||
$deplig->fk_c_type_fees = $objp->fk_c_type_fees;
|
$deplig->fk_c_type_fees = $objp->fk_c_type_fees;
|
||||||
$deplig->fk_projet = $objp->fk_projet;
|
$deplig->fk_projet = $objp->fk_projet;
|
||||||
$deplig->fk_c_tva = $objp->fk_c_tva;
|
|
||||||
|
|
||||||
$deplig->total_ht = $objp->total_ht;
|
$deplig->total_ht = $objp->total_ht;
|
||||||
$deplig->total_tva = $objp->total_tva;
|
$deplig->total_tva = $objp->total_tva;
|
||||||
@ -1506,7 +1505,6 @@ class ExpenseReportLine
|
|||||||
var $value_unit;
|
var $value_unit;
|
||||||
var $date;
|
var $date;
|
||||||
|
|
||||||
var $fk_c_tva;
|
|
||||||
var $fk_c_type_fees;
|
var $fk_c_type_fees;
|
||||||
var $fk_projet;
|
var $fk_projet;
|
||||||
var $fk_expensereport;
|
var $fk_expensereport;
|
||||||
@ -1541,7 +1539,7 @@ class ExpenseReportLine
|
|||||||
function fetch($rowid)
|
function fetch($rowid)
|
||||||
{
|
{
|
||||||
$sql = 'SELECT fde.rowid, fde.fk_expensereport, fde.fk_c_type_fees, fde.fk_projet, fde.date,';
|
$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.= ' 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.= ' pjt.rowid as projet_id, pjt.title as projet_title, pjt.ref as projet_ref';
|
||||||
$sql.= ' FROM '.MAIN_DB_PREFIX.'expensereport_det as fde';
|
$sql.= ' FROM '.MAIN_DB_PREFIX.'expensereport_det as fde';
|
||||||
@ -1561,7 +1559,6 @@ class ExpenseReportLine
|
|||||||
$this->qty = $objp->qty;
|
$this->qty = $objp->qty;
|
||||||
$this->date = $objp->date;
|
$this->date = $objp->date;
|
||||||
$this->value_unit = $objp->value_unit;
|
$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_c_type_fees = $objp->fk_c_type_fees;
|
||||||
$this->fk_projet = $objp->fk_projet;
|
$this->fk_projet = $objp->fk_projet;
|
||||||
$this->type_fees_code = $objp->type_fees_code;
|
$this->type_fees_code = $objp->type_fees_code;
|
||||||
@ -1603,11 +1600,10 @@ class ExpenseReportLine
|
|||||||
|
|
||||||
$sql = 'INSERT INTO '.MAIN_DB_PREFIX.'expensereport_det';
|
$sql = 'INSERT INTO '.MAIN_DB_PREFIX.'expensereport_det';
|
||||||
$sql.= ' (fk_expensereport, fk_c_type_fees, fk_projet,';
|
$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.= " VALUES (".$this->fk_expensereport.",";
|
||||||
$sql.= " ".$this->fk_c_type_fees.",";
|
$sql.= " ".$this->fk_c_type_fees.",";
|
||||||
$sql.= " ".($this->fk_projet>0?$this->fk_projet:'null').",";
|
$sql.= " ".($this->fk_projet>0?$this->fk_projet:'null').",";
|
||||||
$sql.= " ".($this->fk_c_tva?$this->fk_c_tva:"null").",";
|
|
||||||
$sql.= " ".$this->vatrate.",";
|
$sql.= " ".$this->vatrate.",";
|
||||||
$sql.= " '".$this->db->escape($this->comments)."',";
|
$sql.= " '".$this->db->escape($this->comments)."',";
|
||||||
$sql.= " ".$this->qty.",";
|
$sql.= " ".$this->qty.",";
|
||||||
@ -1682,8 +1678,6 @@ class ExpenseReportLine
|
|||||||
else $sql.= ",fk_c_type_fees=null";
|
else $sql.= ",fk_c_type_fees=null";
|
||||||
if ($this->fk_projet) $sql.= ",fk_projet=".$this->fk_projet;
|
if ($this->fk_projet) $sql.= ",fk_projet=".$this->fk_projet;
|
||||||
else $sql.= ",fk_projet=null";
|
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;
|
$sql.= " WHERE rowid = ".$this->rowid;
|
||||||
|
|
||||||
dol_syslog("ExpenseReportLine::update sql=".$sql);
|
dol_syslog("ExpenseReportLine::update sql=".$sql);
|
||||||
|
|||||||
@ -260,17 +260,16 @@ CREATE TABLE llx_expensereport_det
|
|||||||
fk_expensereport integer NOT NULL,
|
fk_expensereport integer NOT NULL,
|
||||||
fk_c_type_fees integer NOT NULL,
|
fk_c_type_fees integer NOT NULL,
|
||||||
fk_projet integer,
|
fk_projet integer,
|
||||||
fk_c_tva integer,
|
|
||||||
comments text NOT NULL,
|
comments text NOT NULL,
|
||||||
product_type integer DEFAULT -1,
|
product_type integer DEFAULT -1,
|
||||||
qty real NOT NULL,
|
qty real NOT NULL,
|
||||||
value_unit real NOT NULL,
|
value_unit real NOT NULL,
|
||||||
remise_percent real,
|
remise_percent real,
|
||||||
tva_tx double(6,3), -- Vat rat
|
tva_tx double(6,3), -- Vat rat
|
||||||
localtax1_tx double(6,3) DEFAULT 0, -- localtax1 rate
|
localtax1_tx double(6,3) DEFAULT 0, -- localtax1 rate
|
||||||
localtax1_type varchar(10) NULL, -- localtax1 type
|
localtax1_type varchar(10) NULL, -- localtax1 type
|
||||||
localtax2_tx double(6,3) DEFAULT 0, -- localtax2 rate
|
localtax2_tx double(6,3) DEFAULT 0, -- localtax2 rate
|
||||||
localtax2_type varchar(10) NULL, -- localtax2 type
|
localtax2_type varchar(10) NULL, -- localtax2 type
|
||||||
total_ht double(24,8) DEFAULT 0 NOT NULL,
|
total_ht double(24,8) DEFAULT 0 NOT NULL,
|
||||||
total_tva 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
|
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_expensereport integer NOT NULL,
|
||||||
fk_c_type_fees integer NOT NULL,
|
fk_c_type_fees integer NOT NULL,
|
||||||
fk_projet integer,
|
fk_projet integer,
|
||||||
fk_c_tva integer NOT NULL,
|
|
||||||
comments text NOT NULL,
|
comments text NOT NULL,
|
||||||
product_type integer DEFAULT -1,
|
product_type integer DEFAULT -1,
|
||||||
qty real NOT NULL,
|
qty real NOT NULL,
|
||||||
value_unit real NOT NULL,
|
value_unit real NOT NULL,
|
||||||
remise_percent real,
|
remise_percent real,
|
||||||
tva_tx double(6,3), -- Vat rate
|
tva_tx double(6,3), -- Vat rate
|
||||||
localtax1_tx double(6,3) DEFAULT 0, -- localtax1 rate
|
localtax1_tx double(6,3) DEFAULT 0, -- localtax1 rate
|
||||||
localtax1_type varchar(10) NULL, -- localtax1 type
|
localtax1_type varchar(10) NULL, -- localtax1 type
|
||||||
localtax2_tx double(6,3) DEFAULT 0, -- localtax2 rate
|
localtax2_tx double(6,3) DEFAULT 0, -- localtax2 rate
|
||||||
localtax2_type varchar(10) NULL, -- localtax2 type
|
localtax2_type varchar(10) NULL, -- localtax2 type
|
||||||
total_ht double(24,8) DEFAULT 0 NOT NULL,
|
total_ht double(24,8) DEFAULT 0 NOT NULL,
|
||||||
total_tva 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
|
total_localtax1 double(24,8) DEFAULT 0, -- Total LocalTax1 for total quantity of line
|
||||||
|
|||||||
@ -87,6 +87,8 @@ StatisticsByLineStatus=Statistics by status of lines
|
|||||||
RUM=RUM
|
RUM=RUM
|
||||||
RUMWillBeGenerated=RUM number will be generated once bank account information are saved
|
RUMWillBeGenerated=RUM number will be generated once bank account information are saved
|
||||||
WithdrawMode=Withdraw mode (FRST or RECUR)
|
WithdrawMode=Withdraw mode (FRST or RECUR)
|
||||||
|
WithdrawRequestAmount=Withdraw request amount:
|
||||||
|
WithdrawRequestErrorNilAmount=Unable to create withdraw request for nil amount.
|
||||||
|
|
||||||
### Notifications
|
### Notifications
|
||||||
InfoCreditSubject=Payment of standing order %s by the bank
|
InfoCreditSubject=Payment of standing order %s by the bank
|
||||||
|
|||||||
@ -84,6 +84,8 @@ WithdrawalFile=Fichier de prélèvement
|
|||||||
SetToStatusSent=Mettre au statut "Fichier envoyé"
|
SetToStatusSent=Mettre au statut "Fichier envoyé"
|
||||||
ThisWillAlsoAddPaymentOnInvoice=Ceci créera également les paiements sur les factures et les classera payées
|
ThisWillAlsoAddPaymentOnInvoice=Ceci créera également les paiements sur les factures et les classera payées
|
||||||
StatisticsByLineStatus=Statistiques par statut des lignes
|
StatisticsByLineStatus=Statistiques par statut des lignes
|
||||||
|
WithdrawRequestAmount=Montant de la demande de prélèvement :
|
||||||
|
WithdrawRequestErrorNilAmount=Impossible de créer une demande de prélèvement avec un montant nul.
|
||||||
|
|
||||||
### Notifications
|
### Notifications
|
||||||
InfoCreditSubject=Crédit prélèvement %s à la banque
|
InfoCreditSubject=Crédit prélèvement %s à la banque
|
||||||
|
|||||||
@ -979,12 +979,14 @@ else
|
|||||||
$doleditor->Create();
|
$doleditor->Create();
|
||||||
|
|
||||||
print "</td></tr>";
|
print "</td></tr>";
|
||||||
|
|
||||||
// Categories
|
if($conf->categorie->enabled) {
|
||||||
print '<tr><td valign="top">'.$langs->trans("Categories").'</td><td colspan="3">';
|
// Categories
|
||||||
$cate_arbo = $form->select_all_categories(Categorie::TYPE_PRODUCT, '', 'parent', 64, 0, 1);
|
print '<tr><td valign="top">'.$langs->trans("Categories").'</td><td colspan="3">';
|
||||||
print $form->multiselectarray('categories', $cate_arbo, $arrayselected, '', 0, '', 0, 250);
|
$cate_arbo = $form->select_all_categories(Categorie::TYPE_PRODUCT, '', 'parent', 64, 0, 1);
|
||||||
print "</td></tr>";
|
print $form->multiselectarray('categories', $cate_arbo, $arrayselected, '', 0, '', 0, 250);
|
||||||
|
print "</td></tr>";
|
||||||
|
}
|
||||||
|
|
||||||
// Units
|
// Units
|
||||||
if($conf->global->PRODUCT_USE_UNITS)
|
if($conf->global->PRODUCT_USE_UNITS)
|
||||||
@ -1270,18 +1272,20 @@ else
|
|||||||
$doleditor->Create();
|
$doleditor->Create();
|
||||||
|
|
||||||
print "</td></tr>";
|
print "</td></tr>";
|
||||||
|
|
||||||
// Categories
|
if($conf->categorie->enabled) {
|
||||||
print '<tr><td valign="top">'.$langs->trans("Categories").'</td><td colspan="3">';
|
// Categories
|
||||||
$cate_arbo = $form->select_all_categories(Categorie::TYPE_PRODUCT, '', 'parent', 64, 0, 1);
|
print '<tr><td valign="top">'.$langs->trans("Categories").'</td><td colspan="3">';
|
||||||
$c = new Categorie($db);
|
$cate_arbo = $form->select_all_categories(Categorie::TYPE_PRODUCT, '', 'parent', 64, 0, 1);
|
||||||
$cats = $c->containing($object->id,Categorie::TYPE_PRODUCT);
|
$c = new Categorie($db);
|
||||||
foreach($cats as $cat) {
|
$cats = $c->containing($object->id,Categorie::TYPE_PRODUCT);
|
||||||
$arrayselected[] = $cat->id;
|
foreach($cats as $cat) {
|
||||||
|
$arrayselected[] = $cat->id;
|
||||||
|
}
|
||||||
|
print $form->multiselectarray('categories', $cate_arbo, $arrayselected, '', 0, '', 0, '100%');
|
||||||
|
print "</td></tr>";
|
||||||
}
|
}
|
||||||
print $form->multiselectarray('categories', $cate_arbo, $arrayselected, '', 0, '', 0, '100%');
|
|
||||||
print "</td></tr>";
|
|
||||||
|
|
||||||
// Units
|
// Units
|
||||||
if($conf->global->PRODUCT_USE_UNITS)
|
if($conf->global->PRODUCT_USE_UNITS)
|
||||||
{
|
{
|
||||||
@ -1593,10 +1597,12 @@ else
|
|||||||
print '<!-- End show Note --> '."\n";
|
print '<!-- End show Note --> '."\n";
|
||||||
|
|
||||||
// Categories
|
// Categories
|
||||||
print '<tr><td valign="middle">'.$langs->trans("Categories").'</td><td colspan="3">';
|
if($conf->categorie->enabled) {
|
||||||
print $form->showCategories($object->id,'product',1);
|
print '<tr><td valign="middle">'.$langs->trans("Categories").'</td><td colspan="3">';
|
||||||
print "</td></tr>";
|
print $form->showCategories($object->id,'product',1);
|
||||||
|
print "</td></tr>";
|
||||||
|
}
|
||||||
|
|
||||||
print "</table>\n";
|
print "</table>\n";
|
||||||
|
|
||||||
dol_fiche_end();
|
dol_fiche_end();
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user