New: Some changes to support the type of line in entities.
This commit is contained in:
parent
8a12e715dd
commit
681a787fea
@ -873,7 +873,7 @@ if ($_GET['action'] == 'down' && $user->rights->propale->creer)
|
||||
|
||||
|
||||
/*
|
||||
* Affichage page
|
||||
* View
|
||||
*/
|
||||
|
||||
llxHeader('',$langs->trans('Proposal'),'Proposition');
|
||||
@ -1235,6 +1235,9 @@ if ($id > 0 || ! empty($ref))
|
||||
$sql = 'SELECT pt.rowid, pt.description, pt.fk_product, pt.fk_remise_except,';
|
||||
$sql.= ' pt.qty, pt.tva_tx, pt.remise_percent, pt.subprice, pt.info_bits,';
|
||||
$sql.= ' pt.total_ht, pt.total_tva, pt.total_ttc, pt.marge_tx, pt.marque_tx, pt.pa_ht, pt.special_code,';
|
||||
$sql.= ' '.$db->pdate('pt.date_start').' as date_start,';
|
||||
$sql.= ' '.$db->pdate('pt.date_end').' as date_end,';
|
||||
$sql.= ' pt.product_type,';
|
||||
$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';
|
||||
@ -1269,6 +1272,13 @@ if ($id > 0 || ! empty($ref))
|
||||
$objp = $db->fetch_object($resql);
|
||||
$var=!$var;
|
||||
|
||||
// Show product and description
|
||||
$type=$objp->product_type?$objp->product_type:$objp->fk_product_type;
|
||||
// Try to enhance type detection using date_start and date_end for free lines where type
|
||||
// was not saved.
|
||||
if (! empty($objp->date_start)) $type=1;
|
||||
if (! empty($objp->date_end)) $type=1;
|
||||
|
||||
// Ligne en mode visu
|
||||
if ($_GET['action'] != 'editline' || $_GET['lineid'] != $objp->rowid)
|
||||
{
|
||||
@ -1562,7 +1572,7 @@ if ($id > 0 || ! empty($ref))
|
||||
}
|
||||
|
||||
/*
|
||||
* Ajouter une ligne
|
||||
* Form to add new line
|
||||
*/
|
||||
if ($propal->statut == 0 && $user->rights->propale->creer && $_GET["action"] <> 'editline')
|
||||
{
|
||||
@ -1570,7 +1580,7 @@ if ($id > 0 || ! empty($ref))
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td '.$colspan.'>';
|
||||
print '<a name="add"></a>'; // ancre
|
||||
print $langs->trans('Description').'</td>';
|
||||
print $langs->trans('AddNewLine').' - '.$langs->trans("FreeZone").'</td>';
|
||||
print '<td align="right">'.$langs->trans('VAT').'</td>';
|
||||
print '<td align="right">'.$langs->trans('PriceUHT').'</td>';
|
||||
print '<td align="right">'.$langs->trans('Qty').'</td>';
|
||||
@ -1578,16 +1588,18 @@ if ($id > 0 || ! empty($ref))
|
||||
print '<td colspan="4"> </td>';
|
||||
print "</tr>\n";
|
||||
|
||||
// Ajout produit produits/services personnalises
|
||||
// Add free products/services form
|
||||
print '<form action="'.$_SERVER["PHP_SELF"].'?propalid='.$propal->id.'#add" method="post">';
|
||||
print '<input type="hidden" name="propalid" value="'.$propal->id.'">';
|
||||
print '<input type="hidden" name="action" value="addligne">';
|
||||
|
||||
$var=true;
|
||||
|
||||
print '<tr '.$bc[$var].">\n";
|
||||
print '<td '.$colspan.'>';
|
||||
// editeur wysiwyg
|
||||
|
||||
print $html->select_type_of_lines(-1,'type',1).'<br>';
|
||||
|
||||
// Editor wysiwyg
|
||||
if ($conf->fckeditor->enabled && $conf->global->FCKEDITOR_ENABLE_DETAILS)
|
||||
{
|
||||
require_once(DOL_DOCUMENT_ROOT."/lib/doleditor.class.php");
|
||||
@ -1599,15 +1611,11 @@ if ($id > 0 || ! empty($ref))
|
||||
print '<textarea class="flat" cols="70" name="dp_desc" rows="'.ROWS_2.'"></textarea>';
|
||||
}
|
||||
print '</td>';
|
||||
print '<td align="center">';
|
||||
if($societe->tva_assuj == "0")
|
||||
{
|
||||
print '<input type="hidden" name="np_tva_tx" value="0">0';
|
||||
}
|
||||
else
|
||||
{
|
||||
$html->select_tva('np_tva_tx', $conf->defaulttx, $mysoc, $societe);
|
||||
}
|
||||
print '<td align="right">';
|
||||
//if ($societe->tva_assuj == "0")
|
||||
//print '<input type="hidden" name="np_tva_tx" value="0">0';
|
||||
//else
|
||||
$html->select_tva('np_tva_tx', $conf->defaulttx, $mysoc, $societe);
|
||||
print "</td>\n";
|
||||
print '<td align="right"><input type="text" size="5" name="np_price"></td>';
|
||||
print '<td align="right"><input type="text" size="2" value="1" name="qty"></td>';
|
||||
@ -1618,7 +1626,7 @@ if ($id > 0 || ! empty($ref))
|
||||
print '</form>';
|
||||
|
||||
// Ajout de produits/services predefinis
|
||||
if ($conf->produit->enabled)
|
||||
if ($conf->produit->enabled || $conf->service->enabled)
|
||||
{
|
||||
if ($conf->global->PRODUIT_USE_MARKUP)
|
||||
{
|
||||
@ -1630,6 +1638,7 @@ if ($id > 0 || ! empty($ref))
|
||||
}
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td '.$colspan.'>';
|
||||
print $langs->trans("AddNewLine").' - ';
|
||||
if ($conf->service->enabled)
|
||||
{
|
||||
print $langs->trans('RecordedProductsAndServices');
|
||||
@ -1662,7 +1671,7 @@ if ($id > 0 || ! empty($ref))
|
||||
}
|
||||
if (! $conf->global->PRODUIT_USE_SEARCH_TO_SELECT) print '<br>';
|
||||
|
||||
// editeur wysiwyg
|
||||
// Editor wysiwyg
|
||||
if ($conf->fckeditor->enabled && $conf->global->FCKEDITOR_ENABLE_DETAILS)
|
||||
{
|
||||
require_once(DOL_DOCUMENT_ROOT."/lib/doleditor.class.php");
|
||||
|
||||
@ -1665,14 +1665,14 @@ else
|
||||
}
|
||||
|
||||
/*
|
||||
* Ajouter une ligne
|
||||
* Form to add new line
|
||||
*/
|
||||
if ($commande->statut == 0 && $user->rights->commande->creer && $_GET["action"] <> 'editline')
|
||||
{
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td>';
|
||||
print '<a name="add"></a>'; // ancre
|
||||
print $langs->trans('Description').'</td>';
|
||||
print $langs->trans('AddNewLine').' - '.$langs->trans("FreeZone").'</td>';
|
||||
print '<td align="right">'.$langs->trans('VAT').'</td>';
|
||||
print '<td align="right">'.$langs->trans('PriceUHT').'</td>';
|
||||
print '<td align="right">'.$langs->trans('Qty').'</td>';
|
||||
@ -1680,7 +1680,7 @@ else
|
||||
print '<td colspan="4"> </td>';
|
||||
print '</tr>';
|
||||
|
||||
// Ajout produit produits/services personnalises
|
||||
// Add free products/services form
|
||||
print '<form action="fiche.php?id='.$id.'#add" method="post">';
|
||||
print '<input type="hidden" name="id" value="'.$id.'">';
|
||||
print '<input type="hidden" name="action" value="addligne">';
|
||||
@ -1688,7 +1688,10 @@ else
|
||||
$var=true;
|
||||
print '<tr '.$bc[$var].'>';
|
||||
print '<td>';
|
||||
// editeur wysiwyg
|
||||
|
||||
print $html->select_type_of_lines(-1,'type',1).'<br>';
|
||||
|
||||
// Editor wysiwyg
|
||||
if ($conf->fckeditor->enabled && $conf->global->FCKEDITOR_ENABLE_DETAILS)
|
||||
{
|
||||
require_once(DOL_DOCUMENT_ROOT."/lib/doleditor.class.php");
|
||||
@ -1700,10 +1703,10 @@ else
|
||||
print '<textarea class="flat" cols="70" name="dp_desc" rows="'.ROWS_2.'"></textarea>';
|
||||
}
|
||||
print '</td>';
|
||||
print '<td align="center">';
|
||||
if($soc->tva_assuj == "0")
|
||||
print '<input type="hidden" name="tva_tx" value="0">0';
|
||||
else
|
||||
print '<td align="right">';
|
||||
//if($soc->tva_assuj == "0")
|
||||
//print '<input type="hidden" name="tva_tx" value="0">0';
|
||||
//else
|
||||
print $html->select_tva('tva_tx',$conf->defaulttx,$mysoc,$soc);
|
||||
print '</td>';
|
||||
print '<td align="right"><input type="text" name="pu" size="5"></td>';
|
||||
@ -1727,10 +1730,11 @@ else
|
||||
print '</form>';
|
||||
|
||||
// Ajout de produits/services predefinis
|
||||
if ($conf->produit->enabled)
|
||||
if ($conf->produit->enabled || $conf->service->enabled)
|
||||
{
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td colspan="3">';
|
||||
print $langs->trans("AddNewLine").' - ';
|
||||
if ($conf->service->enabled)
|
||||
{
|
||||
print $langs->trans('RecordedProductsAndServices');
|
||||
@ -1764,7 +1768,7 @@ else
|
||||
|
||||
if (! $conf->global->PRODUIT_USE_SEARCH_TO_SELECT) print '<br>';
|
||||
|
||||
// editeur wysiwyg
|
||||
// Editor wysiwyg
|
||||
if ($conf->fckeditor->enabled && $conf->global->FCKEDITOR_ENABLE_DETAILS)
|
||||
{
|
||||
require_once(DOL_DOCUMENT_ROOT."/lib/doleditor.class.php");
|
||||
|
||||
@ -2977,10 +2977,11 @@ else
|
||||
*/
|
||||
if ($fac->statut == 0 && $user->rights->facture->creer && $_GET['action'] <> 'valid' && $_GET['action'] <> 'editline')
|
||||
{
|
||||
// Free zone form
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td>';
|
||||
print '<a name="add"></a>'; // ancre
|
||||
print $langs->trans('AddNewLine').'</td>';
|
||||
print $langs->trans('AddNewLine').' - '.$langs->trans("FreeZone").'</td>';
|
||||
print '<td align="right">'.$langs->trans('VAT').'</td>';
|
||||
print '<td align="right">'.$langs->trans('PriceUHT').'</td>';
|
||||
print '<td align="right">'.$langs->trans('Qty').'</td>';
|
||||
@ -2997,9 +2998,9 @@ else
|
||||
print '<tr '.$bc[$var].'>';
|
||||
print '<td>';
|
||||
|
||||
print $html->select_type_of_lines(-1,'type',1);
|
||||
print $html->select_type_of_lines(-1,'type',1).'<br>';
|
||||
|
||||
// Editeur wysiwyg
|
||||
// Editor wysiwyg
|
||||
if ($conf->fckeditor->enabled && $conf->global->FCKEDITOR_ENABLE_DETAILS)
|
||||
{
|
||||
require_once(DOL_DOCUMENT_ROOT."/lib/doleditor.class.php");
|
||||
@ -3012,6 +3013,9 @@ else
|
||||
}
|
||||
print '</td>';
|
||||
print '<td align="right">';
|
||||
//if($soc->tva_assuj == "0")
|
||||
//print '<input type="hidden" name="tva_tx" value="0">0';
|
||||
//else
|
||||
$html->select_tva('tva_tx',$conf->defaulttx,$mysoc,$soc);
|
||||
print '</td>';
|
||||
print '<td align="right"><input type="text" name="pu" size="6"></td>';
|
||||
@ -3031,8 +3035,9 @@ else
|
||||
}
|
||||
print '</form>';
|
||||
|
||||
// Add predefined services/products form
|
||||
if ($conf->produit->enabled)
|
||||
|
||||
// Predefined services/products form
|
||||
if ($conf->produit->enabled || $conf->service->enabled)
|
||||
{
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td colspan="3">';
|
||||
@ -3070,7 +3075,7 @@ else
|
||||
|
||||
if (! $conf->global->PRODUIT_USE_SEARCH_TO_SELECT) print '<br>';
|
||||
|
||||
// éditeur wysiwyg
|
||||
// Editor wysiwyg
|
||||
if ($conf->fckeditor->enabled && $conf->global->FCKEDITOR_ENABLE_DETAILS)
|
||||
{
|
||||
require_once(DOL_DOCUMENT_ROOT."/lib/doleditor.class.php");
|
||||
|
||||
@ -127,7 +127,7 @@ class Facture extends CommonObject
|
||||
|
||||
/**
|
||||
* \brief Create invoice in database
|
||||
* \param user Object uset that create
|
||||
* \param user Object user that create
|
||||
* \param notrigger 1 ne declenche pas les triggers, 0 sinon
|
||||
* \return int <0 si ko, >0 si ok
|
||||
*/
|
||||
@ -243,23 +243,17 @@ class Facture extends CommonObject
|
||||
}
|
||||
|
||||
/*
|
||||
* Insertion du detail des produits dans la base,
|
||||
* si tableau products défini.
|
||||
* Insert lines of invoices in database
|
||||
*/
|
||||
for ($i = 0 ; $i < sizeof($this->products) ; $i++)
|
||||
for ($i = 0 ; $i < sizeof($this->lignes) ; $i++)
|
||||
{
|
||||
$result = $this->addline(
|
||||
$this->id,
|
||||
$this->products[$i]->desc,
|
||||
$this->products[$i]->subprice,
|
||||
$this->products[$i]->qty,
|
||||
$this->products[$i]->tva_tx,
|
||||
$this->products[$i]->fk_product,
|
||||
$this->products[$i]->remise_percent,
|
||||
$this->products[$i]->date_start,
|
||||
$this->products[$i]->date_end
|
||||
);
|
||||
|
||||
$newinvoiceline=new FactureLigne($this->db);
|
||||
$newinvoiceline=$this->lignes[$i];
|
||||
$newinvoiceline->fk_facture=$this->id;
|
||||
if ($result >= 0 && ($newinvoiceline->info_bits & 0x01) == 0) // We keep only lines with first bit = 0
|
||||
{
|
||||
$result=$newinvoiceline->insert();
|
||||
}
|
||||
if ($result < 0)
|
||||
{
|
||||
$error++;
|
||||
@ -362,6 +356,7 @@ class Facture extends CommonObject
|
||||
$facture->amount = $this->amount;
|
||||
$facture->remise_absolue = $this->remise_absolue;
|
||||
$facture->remise_percent = $this->remise_percent;
|
||||
|
||||
$facture->lignes = $this->lignes; // Tableau des lignes de factures
|
||||
$facture->products = $this->lignes; // Tant que products encore utilisé
|
||||
|
||||
@ -608,12 +603,12 @@ class Facture extends CommonObject
|
||||
|
||||
|
||||
/**
|
||||
\brief Recupére les lignes de factures dans this->lignes
|
||||
\return int 1 si ok, < 0 si erreur
|
||||
*/
|
||||
* \brief Recupére les lignes de factures dans this->lignes
|
||||
* \return int 1 si ok, < 0 si erreur
|
||||
*/
|
||||
function fetch_lines()
|
||||
{
|
||||
$sql = 'SELECT l.rowid, l.fk_product, l.description, l.price, l.qty, l.tva_taux, ';
|
||||
$sql = 'SELECT l.rowid, l.fk_product, l.description, l.product_type, l.price, l.qty, l.tva_taux, ';
|
||||
$sql.= ' l.remise, l.remise_percent, l.fk_remise_except, l.subprice,';
|
||||
$sql.= ' '.$this->db->pdate('l.date_start').' as date_start,'.$this->db->pdate('l.date_end').' as date_end,';
|
||||
$sql.= ' l.info_bits, l.total_ht, l.total_tva, l.total_ttc, l.fk_code_ventilation, l.fk_export_compta,';
|
||||
@ -638,7 +633,7 @@ class Facture extends CommonObject
|
||||
$faclig->desc = $objp->description; // Description ligne
|
||||
$faclig->libelle = $objp->label; // Label produit
|
||||
$faclig->product_desc = $objp->product_desc; // Description produit
|
||||
$faclig->product_type = $objp->fk_product_type;
|
||||
$faclig->product_type = $objp->product_type; // Type of line
|
||||
$faclig->qty = $objp->qty;
|
||||
$faclig->subprice = $objp->subprice;
|
||||
$faclig->tva_tx = $objp->tva_taux;
|
||||
@ -646,6 +641,7 @@ class Facture extends CommonObject
|
||||
$faclig->fk_remise_except = $objp->fk_remise_except;
|
||||
$faclig->produit_id = $objp->fk_product;
|
||||
$faclig->fk_product = $objp->fk_product;
|
||||
$faclig->fk_product_type = $objp->fk_product_type;
|
||||
$faclig->date_start = $objp->date_start;
|
||||
$faclig->date_end = $objp->date_end;
|
||||
$faclig->date_start = $objp->date_start;
|
||||
|
||||
@ -501,6 +501,7 @@ Informations=Informations
|
||||
Page=Page
|
||||
Notes=Notes
|
||||
AddNewLine=Add new line
|
||||
FreeZone=Free text
|
||||
# Week day
|
||||
Day1=Monday
|
||||
Day2=Tuesday
|
||||
|
||||
@ -500,6 +500,7 @@ Informations=Informations
|
||||
Page=Page
|
||||
Notes=Notes
|
||||
AddNewLine=Ajout nouvelle ligne
|
||||
FreeZone=Zone libre
|
||||
# Week day
|
||||
Day1=Lundi
|
||||
Day2=Mardi
|
||||
|
||||
@ -86,6 +86,15 @@ drop table llx_don_projet;
|
||||
alter table llx_facture_fourn_det add column date_start datetime DEFAULT NULL;
|
||||
alter table llx_facture_fourn_det add column date_end datetime DEFAULT NULL;
|
||||
|
||||
alter table llx_commandedet add column product_type integer DEFAULT 0 after total_ttc;
|
||||
|
||||
alter table llx_propaldet add column product_type integer DEFAULT 0 after total_ttc;
|
||||
alter table llx_propaldet add column date_start datetime DEFAULT NULL after product_type;
|
||||
alter table llx_propaldet add column date_end datetime DEFAULT NULL after date_start;
|
||||
|
||||
alter table llx_commande_fournisseur add column product_type integer DEFAULT 0 after total_ttc;
|
||||
alter table llx_commande_fournisseur add column date_start datetime DEFAULT NULL after product_type;
|
||||
alter table llx_commande_fournisseur add column date_end datetime DEFAULT NULL after date_start;
|
||||
|
||||
-- V4.1 delete from llx_projet_task where fk_projet not in (select rowid from llx_projet);
|
||||
-- V4.1 ALTER TABLE llx_projet_task ADD CONSTRAINT fk_projet_task_fk_projet FOREIGN KEY (fk_projet) REFERENCES llx_projet (rowid);
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
-- ===================================================================
|
||||
-- Copyright (C) 2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
-- Copyright (C) 2007 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
-- Copyright (C) 2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
-- Copyright (C) 2007-2009 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
--
|
||||
-- This program is free software; you can redistribute it and/or modify
|
||||
-- it under the terms of the GNU General Public License as published by
|
||||
@ -35,5 +35,8 @@ create table llx_commande_fournisseurdet
|
||||
total_ht double(24,8) DEFAULT 0, -- Total HT de la ligne toute quantité et incluant remise ligne et globale
|
||||
total_tva double(24,8) DEFAULT 0, -- Total TVA de la ligne toute quantité et incluant remise ligne et globale
|
||||
total_ttc double(24,8) DEFAULT 0, -- Total TTC de la ligne toute quantité et incluant remise ligne et globale
|
||||
product_type integer DEFAULT 0,
|
||||
date_start datetime DEFAULT NULL, -- date debut si service
|
||||
date_end datetime DEFAULT NULL, -- date fin si service
|
||||
info_bits integer DEFAULT 0 -- TVA NPR ou non
|
||||
)type=innodb;
|
||||
|
||||
@ -35,6 +35,7 @@ create table llx_commandedet
|
||||
total_ht double(24,8) DEFAULT 0, -- Total HT de la ligne toute quantité et incluant remise ligne et globale
|
||||
total_tva double(24,8) DEFAULT 0, -- Total TVA de la ligne toute quantité et incluant remise ligne et globale
|
||||
total_ttc double(24,8) DEFAULT 0, -- Total TTC de la ligne toute quantité et incluant remise ligne et globale
|
||||
product_type integer DEFAULT 0,
|
||||
date_start datetime DEFAULT NULL, -- date debut si service
|
||||
date_end datetime DEFAULT NULL, -- date fin si service
|
||||
info_bits integer DEFAULT 0, -- TVA NPR ou non
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
-- ===================================================================
|
||||
-- Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
-- Copyright (C) 2009 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
--
|
||||
-- This program is free software; you can redistribute it and/or modify
|
||||
-- it under the terms of the GNU General Public License as published by
|
||||
|
||||
@ -26,7 +26,7 @@ create table llx_propaldet
|
||||
description text,
|
||||
fk_remise_except integer NULL, -- Lien vers table des remises fixes
|
||||
tva_tx double(6,3) DEFAULT 0, -- taux tva
|
||||
qty real, -- quantité
|
||||
qty real, -- quantity
|
||||
remise_percent real DEFAULT 0, -- pourcentage de remise
|
||||
remise real DEFAULT 0, -- montant de la remise (obsolete)
|
||||
price real, -- prix final (obsolete)
|
||||
@ -34,10 +34,15 @@ create table llx_propaldet
|
||||
total_ht double(24,8) DEFAULT 0, -- Total HT de la ligne toute quantité et incluant remise ligne et globale
|
||||
total_tva double(24,8) DEFAULT 0, -- Total TVA de la ligne toute quantité et incluant remise ligne et globale
|
||||
total_ttc double(24,8) DEFAULT 0, -- Total TTC de la ligne toute quantité et incluant remise ligne et globale
|
||||
product_type integer DEFAULT 0,
|
||||
date_start datetime DEFAULT NULL, -- date debut si service
|
||||
date_end datetime DEFAULT NULL, -- date fin si service
|
||||
info_bits integer DEFAULT 0, -- TVA NPR ou non
|
||||
|
||||
pa_ht double(24,8) DEFAULT 0, -- prix d'achat HT
|
||||
marge_tx double(6,3) DEFAULT 0, -- taux de marge (marge sur prix d'achat)
|
||||
marque_tx double(6,3) DEFAULT 0, -- taux de marque (marge sur prix de vente)
|
||||
|
||||
special_code tinyint(4) UNSIGNED DEFAULT 0, -- code pour les lignes speciales
|
||||
rang integer DEFAULT 0 -- ordre affichage sur la propal
|
||||
)type=innodb;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user