Fix: Missing list of details of lines

This commit is contained in:
Laurent Destailleur 2011-11-23 20:18:31 +01:00
parent e4cb045b53
commit 322135c09d

View File

@ -197,9 +197,9 @@ if ($_POST['action'] == 'update' && ! $_POST['cancel'])
*/
if ($_POST['action'] == 'add' && $user->rights->fournisseur->facture->creer)
{
$error=0;
$error=0;
$datefacture=dol_mktime(12,0,0,$_POST['remonth'],$_POST['reday'],$_POST['reyear']);
$datefacture=dol_mktime(12,0,0,$_POST['remonth'],$_POST['reday'],$_POST['reyear']);
$datedue=dol_mktime(12,0,0,$_POST['echmonth'],$_POST['echday'],$_POST['echyear']);
if ($datefacture == '')
@ -232,93 +232,93 @@ if ($_POST['action'] == 'add' && $user->rights->fournisseur->facture->creer)
$facfou->note_public = $_POST['note'];
// If creation from another object of another module
if ($_POST['origin'] && $_POST['originid'])
{
// Parse element/subelement (ex: project_task)
$element = $subelement = $_POST['origin'];
/*if (preg_match('/^([^_]+)_([^_]+)/i',$_POST['origin'],$regs))
{
$element = $regs[1];
$subelement = $regs[2];
}*/
if ($_POST['origin'] && $_POST['originid'])
{
// Parse element/subelement (ex: project_task)
$element = $subelement = $_POST['origin'];
/*if (preg_match('/^([^_]+)_([^_]+)/i',$_POST['origin'],$regs))
{
$element = $regs[1];
$subelement = $regs[2];
}*/
// For compatibility
if ($element == 'order') { $element = $subelement = 'commande'; }
// For compatibility
if ($element == 'order') { $element = $subelement = 'commande'; }
if ($element == 'propal') { $element = 'comm/propal'; $subelement = 'propal'; }
if ($element == 'contract') { $element = $subelement = 'contrat'; }
if ($element == 'order_supplier') { $element = 'fourn'; $subelement = 'fournisseur.commande'; }
$facfou->origin = $_POST['origin'];
$facfou->origin_id = $_POST['originid'];
$facfou->origin = $_POST['origin'];
$facfou->origin_id = $_POST['originid'];
$facid = $facfou->create($user);
$facid = $facfou->create($user);
// Add lines
if ($facid > 0)
{
require_once(DOL_DOCUMENT_ROOT.'/'.$element.'/class/'.$subelement.'.class.php');
$classname = ucfirst($subelement);
if ($classname == 'Fournisseur.commande') $classname='CommandeFournisseur';
$srcobject = new $classname($db);
// Add lines
if ($facid > 0)
{
require_once(DOL_DOCUMENT_ROOT.'/'.$element.'/class/'.$subelement.'.class.php');
$classname = ucfirst($subelement);
if ($classname == 'Fournisseur.commande') $classname='CommandeFournisseur';
$srcobject = new $classname($db);
$result=$srcobject->fetch($_POST['originid']);
if ($result > 0)
{
$lines = $srcobject->lines;
if (empty($lines) && method_exists($srcobject,'fetch_lines')) $lines = $srcobject->fetch_lines();
$result=$srcobject->fetch($_POST['originid']);
if ($result > 0)
{
$lines = $srcobject->lines;
if (empty($lines) && method_exists($srcobject,'fetch_lines')) $lines = $srcobject->fetch_lines();
for ($i = 0 ; $i < sizeof($lines) ; $i++)
{
$desc=($lines[$i]->desc?$lines[$i]->desc:$lines[$i]->libelle);
$product_type=($lines[$i]->product_type?$lines[$i]->product_type:0);
for ($i = 0 ; $i < sizeof($lines) ; $i++)
{
$desc=($lines[$i]->desc?$lines[$i]->desc:$lines[$i]->libelle);
$product_type=($lines[$i]->product_type?$lines[$i]->product_type:0);
// Dates
// TODO mutualiser
$date_start=$lines[$i]->date_debut_prevue;
if ($lines[$i]->date_debut_reel) $date_start=$lines[$i]->date_debut_reel;
if ($lines[$i]->date_start) $date_start=$lines[$i]->date_start;
$date_end=$lines[$i]->date_fin_prevue;
if ($lines[$i]->date_fin_reel) $date_end=$lines[$i]->date_fin_reel;
if ($lines[$i]->date_end) $date_end=$lines[$i]->date_end;
// Dates
// TODO mutualiser
$date_start=$lines[$i]->date_debut_prevue;
if ($lines[$i]->date_debut_reel) $date_start=$lines[$i]->date_debut_reel;
if ($lines[$i]->date_start) $date_start=$lines[$i]->date_start;
$date_end=$lines[$i]->date_fin_prevue;
if ($lines[$i]->date_fin_reel) $date_end=$lines[$i]->date_fin_reel;
if ($lines[$i]->date_end) $date_end=$lines[$i]->date_end;
$result = $facfou->addline(
$desc,
$lines[$i]->subprice,
$lines[$i]->tva_tx,
$lines[$i]->localtax1_tx,
$lines[$i]->localtax2_tx,
$lines[$i]->qty,
$lines[$i]->fk_product,
$lines[$i]->remise_percent,
$date_start,
$date_end,
0,
$lines[$i]->info_bits,
$result = $facfou->addline(
$desc,
$lines[$i]->subprice,
$lines[$i]->tva_tx,
$lines[$i]->localtax1_tx,
$lines[$i]->localtax2_tx,
$lines[$i]->qty,
$lines[$i]->fk_product,
$lines[$i]->remise_percent,
$date_start,
$date_end,
0,
$lines[$i]->info_bits,
'HT',
$product_type
);
$product_type
);
if ($result < 0)
{
$error++;
break;
}
}
}
else
{
$error++;
}
}
else
{
$error++;
}
}
// If some invoice's lines already known
else
{
$facid = $facfou->create($user);
if ($result < 0)
{
$error++;
break;
}
}
}
else
{
$error++;
}
}
else
{
$error++;
}
}
// If some invoice's lines already known
else
{
$facid = $facfou->create($user);
if ($facid < 0)
{
$error++;
@ -326,7 +326,7 @@ if ($_POST['action'] == 'add' && $user->rights->fournisseur->facture->creer)
if (! $error)
{
for ($i = 1 ; $i < 9 ; $i++)
for ($i = 1 ; $i < 9 ; $i++)
{
$label = $_POST['label'.$i];
$amountht = price2num($_POST['amount'.$i]);
@ -346,14 +346,14 @@ if ($_POST['action'] == 'add' && $user->rights->fournisseur->facture->creer)
}
$atleastoneline=1;
$product=new Product($db);
$product->fetch($_POST['idprod'.$i]);
$product=new Product($db);
$product->fetch($_POST['idprod'.$i]);
$ret=$facfou->addline($label, $amount, $tauxtva, $product->localtax1_tx, $product->localtax2_tx, $qty, $fk_product, $remise_percent, '', '', '', 0, $price_base);
if ($ret < 0) $error++;
}
$ret=$facfou->addline($label, $amount, $tauxtva, $product->localtax1_tx, $product->localtax2_tx, $qty, $fk_product, $remise_percent, '', '', '', 0, $price_base);
if ($ret < 0) $error++;
}
}
}
}
}
if ($error)
@ -383,7 +383,7 @@ if ($_GET['action'] == 'del_ligne')
// Modification d'une ligne
if ($_REQUEST['action'] == 'update_line')
{
if ($_REQUEST['etat'] == '1' && ! $_REQUEST['cancel']) // si on valide la modification
if ($_REQUEST['etat'] == '1' && ! $_REQUEST['cancel']) // si on valide la modification
{
$facfou = new FactureFournisseur($db);
$facfou->fetch($_GET['facid']);
@ -412,15 +412,15 @@ if ($_REQUEST['action'] == 'update_line')
}
else
{
if ($facfou->socid)
{
$societe=new Societe($db);
$societe->fetch($facfou->socid);
}
if ($facfou->socid)
{
$societe=new Societe($db);
$societe->fetch($facfou->socid);
}
$label = $_POST['label'];
$type = $_POST["type"]?$_POST["type"]:0;
$localtax1tx= get_localtax($_POST['tauxtva'], 1, $societe);
$localtax2tx= get_localtax($_POST['tauxtva'], 2, $societe);
$localtax2tx= get_localtax($_POST['tauxtva'], 2, $societe);
}
$result=$facfou->updateline($_GET['lineid'], $label, $pu, $_POST['tauxtva'], $localtax1tx, $localtax2tx, $_POST['qty'], $_POST['idprod'], $price_base_type, 0, $type);
@ -441,11 +441,11 @@ if ($_GET['action'] == 'addline')
exit;
}
if ($facfou->socid)
{
$societe=new Societe($db);
$societe->fetch($facfou->socid);
}
if ($facfou->socid)
{
$societe=new Societe($db);
$societe->fetch($facfou->socid);
}
if ($_POST['idprodfournprice']) // > 0 or -1
{
@ -464,7 +464,7 @@ if ($_GET['action'] == 'addline')
$tvatx=get_default_tva($societe,$mysoc,$product->id);
$localtax1tx= get_localtax($tvatx, 1, $societe);
$localtax2tx= get_localtax($tvatx, 2, $societe);
$localtax2tx= get_localtax($tvatx, 2, $societe);
$type = $product->type;
@ -480,8 +480,8 @@ if ($_GET['action'] == 'addline')
else
{
$tauxtva = price2num($_POST['tauxtva']);
$localtax1tx= get_localtax($tauxtva, 1, $societe);
$localtax2tx= get_localtax($tauxtva, 2, $societe);
$localtax1tx= get_localtax($tauxtva, 1, $societe);
$localtax2tx= get_localtax($tauxtva, 2, $societe);
if (! $_POST['label'])
{
@ -528,8 +528,8 @@ if ($_GET['action'] == 'addline')
unset($_POST['pu']);
unset($_POST['tva_tx']);
unset($_POST['label']);
unset($localtax1_tx);
unset($localtax2_tx);
unset($localtax1_tx);
unset($localtax2_tx);
}
else if (empty($mesg))
{
@ -621,7 +621,7 @@ if ($_GET['action'] == 'reopen' && $user->rights->fournisseur->facture->creer)
/*
* Add file in email form
*/
*/
if ($_POST['addfile'])
{
require_once(DOL_DOCUMENT_ROOT."/lib/files.lib.php");
@ -638,7 +638,7 @@ if ($_POST['addfile'])
/*
* Remove file in email form
*/
*/
if (! empty($_POST['removedfile']))
{
require_once(DOL_DOCUMENT_ROOT."/lib/files.lib.php");
@ -655,7 +655,7 @@ if (! empty($_POST['removedfile']))
/*
* Send mail
*/
*/
if ($_POST['action'] == 'send' && ! $_POST['addfile'] && ! $_POST['removedfile'] && ! $_POST['cancel'])
{
$langs->load('mails');
@ -747,7 +747,7 @@ if ($_POST['action'] == 'send' && ! $_POST['addfile'] && ! $_POST['removedfile']
$facturefourn->actionmsg = $actionmsg;
$facturefourn->actionmsg2 = $actionmsg2;
$facturefourn->fk_element = $facturefourn->id;
$facturefourn->elementtype = $facturefourn->element;
$facturefourn->elementtype = $facturefourn->element;
// Appel des triggers
include_once(DOL_DOCUMENT_ROOT . "/core/class/interfaces.class.php");
@ -812,14 +812,14 @@ if ($_POST['action'] == 'send' && ! $_POST['addfile'] && ! $_POST['removedfile']
/*
* Build document
*/
*/
if ($_REQUEST['action'] == 'builddoc')
{
/*
* Generation de la facture
* definit dans /includes/modules/supplier_invoice/modules_facturefournisseur.php
*/
* definit dans /includes/modules/supplier_invoice/modules_facturefournisseur.php
*/
// Save modele used
$facture=new FactureFournisseur($db);
@ -866,7 +866,7 @@ if ($action=='remove_file')
/*
* View
*/
*/
llxHeader('','','');
@ -887,53 +887,53 @@ if ($_GET['action'] == 'create')
$societe->fetch($_GET['socid']);
}
if (GETPOST('origin') && GETPOST('originid'))
{
// Parse element/subelement (ex: project_task)
$element = $subelement = GETPOST('origin');
if (GETPOST('origin') && GETPOST('originid'))
{
// Parse element/subelement (ex: project_task)
$element = $subelement = GETPOST('origin');
if ($element == 'project')
{
if ($element == 'project')
{
$projectid=GETPOST('originid');
}
else if (in_array($element,array('order_supplier')))
{
// For compatibility
if ($element == 'order') { $element = $subelement = 'commande'; }
}
else if (in_array($element,array('order_supplier')))
{
// For compatibility
if ($element == 'order') { $element = $subelement = 'commande'; }
if ($element == 'propal') { $element = 'comm/propal'; $subelement = 'propal'; }
if ($element == 'contract') { $element = $subelement = 'contrat'; }
if ($element == 'order_supplier') { $element = 'fourn'; $subelement = 'fournisseur.commande'; }
require_once(DOL_DOCUMENT_ROOT.'/'.$element.'/class/'.$subelement.'.class.php');
$classname = ucfirst($subelement);
if ($classname == 'Fournisseur.commande') $classname='CommandeFournisseur';
$objectsrc = new $classname($db);
$objectsrc->fetch(GETPOST('originid'));
$objectsrc->fetch_thirdparty();
require_once(DOL_DOCUMENT_ROOT.'/'.$element.'/class/'.$subelement.'.class.php');
$classname = ucfirst($subelement);
if ($classname == 'Fournisseur.commande') $classname='CommandeFournisseur';
$objectsrc = new $classname($db);
$objectsrc->fetch(GETPOST('originid'));
$objectsrc->fetch_thirdparty();
$projectid = (!empty($objectsrc->fk_project)?$object->fk_project:'');
//$ref_client = (!empty($objectsrc->ref_client)?$object->ref_client:'');
$projectid = (!empty($objectsrc->fk_project)?$object->fk_project:'');
//$ref_client = (!empty($objectsrc->ref_client)?$object->ref_client:'');
$soc = $objectsrc->client;
$cond_reglement_id = (!empty($objectsrc->cond_reglement_id)?$objectsrc->cond_reglement_id:(!empty($soc->cond_reglement_id)?$soc->cond_reglement_id:1));
$mode_reglement_id = (!empty($objectsrc->mode_reglement_id)?$objectsrc->mode_reglement_id:(!empty($soc->mode_reglement_id)?$soc->mode_reglement_id:0));
$remise_percent = (!empty($objectsrc->remise_percent)?$objectsrc->remise_percent:(!empty($soc->remise_percent)?$soc->remise_percent:0));
$remise_absolue = (!empty($objectsrc->remise_absolue)?$objectsrc->remise_absolue:(!empty($soc->remise_absolue)?$soc->remise_absolue:0));
$dateinvoice = empty($conf->global->MAIN_AUTOFILL_DATE)?-1:0;
$soc = $objectsrc->client;
$cond_reglement_id = (!empty($objectsrc->cond_reglement_id)?$objectsrc->cond_reglement_id:(!empty($soc->cond_reglement_id)?$soc->cond_reglement_id:1));
$mode_reglement_id = (!empty($objectsrc->mode_reglement_id)?$objectsrc->mode_reglement_id:(!empty($soc->mode_reglement_id)?$soc->mode_reglement_id:0));
$remise_percent = (!empty($objectsrc->remise_percent)?$objectsrc->remise_percent:(!empty($soc->remise_percent)?$soc->remise_percent:0));
$remise_absolue = (!empty($objectsrc->remise_absolue)?$objectsrc->remise_absolue:(!empty($soc->remise_absolue)?$soc->remise_absolue:0));
$dateinvoice = empty($conf->global->MAIN_AUTOFILL_DATE)?-1:0;
$datetmp=dol_mktime(12,0,0,$_POST['remonth'],$_POST['reday'],$_POST['reyear']);
$dateinvoice=($datetmp==''?(empty($conf->global->MAIN_AUTOFILL_DATE)?-1:0):$datetmp);
$datetmp=dol_mktime(12,0,0,$_POST['echmonth'],$_POST['echday'],$_POST['echyear']);
$datedue=($datetmp==''?-1:$datetmp);
}
}
else
{
$datetmp=dol_mktime(12,0,0,$_POST['remonth'],$_POST['reday'],$_POST['reyear']);
$dateinvoice=($datetmp==''?(empty($conf->global->MAIN_AUTOFILL_DATE)?-1:0):$datetmp);
$datetmp=dol_mktime(12,0,0,$_POST['echmonth'],$_POST['echday'],$_POST['echyear']);
$datedue=($datetmp==''?-1:$datetmp);
}
$datetmp=dol_mktime(12,0,0,$_POST['remonth'],$_POST['reday'],$_POST['reyear']);
$dateinvoice=($datetmp==''?(empty($conf->global->MAIN_AUTOFILL_DATE)?-1:0):$datetmp);
$datetmp=dol_mktime(12,0,0,$_POST['echmonth'],$_POST['echday'],$_POST['echyear']);
$datedue=($datetmp==''?-1:$datetmp);
}
}
else
{
$datetmp=dol_mktime(12,0,0,$_POST['remonth'],$_POST['reday'],$_POST['reyear']);
$dateinvoice=($datetmp==''?(empty($conf->global->MAIN_AUTOFILL_DATE)?-1:0):$datetmp);
$datetmp=dol_mktime(12,0,0,$_POST['echmonth'],$_POST['echday'],$_POST['echyear']);
$datedue=($datetmp==''?-1:$datetmp);
}
print '<form name="add" action="'.$_SERVER["PHP_SELF"].'" method="post">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
@ -942,10 +942,10 @@ if ($_GET['action'] == 'create')
print '<input type="hidden" name="originid" value="'.GETPOST('originid').'">';
print '<table class="border" width="100%">';
// Ref
print '<tr><td>'.$langs->trans('Ref').'</td><td>'.$langs->trans('Draft').'</td></tr>';
// Ref
print '<tr><td>'.$langs->trans('Ref').'</td><td>'.$langs->trans('Draft').'</td></tr>';
// Third party
// Third party
print '<tr><td class="fieldrequired">'.$langs->trans('ThirdParty').'</td>';
print '<td>';
@ -964,91 +964,91 @@ if ($_GET['action'] == 'create')
print '<tr><td class="fieldrequired">'.$langs->trans('RefSupplier').'</td><td><input name="facnumber" value="'.(isset($_POST['facnumber'])?$_POST['facnumber']:$fac_ori->ref).'" type="text"></td>';
print '</tr>';
print '<tr><td valign="top" class="fieldrequired">'.$langs->trans('Type').'</td><td colspan="2">';
print '<table class="nobordernopadding">'."\n";
print '<tr><td valign="top" class="fieldrequired">'.$langs->trans('Type').'</td><td colspan="2">';
print '<table class="nobordernopadding">'."\n";
// Standard invoice
print '<tr height="18"><td width="16px" valign="middle">';
print '<input type="radio" name="type" value="0"'.($_POST['type']==0?' checked="true"':'').'>';
print '</td><td valign="middle">';
$desc=$html->textwithpicto($langs->trans("InvoiceStandardAsk"),$langs->transnoentities("InvoiceStandardDesc"),1);
print $desc;
print '</td></tr>'."\n";
// Standard invoice
print '<tr height="18"><td width="16px" valign="middle">';
print '<input type="radio" name="type" value="0"'.($_POST['type']==0?' checked="true"':'').'>';
print '</td><td valign="middle">';
$desc=$html->textwithpicto($langs->trans("InvoiceStandardAsk"),$langs->transnoentities("InvoiceStandardDesc"),1);
print $desc;
print '</td></tr>'."\n";
/*
// Deposit
print '<tr height="18"><td width="16px" valign="middle">';
print '<input type="radio" name="type" value="3"'.($_POST['type']==3?' checked="true"':'').'>';
print '</td><td valign="middle">';
$desc=$html->textwithpicto($langs->trans("InvoiceDeposit"),$langs->transnoentities("InvoiceDepositDesc"),1);
print $desc;
print '</td></tr>'."\n";
/*
// Deposit
print '<tr height="18"><td width="16px" valign="middle">';
print '<input type="radio" name="type" value="3"'.($_POST['type']==3?' checked="true"':'').'>';
print '</td><td valign="middle">';
$desc=$html->textwithpicto($langs->trans("InvoiceDeposit"),$langs->transnoentities("InvoiceDepositDesc"),1);
print $desc;
print '</td></tr>'."\n";
// Proforma
if ($conf->global->FACTURE_USE_PROFORMAT)
{
print '<tr height="18"><td width="16px" valign="middle">';
print '<input type="radio" name="type" value="4"'.($_POST['type']==4?' checked="true"':'').'>';
print '</td><td valign="middle">';
$desc=$html->textwithpicto($langs->trans("InvoiceProForma"),$langs->transnoentities("InvoiceProFormaDesc"),1);
print $desc;
print '</td></tr>'."\n";
}
// Proforma
if ($conf->global->FACTURE_USE_PROFORMAT)
{
print '<tr height="18"><td width="16px" valign="middle">';
print '<input type="radio" name="type" value="4"'.($_POST['type']==4?' checked="true"':'').'>';
print '</td><td valign="middle">';
$desc=$html->textwithpicto($langs->trans("InvoiceProForma"),$langs->transnoentities("InvoiceProFormaDesc"),1);
print $desc;
print '</td></tr>'."\n";
}
// Replacement
print '<tr height="18"><td valign="middle">';
print '<input type="radio" name="type" value="1"'.($_POST['type']==1?' checked=true':'');
if (! $options) print ' disabled="true"';
print '>';
print '</td><td valign="middle">';
$text=$langs->trans("InvoiceReplacementAsk").' ';
$text.='<select class="flat" name="fac_replacement"';
if (! $options) $text.=' disabled="true"';
$text.='>';
if ($options)
{
$text.='<option value="-1">&nbsp;</option>';
$text.=$options;
}
else
{
$text.='<option value="-1">'.$langs->trans("NoReplacableInvoice").'</option>';
}
$text.='</select>';
$desc=$html->textwithpicto($text,$langs->transnoentities("InvoiceReplacementDesc"),1);
print $desc;
print '</td></tr>';
// Replacement
print '<tr height="18"><td valign="middle">';
print '<input type="radio" name="type" value="1"'.($_POST['type']==1?' checked=true':'');
if (! $options) print ' disabled="true"';
print '>';
print '</td><td valign="middle">';
$text=$langs->trans("InvoiceReplacementAsk").' ';
$text.='<select class="flat" name="fac_replacement"';
if (! $options) $text.=' disabled="true"';
$text.='>';
if ($options)
{
$text.='<option value="-1">&nbsp;</option>';
$text.=$options;
}
else
{
$text.='<option value="-1">'.$langs->trans("NoReplacableInvoice").'</option>';
}
$text.='</select>';
$desc=$html->textwithpicto($text,$langs->transnoentities("InvoiceReplacementDesc"),1);
print $desc;
print '</td></tr>';
// Credit note
print '<tr height="18"><td valign="middle">';
print '<input type="radio" name="type" value="2"'.($_POST['type']==2?' checked=true':'');
if (! $optionsav) print ' disabled="true"';
print '>';
print '</td><td valign="middle">';
$text=$langs->transnoentities("InvoiceAvoirAsk").' ';
// $text.='<input type="text" value="">';
$text.='<select class="flat" name="fac_avoir"';
if (! $optionsav) $text.=' disabled="true"';
$text.='>';
if ($optionsav)
{
$text.='<option value="-1">&nbsp;</option>';
$text.=$optionsav;
}
else
{
$text.='<option value="-1">'.$langs->trans("NoInvoiceToCorrect").'</option>';
}
$text.='</select>';
$desc=$html->textwithpicto($text,$langs->transnoentities("InvoiceAvoirDesc"),1);
//.' ('.$langs->trans("FeatureNotYetAvailable").')',$langs->transnoentities("InvoiceAvoirDesc"),1);
print $desc;
print '</td></tr>'."\n";
*/
print '</table>';
print '</td></tr>';
// Credit note
print '<tr height="18"><td valign="middle">';
print '<input type="radio" name="type" value="2"'.($_POST['type']==2?' checked=true':'');
if (! $optionsav) print ' disabled="true"';
print '>';
print '</td><td valign="middle">';
$text=$langs->transnoentities("InvoiceAvoirAsk").' ';
// $text.='<input type="text" value="">';
$text.='<select class="flat" name="fac_avoir"';
if (! $optionsav) $text.=' disabled="true"';
$text.='>';
if ($optionsav)
{
$text.='<option value="-1">&nbsp;</option>';
$text.=$optionsav;
}
else
{
$text.='<option value="-1">'.$langs->trans("NoInvoiceToCorrect").'</option>';
}
$text.='</select>';
$desc=$html->textwithpicto($text,$langs->transnoentities("InvoiceAvoirDesc"),1);
//.' ('.$langs->trans("FeatureNotYetAvailable").')',$langs->transnoentities("InvoiceAvoirDesc"),1);
print $desc;
print '</td></tr>'."\n";
*/
print '</table>';
print '</td></tr>';
// Label
// Label
print '<tr><td>'.$langs->trans('Label').'</td><td><input size="30" name="libelle" value="'.(isset($_POST['libelle'])?$_POST['libelle']:$fac_ori->libelle).'" type="text"></td></tr>';
// Date invoice
@ -1065,68 +1065,83 @@ if ($_GET['action'] == 'create')
print '<td><textarea name="note" wrap="soft" cols="60" rows="'.ROWS_5.'"></textarea></td>';
print '</tr>';
if (is_object($objectsrc))
{
print "\n<!-- ".$classname." info -->";
print "\n";
print '<input type="hidden" name="amount" value="'.$objectsrc->total_ht.'">'."\n";
print '<input type="hidden" name="total" value="'.$objectsrc->total_ttc.'">'."\n";
print '<input type="hidden" name="tva" value="'.$objectsrc->total_tva.'">'."\n";
print '<input type="hidden" name="origin" value="'.$objectsrc->element.'">';
print '<input type="hidden" name="originid" value="'.$objectsrc->id.'">';
if (is_object($objectsrc))
{
print "\n<!-- ".$classname." info -->";
print "\n";
print '<input type="hidden" name="amount" value="'.$objectsrc->total_ht.'">'."\n";
print '<input type="hidden" name="total" value="'.$objectsrc->total_ttc.'">'."\n";
print '<input type="hidden" name="tva" value="'.$objectsrc->total_tva.'">'."\n";
print '<input type="hidden" name="origin" value="'.$objectsrc->element.'">';
print '<input type="hidden" name="originid" value="'.$objectsrc->id.'">';
$txt=$langs->trans($classname);
if ($classname=='CommandeFournisseur') $txt=$langs->trans("SupplierOrder");
print '<tr><td>'.$txt.'</td><td colspan="2">'.$objectsrc->getNomUrl(1).'</td></tr>';
print '<tr><td>'.$langs->trans('TotalHT').'</td><td colspan="2">'.price($objectsrc->total_ht).'</td></tr>';
print '<tr><td>'.$langs->trans('TotalVAT').'</td><td colspan="2">'.price($objectsrc->total_tva)."</td></tr>";
if ($mysoc->pays_code=='ES')
{
if ($mysoc->localtax1_assuj=="1") //Localtax1 RE
{
print '<tr><td>'.$langs->transcountry("AmountLT1",$mysoc->pays_code).'</td><td colspan="2">'.price($objectsrc->total_localtax1)."</td></tr>";
}
$txt=$langs->trans($classname);
if ($classname=='CommandeFournisseur') $txt=$langs->trans("SupplierOrder");
print '<tr><td>'.$txt.'</td><td colspan="2">'.$objectsrc->getNomUrl(1).'</td></tr>';
print '<tr><td>'.$langs->trans('TotalHT').'</td><td colspan="2">'.price($objectsrc->total_ht).'</td></tr>';
print '<tr><td>'.$langs->trans('TotalVAT').'</td><td colspan="2">'.price($objectsrc->total_tva)."</td></tr>";
if ($mysoc->pays_code=='ES')
{
if ($mysoc->localtax1_assuj=="1") //Localtax1 RE
{
print '<tr><td>'.$langs->transcountry("AmountLT1",$mysoc->pays_code).'</td><td colspan="2">'.price($objectsrc->total_localtax1)."</td></tr>";
}
if ($mysoc->localtax2_assuj=="1") //Localtax2 IRPF
{
print '<tr><td>'.$langs->transcountry("AmountLT2",$mysoc->pays_code).'</td><td colspan="2">'.price($objectsrc->total_localtax2)."</td></tr>";
}
}
print '<tr><td>'.$langs->trans('TotalTTC').'</td><td colspan="2">'.price($objectsrc->total_ttc)."</td></tr>";
}
if ($mysoc->localtax2_assuj=="1") //Localtax2 IRPF
{
print '<tr><td>'.$langs->transcountry("AmountLT2",$mysoc->pays_code).'</td><td colspan="2">'.price($objectsrc->total_localtax2)."</td></tr>";
}
}
print '<tr><td>'.$langs->trans('TotalTTC').'</td><td colspan="2">'.price($objectsrc->total_ttc)."</td></tr>";
}
else
{
if ($conf->global->PRODUCT_SHOW_WHEN_CREATE)
{
print '<tr class="liste_titre">';
print '<td>&nbsp;</td><td>'.$langs->trans('Label').'</td>';
print '<td align="right">'.$langs->trans('PriceUHT').'</td>';
print '<td align="right">'.$langs->trans('VAT').'</td>';
print '<td align="right">'.$langs->trans('Qty').'</td>';
print '<td align="right">'.$langs->trans('PriceUTTC').'</td>';
print '</tr>';
if ($conf->global->PRODUCT_SHOW_WHEN_CREATE)
{
print '<tr class="liste_titre">';
print '<td>&nbsp;</td><td>'.$langs->trans('Label').'</td>';
print '<td align="right">'.$langs->trans('PriceUHT').'</td>';
print '<td align="right">'.$langs->trans('VAT').'</td>';
print '<td align="right">'.$langs->trans('Qty').'</td>';
print '<td align="right">'.$langs->trans('PriceUTTC').'</td>';
print '</tr>';
for ($i = 1 ; $i < 9 ; $i++)
{
$value_qty = '1';
$value_tauxtva = '';
print '<tr><td>'.$i.'</td>';
print '<td><input size="50" name="label'.$i.'" value="'.$value_label.'" type="text"></td>';
print '<td align="right"><input type="text" size="8" name="amount'.$i.'" value="'.$value_pu.'"></td>';
print '<td align="right">';
print $html->load_tva('tauxtva'.$i,$value_tauxtva,$societe,$mysoc);
print '</td>';
print '<td align="right"><input type="text" size="3" name="qty'.$i.'" value="'.$value_qty.'"></td>';
print '<td align="right"><input type="text" size="8" name="amountttc'.$i.'" value=""></td></tr>';
}
}
for ($i = 1 ; $i < 9 ; $i++)
{
$value_qty = '1';
$value_tauxtva = '';
print '<tr><td>'.$i.'</td>';
print '<td><input size="50" name="label'.$i.'" value="'.$value_label.'" type="text"></td>';
print '<td align="right"><input type="text" size="8" name="amount'.$i.'" value="'.$value_pu.'"></td>';
print '<td align="right">';
print $html->load_tva('tauxtva'.$i,$value_tauxtva,$societe,$mysoc);
print '</td>';
print '<td align="right"><input type="text" size="3" name="qty'.$i.'" value="'.$value_qty.'"></td>';
print '<td align="right"><input type="text" size="8" name="amountttc'.$i.'" value=""></td></tr>';
}
}
}
// Bouton "Create Draft"
print "</table>\n";
// Bouton "Create Draft"
print "</table>\n";
print '<br><center><input type="submit" class="button" name="bouton" value="'.$langs->trans('CreateDraft').'"></center>';
print '<br><center><input type="submit" class="button" name="bouton" value="'.$langs->trans('CreateDraft').'"></center>';
print "</form>\n";
print "</form>\n";
// Show origin lines
if (is_object($objectsrc))
{
print '<br>';
$title=$langs->trans('ProductsAndServices');
print_titre($title);
print '<table class="noborder" width="100%">';
$objectsrc->printOriginLinesList($hookmanager);
print '</table>';
}
}
else
{
@ -1212,7 +1227,7 @@ else
{
/*
* View card
*/
*/
$head = facturefourn_prepare_head($fac);
$titre=$langs->trans('SupplierInvoice');
dol_fiche_head($head, 'card', $titre, 0, 'bill');
@ -1255,7 +1270,7 @@ else
/*
* Confirmation de la suppression de la facture fournisseur
*/
*/
if ($_GET['action'] == 'delete')
{
$ret=$html->form_confirm('fiche.php?facid='.$fac->id, $langs->trans('DeleteBill'), $langs->trans('ConfirmDeleteBill'), 'confirm_delete', '', 0, 1);
@ -1265,7 +1280,7 @@ else
/*
* Facture
*/
*/
print '<table class="border" width="100%">';
// Ref
@ -1331,7 +1346,7 @@ else
/*
* List of payments
*/
*/
$nbrows=7;
if ($conf->projet->enabled) $nbrows++;
@ -1484,7 +1499,7 @@ else
/*
* Lines
*/
*/
print '<br>';
print '<table class="noborder" width="100%">';
$var=1;
@ -1636,7 +1651,7 @@ else
/*
* Form to add new line
*/
*/
if ($fac->statut == 0 && $_GET['action'] != 'mod_ligne')
{
@ -1743,7 +1758,7 @@ else
/*
* Boutons actions
*/
*/
print '<div class="tabsAction">';
@ -1830,7 +1845,7 @@ else
/*
* Documents generes
*/
*/
$ref=dol_sanitizeFileName($fac->ref);
$subdir = get_exdir($fac->id,2).$ref;
@ -1846,7 +1861,7 @@ else
/*
* Linked object block
*/
*/
$somethingshown=$object->showLinkedObjectBlock();
print '</td><td valign="top" width="50%">';