';
+
+ // Ref
+ print ''.$langs->trans('Ref').' '.$propal->ref_url.' ';
+
+ $rowspan=9;
+
+ // Société
+ print ''.$langs->trans('Company').' '.$societe->getNomUrl(1).' ';
+ print ' ';
- $rowspan=9;
-
- // Société
- print ''.$langs->trans('Company').' ';
- if ($societe->client == 1)
- {
- $url ='fiche.php?socid='.$societe->id;
- }
- else
- {
- $url = DOL_URL_ROOT.'/comm/prospect/fiche.php?socid='.$societe->id;
- }
- print ''.$societe->nom.' ';
- print ' ';
- print ' ';
-
// Ligne info remises tiers
- print ''.$langs->trans('Discounts').' ';
+ print ' '.$langs->trans('Discounts').' ';
if ($societe->remise_client) print $langs->trans("CompanyHasRelativeDiscount",$societe->remise_client);
else print $langs->trans("CompanyHasNoRelativeDiscount");
$absolute_discount=$societe->getCurrentDiscount();
@@ -623,56 +586,57 @@ if ($_GET['propalid'] > 0)
{
print $langs->trans("CompanyHasAbsoluteDiscount",$absolute_discount,$langs->trans("Currency".$conf->monnaie));
print '.';
+// print $html->form_remise_dispo($_SERVER["PHP_SELF"].'?propalid='.$propal->id,0,'remise_id',$societe->id);
}
else print $langs->trans("CompanyHasNoAbsoluteDiscount").'.';
print ' ';
-
- // Dates
- print ''.$langs->trans('Date').' ';
- print dolibarr_print_date($propal->date,'%a %d %B %Y');
- print ' ';
- if ($conf->projet->enabled) $rowspan++;
- if ($conf->global->PROPAL_ADD_SHIPPING_DATE) $rowspan++;
- if ($conf->global->PROPAL_ADD_DELIVERY_ADDRESS) $rowspan++;
-
- // Notes
- print ''.$langs->trans('NotePublic').' : '. nl2br($propal->note_public).' ';
- print ' ';
-
- // Date fin propal
- print '';
+ // Dates
+ print ' '.$langs->trans('Date').' ';
+ print dolibarr_print_date($propal->date,'%a %d %B %Y');
+ print ' ';
+
+ if ($conf->projet->enabled) $rowspan++;
+ if ($conf->global->PROPAL_ADD_SHIPPING_DATE) $rowspan++;
+ if ($conf->global->PROPAL_ADD_DELIVERY_ADDRESS) $rowspan++;
+
+ // Notes
+ print ''.$langs->trans('NotePublic').' : '. nl2br($propal->note_public).' ';
+ print ' ';
+
+ // Date fin propal
+ print '';
print '';
print '';
- print ' ';
- if ($propal->brouillon && $_GET['action'] == 'editecheance')
- {
- print '';
- }
- else
- {
- if ($propal->fin_validite)
- {
- print dolibarr_print_date($propal->fin_validite,'%a %d %B %Y');
- if ($propal->statut == 1 && $propal->fin_validite < (time() - $conf->propal->cloture->warning_delay)) print img_warning($langs->trans("Late"));
- }
- else
- {
- print $langs->trans("Unknown");
- }
- }
- print ' ';
- print ' ';
-
-
+ print '';
+ if ($propal->brouillon && $_GET['action'] == 'editecheance')
+ {
+ print '';
+ }
+ else
+ {
+ if ($propal->fin_validite)
+ {
+ print dolibarr_print_date($propal->fin_validite,'%a %d %B %Y');
+ if ($propal->statut == 1 && $propal->fin_validite < (time() - $conf->propal->cloture->warning_delay)) print img_warning($langs->trans("Late"));
+ }
+ else
+ {
+ print $langs->trans("Unknown");
+ }
+ }
+ print ' ';
+ print '';
+
+
// date de livraison (conditonné sur PROPAL_ADD_SHIPPING_DATE car carac à
// gérer par les commandes et non les propal
if ($conf->global->PROPAL_ADD_SHIPPING_DATE)
@@ -687,10 +651,10 @@ if ($_GET['propalid'] > 0)
if ($_GET['action'] == 'editdate_livraison')
{
print '';
+ print ' ';
+ $html->select_date($propal->date_livraison,'liv_','','','',"editdate_livraison");
+ print ' ';
+ print '';
}
else
{
@@ -699,30 +663,30 @@ if ($_GET['propalid'] > 0)
print '';
print '';
}
-
+
// adresse de livraison
if ($conf->global->PROPAL_ADD_DELIVERY_ADDRESS)
- {
- print '';
- print '';
- print ' ';
-
- if ($_GET['action'] == 'editdelivery_adress')
- {
- $html->form_adresse_livraison($_SERVER['PHP_SELF'].'?propalid='.$propal->id,$propal->adresse_livraison_id,$_GET['socidp'],'adresse_livraison_id','propal',$propal->id);
- }
- else
- {
- $html->form_adresse_livraison($_SERVER['PHP_SELF'].'?propalid='.$propal->id,$propal->adresse_livraison_id,$_GET['socidp'],'none','propal',$propal->id);
- }
- print ' ';
+ {
+ print '';
+ print '';
+ print ' ';
+
+ if ($_GET['action'] == 'editdelivery_adress')
+ {
+ $html->form_adresse_livraison($_SERVER['PHP_SELF'].'?propalid='.$propal->id,$propal->adresse_livraison_id,$_GET['socidp'],'adresse_livraison_id','propal',$propal->id);
+ }
+ else
+ {
+ $html->form_adresse_livraison($_SERVER['PHP_SELF'].'?propalid='.$propal->id,$propal->adresse_livraison_id,$_GET['socidp'],'none','propal',$propal->id);
+ }
+ print ' ';
}
-
+
// Conditions et modes de réglement
print '';
print ' ';
-
- /*
- * Lignes de propale
- *
- */
- print '';
- $sql = 'SELECT pt.rowid, pt.description, pt.price, pt.fk_product, pt.qty, pt.tva_tx, pt.remise_percent, pt.subprice,';
- $sql.= ' p.label as product, p.ref, p.fk_product_type, p.rowid as prodid,';
- $sql.= ' p.description as product_desc';
- $sql.= ' FROM '.MAIN_DB_PREFIX.'propaldet as pt';
- $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON pt.fk_product=p.rowid';
- $sql.= ' WHERE pt.fk_propal = '.$propal->id;
- $sql.= ' ORDER BY pt.rang ASC, pt.rowid';
- $resql = $db->query($sql);
- if ($resql)
- {
- $num = $db->num_rows($resql);
- $i = 0; $total = 0;
-
- if ($num)
- {
- print '';
- print ''.$langs->trans('Description').' ';
- print ''.$langs->trans('VAT').' ';
- print ''.$langs->trans('PriceUHT').' ';
- print ''.$langs->trans('Qty').' ';
- print ''.$langs->trans('ReductionShort').' ';
- print ''.$langs->trans('AmountHT').' ';
- print ' ';
- print ' ';
- print ' ';
- print " \n";
- }
- $var=true;
- while ($i < $num)
- {
- $objp = $db->fetch_object($resql);
- $var=!$var;
-
- // Ligne en mode visu
- if ($_GET['action'] != 'editline' || $_GET['ligne'] != $objp->rowid)
- {
- print '';
- if ($objp->fk_product > 0)
- {
- print '';
- if ($objp->fk_product_type) print img_object($langs->trans('ShowService'),'service');
- else print img_object($langs->trans('ShowProduct'),'product');
- print ' '.$objp->ref.' ';
- print ' - '.nl2br(stripslashes($objp->product));
-
- if ($conf->global->PROP_ADD_PROD_DESC && !$conf->global->PRODUIT_CHANGE_PROD_DESC)
- {
- print ' '.nl2br(stripslashes($objp->product_desc));
- }
-
- if ($objp->date_start && $objp->date_end)
- {
- print ' (Du '.dolibarr_print_date($objp->date_start).' au '.dolibarr_print_date($objp->date_end).')';
- }
- if ($objp->date_start && ! $objp->date_end)
- {
- print ' (A partir du '.dolibarr_print_date($objp->date_start).')';
- }
- if (! $objp->date_start && $objp->date_end)
- {
- print " (Jusqu'au ".dolibarr_print_date($objp->date_end).')';
- }
- print ($objp->description && $objp->description!=$objp->product)?' '.stripslashes(nl2br($objp->description)):'';
- print ' ';
- }
- else
- {
- print ''.stripslashes(nl2br($objp->description));
- if ($objp->date_start && $objp->date_end)
- {
- print ' (Du '.dolibarr_print_date($objp->date_start).' au '.dolibarr_print_date($objp->date_end).')';
- }
- if ($objp->date_start && ! $objp->date_end)
- {
- print ' (A partir du '.dolibarr_print_date($objp->date_start).')';
- }
- if (! $objp->date_start && $objp->date_end)
- {
- print " (Jusqu'au ".dolibarr_print_date($objp->date_end).')';
- }
- print " \n";
- }
- print ''.$objp->tva_tx.'% ';
- print ''.price($objp->subprice)." \n";
- print ''.$objp->qty.' ';
- if ($objp->remise_percent > 0)
- {
- print ''.$objp->remise_percent."% \n";
- }
- else
- {
- print ' ';
- }
- print ''.price($objp->subprice*$objp->qty*(100-$objp->remise_percent)/100)." \n";
-
- // Icone d'edition et suppression
- if ($propal->statut == 0 && $user->rights->propale->creer)
- {
- print 'id.'&action=editline&ligne='.$objp->rowid.'">';
- print img_edit();
- print ' ';
- print 'id.'&action=del_ligne&ligne='.$objp->rowid.'">';
- print img_delete();
- print ' ';
- print '';
- if ($i > 0)
- {
- print 'id.'&action=up&rowid='.$objp->rowid.'">';
- print img_up();
- print ' ';
- }
- if ($i < $num-1)
- {
- print 'id.'&action=down&rowid='.$objp->rowid.'">';
- print img_down();
- print ' ';
- }
- print ' ';
- }
- else
- {
- print ' ';
- }
-
- print ' ';
- }
-
- // Ligne en mode update
- if ($propal->statut == 0 && $_GET["action"] == 'editline' && $user->rights->propale->creer && $_GET["ligne"] == $objp->rowid)
- {
- print '\n";
- }
-
- $total = $total + ($objp->qty * $objp->price);
- $i++;
- }
-
- $db->free($resql);
- }
- else
- {
- dolibarr_print_error($db);
- }
-
+ // Projet
+ if ($conf->projet->enabled)
+ {
+ $langs->load("projects");
+ print ''.$langs->trans('Project').' ';
+ $numprojet = $societe->has_projects();
+ if (! $numprojet)
+ {
+ print '';
+ print $langs->trans("NoProject").' ';
+ print 'id.'&action=create>'.$langs->trans('AddProject').' ';
+ print ' ';
+ }
+ else
+ {
+ if ($propal->statut == 0 && $user->rights->propale->creer)
+ {
+ print '';
+ print 'id.'" method="post">';
+ print ' ';
+ $form->select_projects($societe->id, $propal->projetidp, 'projetidp');
+ print ' ';
+ print ' ';
+ print '';
+ print ' ';
+ }
+ else
+ {
+ if (!empty($propal->projetidp))
+ {
+ print '';
+ $proj = new Project($db);
+ $proj->fetch($propal->projetidp);
+ print '';
+ print $proj->title;
+ print ' ';
+ print ' ';
+ }
+ else {
+ print ' ';
+ }
+ }
+ }
+ print ' ';
+ }
+
+ // Amount
+ print ''.$langs->trans('AmountHT').' ';
+ print ''.price($propal->price).' ';
+ print ''.$langs->trans("Currency".$conf->monnaie).' ';
+
+ print ''.$langs->trans('AmountVAT').' '.price($propal->total_tva).' ';
+ print ''.$langs->trans("Currency".$conf->monnaie).' ';
+ print ''.$langs->trans('AmountTTC').' '.price($propal->total_ttc).' ';
+ print ''.$langs->trans("Currency".$conf->monnaie).' ';
+
+ // Statut
+ print ''.$langs->trans('Status').' '.$propal->getLibStatut(4).' ';
+ print '
';
/*
- * Lignes de remise
- */
-
- // Réductions relatives (Remises-Ristournes-Rabbais)
-/* Une réduction doit s'appliquer obligatoirement sur des lignes de factures
+ * Lignes de propale
+ *
+ */
+ print '';
+
+ $sql = 'SELECT pt.rowid, pt.description, pt.price, pt.fk_product, pt.qty, pt.tva_tx, pt.remise_percent, pt.subprice,';
+ $sql.= ' p.label as product, p.ref, p.fk_product_type, p.rowid as prodid,';
+ $sql.= ' p.description as product_desc';
+ $sql.= ' FROM '.MAIN_DB_PREFIX.'propaldet as pt';
+ $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON pt.fk_product=p.rowid';
+ $sql.= ' WHERE pt.fk_propal = '.$propal->id;
+ $sql.= ' ORDER BY pt.rang ASC, pt.rowid';
+ $resql = $db->query($sql);
+ if ($resql)
+ {
+ $num = $db->num_rows($resql);
+ $i = 0; $total = 0;
+
+ if ($num)
+ {
+ print '';
+ print ''.$langs->trans('Description').' ';
+ print ''.$langs->trans('VAT').' ';
+ print ''.$langs->trans('PriceUHT').' ';
+ print ''.$langs->trans('Qty').' ';
+ print ''.$langs->trans('ReductionShort').' ';
+ print ''.$langs->trans('AmountHT').' ';
+ print ' ';
+ print ' ';
+ print ' ';
+ print " \n";
+ }
+ $var=true;
+ while ($i < $num)
+ {
+ $objp = $db->fetch_object($resql);
+ $var=!$var;
+
+ // Ligne en mode visu
+ if ($_GET['action'] != 'editline' || $_GET['ligne'] != $objp->rowid)
+ {
+ print '';
+ if ($objp->fk_product > 0)
+ {
+ print '';
+ if ($objp->fk_product_type) print img_object($langs->trans('ShowService'),'service');
+ else print img_object($langs->trans('ShowProduct'),'product');
+ print ' '.$objp->ref.' ';
+ print ' - '.nl2br(stripslashes($objp->product));
+
+ if ($conf->global->PROP_ADD_PROD_DESC && !$conf->global->PRODUIT_CHANGE_PROD_DESC)
+ {
+ print ' '.nl2br(stripslashes($objp->product_desc));
+ }
+
+ if ($objp->date_start && $objp->date_end)
+ {
+ print ' (Du '.dolibarr_print_date($objp->date_start).' au '.dolibarr_print_date($objp->date_end).')';
+ }
+ if ($objp->date_start && ! $objp->date_end)
+ {
+ print ' (A partir du '.dolibarr_print_date($objp->date_start).')';
+ }
+ if (! $objp->date_start && $objp->date_end)
+ {
+ print " (Jusqu'au ".dolibarr_print_date($objp->date_end).')';
+ }
+ print ($objp->description && $objp->description!=$objp->product)?' '.stripslashes(nl2br($objp->description)):'';
+ print ' ';
+ }
+ else
+ {
+ print ''.stripslashes(nl2br($objp->description));
+ if ($objp->date_start && $objp->date_end)
+ {
+ print ' (Du '.dolibarr_print_date($objp->date_start).' au '.dolibarr_print_date($objp->date_end).')';
+ }
+ if ($objp->date_start && ! $objp->date_end)
+ {
+ print ' (A partir du '.dolibarr_print_date($objp->date_start).')';
+ }
+ if (! $objp->date_start && $objp->date_end)
+ {
+ print " (Jusqu'au ".dolibarr_print_date($objp->date_end).')';
+ }
+ print " \n";
+ }
+ print ''.$objp->tva_tx.'% ';
+ print ''.price($objp->subprice)." \n";
+ print ''.$objp->qty.' ';
+ if ($objp->remise_percent > 0)
+ {
+ print ''.$objp->remise_percent."% \n";
+ }
+ else
+ {
+ print ' ';
+ }
+ print ''.price($objp->subprice*$objp->qty*(100-$objp->remise_percent)/100)." \n";
+
+ // Icone d'edition et suppression
+ if ($propal->statut == 0 && $user->rights->propale->creer)
+ {
+ print 'id.'&action=editline&ligne='.$objp->rowid.'">';
+ print img_edit();
+ print ' ';
+ print 'id.'&action=del_ligne&ligne='.$objp->rowid.'">';
+ print img_delete();
+ print ' ';
+ print '';
+ if ($i > 0)
+ {
+ print 'id.'&action=up&rowid='.$objp->rowid.'">';
+ print img_up();
+ print ' ';
+ }
+ if ($i < $num-1)
+ {
+ print 'id.'&action=down&rowid='.$objp->rowid.'">';
+ print img_down();
+ print ' ';
+ }
+ print ' ';
+ }
+ else
+ {
+ print ' ';
+ }
+
+ print ' ';
+ }
+
+ // Ligne en mode update
+ if ($propal->statut == 0 && $_GET["action"] == 'editline' && $user->rights->propale->creer && $_GET["ligne"] == $objp->rowid)
+ {
+ print 'id.'" method="post">';
+ print ' ';
+ print ' ';
+ print ' ';
+ print '';
+ print '';
+ if ($objp->fk_product > 0)
+ {
+ print '';
+ if ($objp->fk_product_type) print img_object($langs->trans('ShowService'),'service');
+ else print img_object($langs->trans('ShowProduct'),'product');
+ print ' '.$objp->ref.' ';
+ print ' - '.stripslashes(nl2br($objp->product));
+ print ' ';
+ }
+ print ''.stripslashes($objp->description).' ';
+ print '';
+ if($societe->tva_assuj == "0")
+ print ' 0';
+ else
+ print $html->select_tva("tva_tx",$objp->tva_tx,$mysoc,$societe);
+ print ' ';
+ print ' ';
+ print ' ';
+ print ' % ';
+ print ' ';
+ print ' ';
+ print ' ' . "\n";
+ /*
+ if ($conf->service->enabled)
+ {
+ print "";
+ print 'Si produit de type service à durée limitée: Du ';
+ print $html->select_date($objp->date_start,"date_start",0,0,$objp->date_start?0:1);
+ print ' au ';
+ print $html->select_date($objp->date_end,"date_end",0,0,$objp->date_end?0:1);
+ print ' ';
+ print ' ' . "\n";
+ }
+ */
+ print " \n";
+ }
+
+ $total = $total + ($objp->qty * $objp->price);
+ $i++;
+ }
+
+ $db->free($resql);
+ }
+ else
+ {
+ dolibarr_print_error($db);
+ }
+
+
+ /*
+ * Lignes de remise
+ */
+
+ // Réductions relatives (Remises-Ristournes-Rabbais)
+ /* Une réduction doit s'appliquer obligatoirement sur des lignes de factures
$var=!$var;
print '';
print ' ';
@@ -1052,11 +1016,11 @@ if ($_GET['propalid'] > 0)
print '';
if ($_GET['action'] == 'editrelativediscount')
{
- print ' %';
+ print ' %';
}
else
{
- print $propal->remise_percent?$propal->remise_percent.'%':' ';
+ print $propal->remise_percent?$propal->remise_percent.'%':' ';
}
print ' ';
print '';
@@ -1065,36 +1029,36 @@ if ($_GET['propalid'] > 0)
print ' ';
if ($_GET['action'] != 'editrelativediscount')
{
- if ($propal->brouillon && $user->rights->propale->creer)
- {
- print 'id.'">'.img_edit($langs->trans('SetRelativeDiscount'),1).' ';
- }
- else
- {
- print ' ';
- }
- if ($propal->brouillon && $user->rights->propale->creer && $propal->remise_percent)
- {
- print 'id.'&action=setremisepercent&rowid='.$objp->rowid.'">';
- print img_delete();
- print ' ';
- }
- else
- {
- print ' ';
- }
- print ' ';
+ if ($propal->brouillon && $user->rights->propale->creer)
+ {
+ print 'id.'">'.img_edit($langs->trans('SetRelativeDiscount'),1).' ';
}
else
{
- print ' ';
+ print ' ';
+ }
+ if ($propal->brouillon && $user->rights->propale->creer && $propal->remise_percent)
+ {
+ print 'id.'&action=setremisepercent&rowid='.$objp->rowid.'">';
+ print img_delete();
+ print ' ';
+ }
+ else
+ {
+ print ' ';
+ }
+ print ' ';
+ }
+ else
+ {
+ print ' ';
}
print '';
print ' ';
-*/
+ */
- // Réductions absolues (Remises-Ristournes-Rabbais)
-/* Les remises absolues doivent s'appliquer par ajout de lignes spécialisées
+ // Réductions absolues (Remises-Ristournes-Rabbais)
+ /* Les remises absolues doivent s'appliquer par ajout de lignes spécialisées
$var=!$var;
print '';
print ' ';
@@ -1110,367 +1074,367 @@ if ($_GET['propalid'] > 0)
print '';
if ($_GET['action'] == 'editabsolutediscount')
{
- print '- ';
+ print '- ';
}
else
{
- print $propal->remise_absolue?'-'.price($propal->remise_absolue):$langs->trans("DiscountNone");
+ print $propal->remise_absolue?'-'.price($propal->remise_absolue):$langs->trans("DiscountNone");
}
print ' ';
if ($_GET['action'] != 'editabsolutediscount')
{
- if ($propal->brouillon && $user->rights->propale->creer)
- {
- print 'id.'">'.img_edit($langs->trans('SetAbsoluteDiscount'),1).' ';
- }
- else
- {
- print ' ';
- }
- if ($propal->brouillon && $user->rights->propale->creer && $propal->remise_absolue)
- {
- print 'id.'&action=setremiseabsolue&rowid='.$objp->rowid.'">';
- print img_delete();
- print ' ';
- }
- else
- {
- print ' ';
- }
- print ' ';
+ if ($propal->brouillon && $user->rights->propale->creer)
+ {
+ print 'id.'">'.img_edit($langs->trans('SetAbsoluteDiscount'),1).' ';
}
else
{
- print ' ';
+ print ' ';
+ }
+ if ($propal->brouillon && $user->rights->propale->creer && $propal->remise_absolue)
+ {
+ print 'id.'&action=setremiseabsolue&rowid='.$objp->rowid.'">';
+ print img_delete();
+ print ' ';
+ }
+ else
+ {
+ print ' ';
+ }
+ print ' ';
+ }
+ else
+ {
+ print ' ';
}
print '';
print ' ';
-*/
-
- /*
- * Ajouter une ligne
- */
- if ($propal->statut == 0 && $user->rights->propale->creer && $_GET["action"] <> 'editline')
- {
- print '';
- print ''.$langs->trans('Description').' ';
- print ''.$langs->trans('VAT').' ';
- print ''.$langs->trans('PriceUHT').' ';
- print ''.$langs->trans('Qty').' ';
- print ''.$langs->trans('ReductionShort').' ';
- print ' ';
- print ' ';
- print ' ';
+ */
+
+ /*
+ * Ajouter une ligne
+ */
+ if ($propal->statut == 0 && $user->rights->propale->creer && $_GET["action"] <> 'editline')
+ {
+ print ' ';
+ print ''.$langs->trans('Description').' ';
+ print ''.$langs->trans('VAT').' ';
+ print ''.$langs->trans('PriceUHT').' ';
+ print ''.$langs->trans('Qty').' ';
+ print ''.$langs->trans('ReductionShort').' ';
print ' ';
- print " \n";
-
- // Ajout produit produits/services personalisés
- print 'id.'" method="post">';
- print ' ';
- print ' ';
+ print ' ';
+ print ' ';
+ print ' ';
+ print "\n";
- $var=true;
+ // Ajout produit produits/services personalisés
+ print ' id.'" method="post">';
+ print ' ';
+ print ' ';
- print '\n";
- print ' ';
- print '';
- if($societe->tva_assuj == "0")
- {
- print ' 0';
- }
- else
- {
- $html->select_tva('np_tva_tx', $conf->defaulttx, $mysoc, $societe);
- }
- print " \n";
- print ' ';
- print ' ';
- print ' % ';
- print ' ';
- print ' ';
-
- print ' ';
+ $var=true;
- // Ajout de produits/services prédéfinis
- if ($conf->produit->enabled)
- {
- print 'id.'" method="post">';
- print ' ';
- print ' ';
-
- $var=!$var;
+ print '\n";
+ print ' ';
+ print '';
+ if($societe->tva_assuj == "0")
+ {
+ print ' 0';
+ }
+ else
+ {
+ $html->select_tva('np_tva_tx', $conf->defaulttx, $mysoc, $societe);
+ }
+ print " \n";
+ print ' ';
+ print ' ';
+ print ' % ';
+ print ' ';
+ print ' ';
- print '';
- print '';
- // multiprix
- if($conf->global->PRODUIT_MULTIPRICES == 1)
- {
- $html->select_produits('','idprod','',$conf->produit->limit_size,$societe->price_level);
- }
- else
- {
- $html->select_produits('','idprod','',$conf->produit->limit_size);
- }
- print ' ';
- print ' ';
- print ' ';
- print ' ';
- print ' ';
- print ' % ';
+ print '';
- print ' ';
- print ' '."\n";
-
- print ' ';
- }
- }
+ // Ajout de produits/services prédéfinis
+ if ($conf->produit->enabled)
+ {
+ print 'id.'" method="post">';
+ print ' ';
+ print ' ';
+
+ $var=!$var;
+
+ print '';
+ print '';
+ // multiprix
+ if($conf->global->PRODUIT_MULTIPRICES == 1)
+ {
+ $html->select_produits('','idprod','',$conf->produit->limit_size,$societe->price_level);
+ }
+ else
+ {
+ $html->select_produits('','idprod','',$conf->produit->limit_size);
+ }
+ print ' ';
+ print ' ';
+ print ' ';
+ print ' ';
+ print ' ';
+ print ' % ';
+
+ print ' ';
+ print ' '."\n";
+
+ print ' ';
+ }
+ }
+
+ print '
';
+ }
+ }
+ else
+ {
+ dolibarr_print_error($db);
+ }
- print '
';
- }
- }
- else
- {
- dolibarr_print_error($db);
- }
-
print '';
print "\n";
/*
- * Formulaire cloture (signé ou non)
- */
- if ($_GET['action'] == 'statut')
- {
- print '';
- print "';
+ print "';
print ''.$langs->trans('Ref').' '.$propal->ref_url.' ';
// Société
- print ''.$langs->trans('Company').' ';
- if ($societe->client == 1)
- {
- $url ='fiche.php?socid='.$societe->id;
- }
- else
- {
- $url = DOL_URL_ROOT.'/comm/prospect/fiche.php?socid='.$societe->id;
- }
- print ''.$societe->nom.' ';
- print ' ';
+ print ''.$langs->trans('Company').' '.$societe->getNomUrl(1).' ';
+ // Ligne info remises tiers
+ print ''.$langs->trans('Discounts').' ';
+ if ($societe->remise_client) print $langs->trans("CompanyHasRelativeDiscount",$societe->remise_client);
+ else print $langs->trans("CompanyHasNoRelativeDiscount");
+ $absolute_discount=$societe->getCurrentDiscount();
+ print '. ';
+ if ($absolute_discount) print $langs->trans("CompanyHasAbsoluteDiscount",$absolute_discount,$langs->trans("Currency".$conf->monnaie));
+ else print $langs->trans("CompanyHasNoAbsoluteDiscount");
+ print '.';
+ print ' ';
+
// Date
print ''.$langs->trans('Date').' ';
print dolibarr_print_date($propal->date,'%a %d %B %Y');
diff --git a/htdocs/compta/propal.php b/htdocs/compta/propal.php
index 105c73b2b70..f535d5daf6b 100644
--- a/htdocs/compta/propal.php
+++ b/htdocs/compta/propal.php
@@ -30,6 +30,7 @@
require("./pre.inc.php");
require_once(DOL_DOCUMENT_ROOT."/propal.class.php");
+require_once(DOL_DOCUMENT_ROOT."/lib/propal.lib.php");
require_once(DOL_DOCUMENT_ROOT."/lib/CMailFile.class.php");
if ($conf->projet->enabled) require_once(DOL_DOCUMENT_ROOT.'/project.class.php');
if ($conf->commande->enabled) require_once(DOL_DOCUMENT_ROOT.'/commande/commande.class.php');
@@ -121,37 +122,9 @@ if ($_GET["propalid"] > 0)
$propal = new Propal($db);
$propal->fetch($_GET["propalid"]);
- $h=0;
- $head[$h][0] = DOL_URL_ROOT.'/comm/propal.php?propalid='.$propal->id;
- $head[$h][1] = $langs->trans('CommercialCard');
- $h++;
-
- $head[$h][0] = DOL_URL_ROOT.'/compta/propal.php?propalid='.$propal->id;
- $head[$h][1] = $langs->trans('AccountancyCard');
- $hselected=$h;
- $h++;
-
- if ($conf->use_preview_tabs)
- {
- $head[$h][0] = DOL_URL_ROOT.'/comm/propal/apercu.php?propalid='.$propal->id;
- $head[$h][1] = $langs->trans("Preview");
- $h++;
- }
-
- $head[$h][0] = DOL_URL_ROOT.'/comm/propal/note.php?propalid='.$propal->id;
- $head[$h][1] = $langs->trans('Note');
- $h++;
-
- $head[$h][0] = DOL_URL_ROOT.'/comm/propal/info.php?propalid='.$propal->id;
- $head[$h][1] = $langs->trans('Info');
- $h++;
-
- $head[$h][0] = DOL_URL_ROOT.'/comm/propal/document.php?propalid='.$propal->id;
- $head[$h][1] = $langs->trans('Documents');
- $h++;
-
- dolibarr_fiche_head($head, $hselected, $langs->trans('Proposal'));
+ $head = propal_prepare_head($propal);
+ dolibarr_fiche_head($head, 'compta', $langs->trans('Proposal'));
/*
@@ -182,17 +155,7 @@ if ($_GET["propalid"] > 0)
$rowspan=9;
// Société
- print ' '.$langs->trans('Company').' ';
- if ($societe->client == 1)
- {
- $url ='fiche.php?socid='.$societe->id;
- }
- else
- {
- $url = DOL_URL_ROOT.'/comm/prospect/fiche.php?socid='.$societe->id;
- }
- print ''.$societe->nom.' ';
- print ' ';
+ print ''.$langs->trans('Company').' '.$societe->getNomUrl(1).' ';
// Ligne info remises tiers
print ''.$langs->trans('Discounts').' ';
diff --git a/htdocs/html.form.class.php b/htdocs/html.form.class.php
index 1d56818a263..0865827c189 100644
--- a/htdocs/html.form.class.php
+++ b/htdocs/html.form.class.php
@@ -450,13 +450,13 @@ class Form
}
- /**
- * \brief Retourne la liste déroulante des sociétés
- * \param selected Societe présélectionnée
- * \param htmlname Nom champ formulaire
- * \param filter Criteres optionnels de filtre
- */
- function select_societes($selected='',$htmlname='soc_id',$filter='')
+ /**
+ * \brief Retourne la liste déroulante des sociétés
+ * \param selected Societe présélectionnée
+ * \param htmlname Nom champ formulaire
+ * \param filter Criteres optionnels de filtre
+ */
+ function select_societes($selected='',$htmlname='soc_id',$filter='')
{
// On recherche les societes
$sql = "SELECT s.idp, s.nom FROM";
@@ -494,6 +494,54 @@ class Form
}
+ /**
+ * \brief Retourne la liste déroulante des remises fixes
+ * \param selected Id remise fixe présélectionnée
+ * \param htmlname Nom champ formulaire
+ * \param filter Criteres optionnels de filtre
+ */
+ function select_remises($selected='',$htmlname='remise_id',$filter='',$socid)
+ {
+ global $langs,$conf;
+
+ // On recherche les societes
+ $sql = "SELECT re.rowid, re.amount_ht as amount, re.description FROM";
+ $sql.= " ".MAIN_DB_PREFIX ."societe_remise_except as re";
+ $sql.= " WHERE fk_soc = ".$socid;
+ if ($filter) $sql.= " AND $filter";
+ $sql.= " ORDER BY re.description ASC";
+
+ $resql=$this->db->query($sql);
+ if ($resql)
+ {
+ print '';
+ $num = $this->db->num_rows($resql);
+ $i = 0;
+ if ($num)
+ {
+ print ' ';
+ while ($i < $num)
+ {
+ $obj = $this->db->fetch_object($resql);
+ if ($selected > 0 && $selected == $obj->rowid)
+ {
+ print ''.dolibarr_trunc($obj->description,40).' ('.$obj->amount.' '.$langs->trans("Currency".$conf->monnaie).')'.' ';
+ }
+ else
+ {
+ print ''.dolibarr_trunc($obj->description,40).' ('.$obj->amount.' '.$langs->trans("Currency".$conf->monnaie).')'.' ';
+ }
+ $i++;
+ }
+ }
+ print ' ';
+ }
+ else {
+ dolibarr_print_error($this->db);
+ }
+ }
+
+
/**
* \brief Retourne la liste déroulante des contacts d'une société donnée
* \param socid Id de la société
@@ -1588,23 +1636,24 @@ class Form
/**
- * \brief Affiche formulaire de selection de la remise avoir
+ * \brief Affiche formulaire de selection de la remise fixe
* \param page Page
* \param selected Valeur à appliquer
* \param htmlname Nom du formulaire select. Si none, non modifiable
*/
- function form_remise($page, $selected='', $htmlname='remise')
+ function form_remise_dispo($page, $selected='', $htmlname='remise_id',$socid)
{
global $langs;
if ($htmlname != "none")
{
print '';
- print ' ';
- print '';
+ print ' ';
+ print '';
}
else
diff --git a/htdocs/langs/en_US/companies.lang b/htdocs/langs/en_US/companies.lang
index 7084683fdd4..3948516cc05 100644
--- a/htdocs/langs/en_US/companies.lang
+++ b/htdocs/langs/en_US/companies.lang
@@ -82,6 +82,8 @@ CompanyHasAbsoluteDiscount=This customer has a %s %s discount credit
CompanyHasNoAbsoluteDiscount=This customer has no discount credit available
CustomerAbsoluteDiscountAllUsers=Absolute discounts (granted by all users)
CustomerAbsoluteDiscountMy=Absolute discounts (granted by yourself)
+DefaultDiscount=Default discount
+AvailableGlobalDiscounts=Absolute discounts available
DiscountNone=None
Supplier=Supplier
CompanyList=Companies' list
diff --git a/htdocs/langs/fr_FR/companies.lang b/htdocs/langs/fr_FR/companies.lang
index e117d557be6..992e2918a0b 100644
--- a/htdocs/langs/fr_FR/companies.lang
+++ b/htdocs/langs/fr_FR/companies.lang
@@ -83,6 +83,7 @@ CompanyHasNoAbsoluteDiscount=Ce client n'a pas ou plus de remises fixes disponib
CustomerAbsoluteDiscountAllUsers=Remises fixes en cours (accordées par tout utilisateur)
CustomerAbsoluteDiscountMy=Remises fixes en cours (accordées personnellement)
DefaultDiscount=Remise par défaut
+AvailableGlobalDiscounts=Remises fixes disponibles
DiscountNone=Aucune
Supplier=Fournisseur
CompanyList=Liste des sociétés
diff --git a/htdocs/lib/functions.inc.php b/htdocs/lib/functions.inc.php
index 2425fe7a81d..084c6723355 100644
--- a/htdocs/lib/functions.inc.php
+++ b/htdocs/lib/functions.inc.php
@@ -532,6 +532,27 @@ function dolibarr_trunc($string,$size=40)
return $string;
}
+/**
+ \brief Complète une chaine à une taille donnée par des espaces
+ \param string Chaine à compléter
+ \param size Longueur de la chaine.
+ \param side 0=Complétion à droite, 1=Complétion à gauche
+ \param char Chaine de complétion
+ \return string Chaine complétée
+*/
+function dolibarr_pad($string,$size,$side,$char=' ')
+{
+ $taille=sizeof($string);
+ $i=0;
+ while($i < ($size - $taille))
+ {
+ if ($side > 0) $string.=$char;
+ else $string=$char.$string;
+ $i++;
+ }
+ return $string;
+}
+
/**
\brief Affiche picto propre à une notion/module (fonction générique)
\param alt Texte sur le alt de l'image