Fix beluga pdf for projects. Add missing expense reports.

This commit is contained in:
Laurent Destailleur 2015-11-07 12:36:34 +01:00
parent 99f5211070
commit 350ef610e9
5 changed files with 56 additions and 23 deletions

View File

@ -94,8 +94,8 @@ class pdf_beluga extends ModelePDFProjects
$this->posxref=$this->marge_gauche+1;
$this->posxdate=$this->marge_gauche+25;
$this->posxsociety=$this->marge_gauche+45;
$this->posxamountht=$this->marge_gauche+115;
$this->posxamountttc=$this->marge_gauche+140;
$this->posxamountht=$this->marge_gauche+110;
$this->posxamountttc=$this->marge_gauche+135;
$this->posxstatut=$this->marge_gauche+165;
}
@ -231,14 +231,16 @@ class pdf_beluga extends ModelePDFProjects
'class'=>'Propal',
'table'=>'propal',
'datefieldname'=>'datep',
'test'=>$conf->propal->enabled && $user->rights->propale->lire),
'test'=>$conf->propal->enabled && $user->rights->propale->lire,
'lang'=>'propal'),
'order'=>array(
'name'=>"CustomersOrders",
'title'=>"ListOrdersAssociatedProject",
'class'=>'Commande',
'table'=>'commande',
'datefieldname'=>'date_commande',
'test'=>$conf->commande->enabled && $user->rights->commande->lire),
'test'=>$conf->commande->enabled && $user->rights->commande->lire,
'lang'=>'order'),
'invoice'=>array(
'name'=>"CustomersInvoices",
'title'=>"ListInvoicesAssociatedProject",
@ -246,21 +248,24 @@ class pdf_beluga extends ModelePDFProjects
'margin'=>'add',
'table'=>'facture',
'datefieldname'=>'datef',
'test'=>$conf->facture->enabled && $user->rights->facture->lire),
'test'=>$conf->facture->enabled && $user->rights->facture->lire,
'lang'=>'bills'),
'invoice_predefined'=>array(
'name'=>"PredefinedInvoices",
'title'=>"ListPredefinedInvoicesAssociatedProject",
'class'=>'FactureRec',
'table'=>'facture_rec',
'datefieldname'=>'datec',
'test'=>$conf->facture->enabled && $user->rights->facture->lire),
'test'=>$conf->facture->enabled && $user->rights->facture->lire,
'lang'=>'bills'),
'order_supplier'=>array(
'name'=>"SuppliersOrders",
'title'=>"ListSupplierOrdersAssociatedProject",
'class'=>'CommandeFournisseur',
'table'=>'commande_fournisseur',
'datefieldname'=>'date_commande',
'test'=>$conf->fournisseur->enabled && $user->rights->fournisseur->commande->lire),
'test'=>$conf->fournisseur->enabled && $user->rights->fournisseur->commande->lire,
'lang'=>'orders'),
'invoice_supplier'=>array(
'name'=>"BillsSuppliers",
'title'=>"ListSupplierInvoicesAssociatedProject",
@ -268,14 +273,16 @@ class pdf_beluga extends ModelePDFProjects
'margin'=>'minus',
'table'=>'facture_fourn',
'datefieldname'=>'datef',
'test'=>$conf->fournisseur->enabled && $user->rights->fournisseur->facture->lire),
'test'=>$conf->fournisseur->enabled && $user->rights->fournisseur->facture->lire,
'lang'=>'bills'),
'contract'=>array(
'name'=>"Contracts",
'title'=>"ListContractAssociatedProject",
'class'=>'Contrat',
'table'=>'contrat',
'datefieldname'=>'date_contrat',
'test'=>$conf->contrat->enabled && $user->rights->contrat->lire),
'test'=>$conf->contrat->enabled && $user->rights->contrat->lire,
'lang'=>'contract'),
'intervention'=>array(
'name'=>"Interventions",
'title'=>"ListFichinterAssociatedProject",
@ -283,7 +290,8 @@ class pdf_beluga extends ModelePDFProjects
'table'=>'fichinter',
'datefieldname'=>'date_valid',
'disableamount'=>1,
'test'=>$conf->ficheinter->enabled && $user->rights->ficheinter->lire),
'test'=>$conf->ficheinter->enabled && $user->rights->ficheinter->lire,
'lang'=>'interventions'),
'trip'=>array(
'name'=>"TripsAndExpenses",
'title'=>"ListTripAssociatedProject",
@ -292,7 +300,18 @@ class pdf_beluga extends ModelePDFProjects
'datefieldname'=>'dated',
'margin'=>'minus',
'disableamount'=>1,
'test'=>$conf->deplacement->enabled && $user->rights->deplacement->lire),
'test'=>$conf->deplacement->enabled && $user->rights->deplacement->lire,
'lang'=>'trip'),
'expensereport'=>array(
'name'=>"ExpensesReports",
'title'=>"ListTripAssociatedProject",
'class'=>'ExpenseReport',
'table'=>'expensereport',
'datefieldname'=>'dated',
'margin'=>'minus',
'disableamount'=>1,
'test'=>$conf->expensereport->enabled && $user->rights->expensereport->lire,
'lang'=>'trip'),
'agenda'=>array(
'name'=>"Agenda",
'title'=>"ListActionsAssociatedProject",
@ -300,7 +319,8 @@ class pdf_beluga extends ModelePDFProjects
'table'=>'actioncomm',
'datefieldname'=>'datep',
'disableamount'=>1,
'test'=>$conf->agenda->enabled && $user->rights->agenda->allactions->lire)
'test'=>$conf->agenda->enabled && $user->rights->agenda->allactions->read,
'lang'=>'agenda')
);
@ -311,12 +331,17 @@ class pdf_beluga extends ModelePDFProjects
$tablename=$value['table'];
$datefieldname=$value['datefieldname'];
$qualified=$value['test'];
$langstoload=$value['lang'];
$langs->load($langstoload);
if ($qualified)
{
//var_dump("$key, $tablename, $datefieldname, $dates, $datee");
$elementarray = $object->get_element_list($key, $tablename, $datefieldname, $dates, $datee);
//var_dump($elementarray);
$num = count($elementarray);
if ($num > 0)
if ($num >= 0)
{
$nexY = $pdf->GetY() + 5;
$curY = $nexY;
@ -334,9 +359,9 @@ class pdf_beluga extends ModelePDFProjects
$pdf->MultiCell($this->posxamountht - $this->posxsociety, 3, $outputlangs->transnoentities("ThirdParty"), 1, 'L');
if (empty($value['disableamount'])) {
$pdf->SetXY($this->posxamountht, $curY);
$pdf->MultiCell($this->posxamountttc - $this->posxamountht, 3, $outputlangs->transnoentities("AmountHT"), 1, 'R');
$pdf->MultiCell($this->posxamountttc - $this->posxamountht, 3, $outputlangs->transnoentities("AmountHTShort"), 1, 'R');
$pdf->SetXY($this->posxamountttc, $curY);
$pdf->MultiCell($this->posxstatut - $this->posxamountttc, 3, $outputlangs->transnoentities("AmountTTC"), 1, 'R');
$pdf->MultiCell($this->posxstatut - $this->posxamountttc, 3, $outputlangs->transnoentities("AmountTTCShort"), 1, 'R');
} else {
$pdf->SetXY($this->posxamountht, $curY);
$pdf->MultiCell($this->posxstatut - $this->posxamountht, 3, "", 1, 'R');
@ -434,8 +459,6 @@ class pdf_beluga extends ModelePDFProjects
}
}
/*
* Pied de page
*/

View File

@ -176,6 +176,7 @@ ProjectOpenedProjectByOppStatus=Opened project/lead by opportunity status
ProjectsStatistics=Statistics on projects/leads
TaskAssignedToEnterTime=Task assigned. Entering time on this task should be possible.
IdTaskTime=Id task time
YouCanCompleteRef=If you want to complete the ref with some information (to use it as search filters), it is recommanded to add a - character to separate it, so the automatic numbering will still work correctly for next projects. For example %s-ABC. You may also prefer to add search keys into label.
OpenedProjectsByThirdparties=Opened projects by thirdparties
OpportunityTotalAmount=Opportunities total amount
OpportunityPonderatedAmount=Opportunities weighted amount

View File

@ -104,7 +104,7 @@ else if ($action == 'specimen')
$project = new Project($db);
$project->initAsSpecimen();
// Search template files
$file=''; $classname=''; $filefound=0;
$dirmodels=array_merge(array('/'),(array) $conf->modules_parts['models']);

View File

@ -450,10 +450,13 @@ if ($action == 'create' && $user->rights->projet->creer)
if (is_numeric($defaultref) && $defaultref <= 0) $defaultref='';
// Ref
print '<tr><td><span class="fieldrequired">'.$langs->trans("Ref").'</span></td><td><input size="12" type="text" name="ref" value="'.($_POST["ref"]?$_POST["ref"]:$defaultref).'"></td></tr>';
$suggestedref=($_POST["ref"]?$_POST["ref"]:$defaultref);
print '<tr><td><span class="fieldrequired">'.$langs->trans("Ref").'</span></td><td><input size="12" type="text" name="ref" value="'.$suggestedref.'">';
print ' '.$form->textwithpicto('', $langs->trans("YouCanCompleteRef", $suggestedref));
print '</td></tr>';
// Label
print '<tr><td><span class="fieldrequired">'.$langs->trans("Label").'</span></td><td><input size="40" type="text" name="title" value="'.GETPOST("title").'"></td></tr>';
print '<tr><td><span class="fieldrequired">'.$langs->trans("Label").'</span></td><td><input size="80" type="text" name="title" value="'.GETPOST("title").'"></td></tr>';
// Thirdparty
print '<tr><td>'.$langs->trans("ThirdParty").'</td><td>';
@ -617,12 +620,15 @@ else
print '<table class="border" width="100%">';
// Ref
$suggestedref=$object->ref;
print '<tr><td class="fieldrequired" width="30%">'.$langs->trans("Ref").'</td>';
print '<td><input size="12" name="ref" value="'.$object->ref.'"></td></tr>';
print '<td><input size="12" name="ref" value="'.$suggestedref.'">';
print ' '.$form->textwithpicto('', $langs->trans("YouCanCompleteRef", $suggestedref));
print '</td></tr>';
// Label
print '<tr><td class="fieldrequired">'.$langs->trans("Label").'</td>';
print '<td><input size="40" name="title" value="'.$object->title.'"></td></tr>';
print '<td><input size="80" name="title" value="'.$object->title.'"></td></tr>';
// Thirdparty
print '<tr><td>'.$langs->trans("ThirdParty").'</td><td>';

View File

@ -453,7 +453,9 @@ class Project extends CommonObject
function get_element_list($type, $tablename, $datefieldname='', $dates='', $datee='')
{
$elements = array();
if ($this->id <= 0) return $elements;
if ($type == 'agenda')
{
$sql = "SELECT id as rowid FROM " . MAIN_DB_PREFIX . "actioncomm WHERE fk_project=" . $this->id;
@ -929,6 +931,7 @@ class Project extends CommonObject
$this->date_c = $now;
$this->date_m = $now;
$this->date_start = $now;
$this->date_end = $now + (3600 * 24 * 365);
$this->note_public = 'SPECIMEN';
$this->fk_ele = 20000;
$this->opp_amount = 20000;