New: add vat rate in supplier price
New: add events system in jquery combobox
This commit is contained in:
parent
d296f17f36
commit
e8ec5f5ad7
55
htdocs/core/ajax/vatrates.php
Normal file
55
htdocs/core/ajax/vatrates.php
Normal file
@ -0,0 +1,55 @@
|
||||
<?php
|
||||
/* Copyright (C) 2012 Regis Houssin <regis@dolibarr.fr>
|
||||
*
|
||||
* 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
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/core/ajax/vatrates.php
|
||||
* \brief File to load vat rates combobox
|
||||
*/
|
||||
|
||||
if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL','1'); // Disables token renewal
|
||||
if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU','1');
|
||||
//if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML','1');
|
||||
if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX','1');
|
||||
//if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC','1');
|
||||
//if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN','1');
|
||||
|
||||
require('../../main.inc.php');
|
||||
|
||||
$id = GETPOST('id','int');
|
||||
$action = GETPOST('action','alpha');
|
||||
$htmlname = GETPOST('htmlname','alpha');
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
|
||||
top_httphead();
|
||||
|
||||
//print '<!-- Ajax page called with url '.$_SERVER["PHP_SELF"].'?'.$_SERVER["QUERY_STRING"].' -->'."\n";
|
||||
|
||||
// Load original field value
|
||||
if (! empty($id) && ! empty($action) && ! empty($htmlname))
|
||||
{
|
||||
$form = new Form($db);
|
||||
$soc = new Societe($db);
|
||||
|
||||
$soc->fetch($id);
|
||||
|
||||
echo $form->load_tva('tva_tx','',$soc,$mysoc,0,0,'',true);
|
||||
}
|
||||
|
||||
?>
|
||||
@ -640,9 +640,10 @@ class Form
|
||||
* @param int $showempty Add an empty field
|
||||
* @param int $showtype Show third party type in combolist (customer, prospect or supplier)
|
||||
* @param int $forcecombo Force to use combo box
|
||||
@param array $event Event options
|
||||
* @return string HTML string with
|
||||
*/
|
||||
function select_company($selected='',$htmlname='socid',$filter='',$showempty=0, $showtype=0, $forcecombo=0)
|
||||
function select_company($selected='',$htmlname='socid',$filter='',$showempty=0, $showtype=0, $forcecombo=0, $event=array())
|
||||
{
|
||||
global $conf,$user,$langs;
|
||||
|
||||
@ -665,7 +666,7 @@ class Form
|
||||
{
|
||||
//$minLength = (is_numeric($conf->global->COMPANY_USE_SEARCH_TO_SELECT)?$conf->global->COMPANY_USE_SEARCH_TO_SELECT:2);
|
||||
|
||||
$out.= ajax_combobox($htmlname);
|
||||
$out.= ajax_combobox($htmlname, $event);
|
||||
}
|
||||
|
||||
$out.= '<select id="'.$htmlname.'" class="flat" name="'.$htmlname.'">';
|
||||
@ -2890,9 +2891,10 @@ class Form
|
||||
* Si (vendeur et acheteur dans Communaute europeenne) et bien vendu = moyen de transports neuf (auto, bateau, avion), TVA par defaut=0 (La TVA doit etre paye par l'acheteur au centre d'impots de son pays et non au vendeur). Fin de regle.
|
||||
* Si (vendeur et acheteur dans Communaute europeenne) et bien vendu autre que transport neuf alors la TVA par defaut=TVA du produit vendu. Fin de regle.
|
||||
* Sinon la TVA proposee par defaut=0. Fin de regle.
|
||||
* @param bool $options_only Return options only (for ajax treatment)
|
||||
* @return void
|
||||
*/
|
||||
function load_tva($htmlname='tauxtva', $selectedrate='', $societe_vendeuse='', $societe_acheteuse='', $idprod=0, $info_bits=0, $type='')
|
||||
function load_tva($htmlname='tauxtva', $selectedrate='', $societe_vendeuse='', $societe_acheteuse='', $idprod=0, $info_bits=0, $type='', $options_only=false)
|
||||
{
|
||||
global $langs,$conf,$mysoc;
|
||||
|
||||
@ -2981,7 +2983,7 @@ class Form
|
||||
$defaulttx = $this->cache_vatrates[$num-1]['txtva'];
|
||||
}
|
||||
|
||||
$return.= '<select class="flat" id="'.$htmlname.'" name="'.$htmlname.'">';
|
||||
if (! $options_only) $return.= '<select class="flat" id="'.$htmlname.'" name="'.$htmlname.'">';
|
||||
|
||||
foreach ($this->cache_vatrates as $rate)
|
||||
{
|
||||
@ -3001,7 +3003,7 @@ class Form
|
||||
$this->tva_taux_npr[] = $rate['nprtva'];
|
||||
}
|
||||
|
||||
$return.= '</select>';
|
||||
if (! $options_only) $return.= '</select>';
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@ -202,17 +202,41 @@ function ajax_dialog($title,$message,$w=350,$h=150)
|
||||
* Convert a select html field into an ajax combobox
|
||||
*
|
||||
* @param string $htmlname Name of html field
|
||||
* @param array $event Event options
|
||||
* @return string Return html string to convert a select field into a combo
|
||||
*/
|
||||
function ajax_combobox($htmlname)
|
||||
function ajax_combobox($htmlname, $event=array())
|
||||
{
|
||||
$msg.= '<script type="text/javascript">
|
||||
$(function() {
|
||||
$("#'.$htmlname.'" ).combobox();
|
||||
});
|
||||
</script>';
|
||||
|
||||
$msg.= "\n";
|
||||
$("#'.$htmlname.'").combobox({
|
||||
selected : function(event,ui) {
|
||||
var obj = '.json_encode($event).';
|
||||
$.each(obj, function(key,values) {
|
||||
if (values.method.length) {
|
||||
getMethod(values);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
function getMethod(obj) {
|
||||
var id = $("#'.$htmlname.'").val();
|
||||
var method = obj.method;
|
||||
var url = obj.url;
|
||||
var htmlname = obj.htmlname;
|
||||
$.get(url,
|
||||
{
|
||||
action: method,
|
||||
id: id,
|
||||
htmlname: htmlname
|
||||
},
|
||||
function(response) {
|
||||
$("select#" + htmlname).html(response);
|
||||
});
|
||||
}
|
||||
});';
|
||||
$msg.= "</script>\n";
|
||||
|
||||
return $msg;
|
||||
}
|
||||
|
||||
@ -139,9 +139,10 @@ class ProductFournisseur extends Product
|
||||
* @param Societe $fourn Supplier
|
||||
* @param int $availability Product availability
|
||||
* @param string $ref_fourn Supplier ref
|
||||
* @param float $tva_tx VAT rate
|
||||
* @return int >0 if KO, >0 if OK
|
||||
*/
|
||||
function update_buyprice($qty, $buyprice, $user, $price_base_type, $fourn, $availability, $ref_fourn)
|
||||
function update_buyprice($qty, $buyprice, $user, $price_base_type, $fourn, $availability, $ref_fourn, $tva_tx)
|
||||
{
|
||||
global $conf,$mysoc;
|
||||
|
||||
@ -166,8 +167,9 @@ class ProductFournisseur extends Product
|
||||
{
|
||||
if ($price_base_type == 'TTC')
|
||||
{
|
||||
$ttx = get_default_tva($fourn,$mysoc,$this->id);
|
||||
$buyprice = $buyprice/(1+($ttx/100));
|
||||
//$ttx = get_default_tva($fourn,$mysoc,$this->id);
|
||||
//$buyprice = $buyprice/(1+($ttx/100));
|
||||
$buyprice = $buyprice/(1+($tva_tx/100));
|
||||
}
|
||||
$unitBuyPrice = price2num($buyprice/$qty,'MU');
|
||||
|
||||
@ -175,7 +177,7 @@ class ProductFournisseur extends Product
|
||||
|
||||
// Ajoute prix courant du fournisseur pour cette quantite
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."product_fournisseur_price(";
|
||||
$sql.= "datec, fk_product, fk_soc, ref_fourn, fk_user, price, quantity, unitprice, fk_availability, entity)";
|
||||
$sql.= "datec, fk_product, fk_soc, ref_fourn, fk_user, price, quantity, unitprice, tva_tx, fk_availability, entity)";
|
||||
$sql.= " values('".$this->db->idate($now)."',";
|
||||
$sql.= " ".$this->id.",";
|
||||
$sql.= " ".$fourn->id.",";
|
||||
@ -184,6 +186,7 @@ class ProductFournisseur extends Product
|
||||
$sql.= " ".price2num($buyprice).",";
|
||||
$sql.= " ".$qty.",";
|
||||
$sql.= " ".$unitBuyPrice.",";
|
||||
$sql.= " ".$tva_tx.",";
|
||||
$sql.= " ".$availability.",";
|
||||
$sql.= $conf->entity;
|
||||
$sql.=")";
|
||||
@ -279,7 +282,7 @@ class ProductFournisseur extends Product
|
||||
*/
|
||||
function fetch_product_fournisseur_price($rowid)
|
||||
{
|
||||
$sql = "SELECT pfp.rowid, pfp.price, pfp.quantity, pfp.unitprice, pfp.fk_availability,";
|
||||
$sql = "SELECT pfp.rowid, pfp.price, pfp.quantity, pfp.unitprice, pfp.tva_tx, pfp.fk_availability,";
|
||||
$sql.= " pfp.fk_soc, pfp.ref_fourn, pfp.fk_product";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."product_fournisseur_price as pfp";
|
||||
$sql.= " WHERE pfp.rowid = ".$rowid;
|
||||
@ -291,14 +294,15 @@ class ProductFournisseur extends Product
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
if ($obj)
|
||||
{
|
||||
$this->product_fourn_price_id = $rowid;
|
||||
$this->fourn_ref = $obj->ref_fourn;
|
||||
$this->fourn_price = $obj->price;
|
||||
$this->fourn_qty = $obj->quantity;
|
||||
$this->fourn_unitprice = $obj->unitprice;
|
||||
$this->product_id = $obj->fk_product; // deprecated
|
||||
$this->fk_product = $obj->fk_product;
|
||||
$this->fk_availability = $obj->fk_availability;
|
||||
$this->product_fourn_price_id = $rowid;
|
||||
$this->fourn_ref = $obj->ref_fourn;
|
||||
$this->fourn_price = $obj->price;
|
||||
$this->fourn_qty = $obj->quantity;
|
||||
$this->fourn_unitprice = $obj->unitprice;
|
||||
$this->tva_tx = $obj->tva_tx;
|
||||
$this->product_id = $obj->fk_product; // deprecated
|
||||
$this->fk_product = $obj->fk_product;
|
||||
$this->fk_availability = $obj->fk_availability;
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
@ -327,7 +331,7 @@ class ProductFournisseur extends Product
|
||||
|
||||
$sql = "SELECT s.nom as supplier_name, s.rowid as fourn_id,";
|
||||
$sql.= " pfp.rowid as product_fourn_pri_id, pfp.ref_fourn,";
|
||||
$sql.= " pfp.price, pfp.quantity, pfp.unitprice, pfp.fk_availability";
|
||||
$sql.= " pfp.price, pfp.quantity, pfp.unitprice, pfp.tva_tx, pfp.fk_availability";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."product_fournisseur_price as pfp";
|
||||
$sql.= ", ".MAIN_DB_PREFIX."societe as s";
|
||||
$sql.= " WHERE pfp.entity IN (".getEntity('product', 1).")";
|
||||
@ -347,16 +351,17 @@ class ProductFournisseur extends Product
|
||||
//define base attribute
|
||||
$prodfourn = new ProductFournisseur($this->db);
|
||||
|
||||
$prodfourn->product_fourn_price_id = $record["product_fourn_pri_id"];
|
||||
$prodfourn->product_fourn_id = $record["product_fourn_id"];
|
||||
$prodfourn->fourn_ref = $record["ref_fourn"];
|
||||
$prodfourn->fourn_price = $record["price"];
|
||||
$prodfourn->fourn_qty = $record["quantity"];
|
||||
$prodfourn->fourn_unitprice = $record["unitprice"];
|
||||
$prodfourn->fourn_id = $record["fourn_id"];
|
||||
$prodfourn->fourn_name = $record["supplier_name"];
|
||||
$prodfourn->fk_availability = $record["fk_availability"];
|
||||
$prodfourn->id = $prodid;
|
||||
$prodfourn->product_fourn_price_id = $record["product_fourn_pri_id"];
|
||||
$prodfourn->product_fourn_id = $record["product_fourn_id"];
|
||||
$prodfourn->fourn_ref = $record["ref_fourn"];
|
||||
$prodfourn->fourn_price = $record["price"];
|
||||
$prodfourn->fourn_qty = $record["quantity"];
|
||||
$prodfourn->fourn_unitprice = $record["unitprice"];
|
||||
$prodfourn->fourn_tva_tx = $record["tva_tx"];
|
||||
$prodfourn->fourn_id = $record["fourn_id"];
|
||||
$prodfourn->fourn_name = $record["supplier_name"];
|
||||
$prodfourn->fk_availability = $record["fk_availability"];
|
||||
$prodfourn->id = $prodid;
|
||||
|
||||
if (!isset($prodfourn->fourn_unitprice))
|
||||
{
|
||||
@ -406,7 +411,7 @@ class ProductFournisseur extends Product
|
||||
|
||||
$sql = "SELECT s.nom as supplier_name, s.rowid as fourn_id,";
|
||||
$sql.= " pfp.rowid as product_fourn_price_id, pfp.ref_fourn,";
|
||||
$sql.= " pfp.price, pfp.quantity, pfp.unitprice";
|
||||
$sql.= " pfp.price, pfp.quantity, pfp.unitprice, pfp.tva_tx";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."product_fournisseur_price as pfp";
|
||||
$sql.= " WHERE s.entity IN (".getEntity('societe', 1).")";
|
||||
$sql.= " AND pfp.fk_product = ".$prodid;
|
||||
@ -420,14 +425,15 @@ class ProductFournisseur extends Product
|
||||
if ($resql)
|
||||
{
|
||||
$record = $this->db->fetch_array($resql);
|
||||
$this->product_fourn_price_id = $record["product_fourn_price_id"];
|
||||
$this->fourn_ref = $record["ref_fourn"];
|
||||
$this->fourn_price = $record["price"];
|
||||
$this->fourn_qty = $record["quantity"];
|
||||
$this->fourn_unitprice = $record["unitprice"];
|
||||
$this->fourn_id = $record["fourn_id"];
|
||||
$this->fourn_name = $record["supplier_name"];
|
||||
$this->id = $prodid;
|
||||
$this->product_fourn_price_id = $record["product_fourn_price_id"];
|
||||
$this->fourn_ref = $record["ref_fourn"];
|
||||
$this->fourn_price = $record["price"];
|
||||
$this->fourn_qty = $record["quantity"];
|
||||
$this->fourn_unitprice = $record["unitprice"];
|
||||
$this->fourn_tva_tx = $record["tva_tx"];
|
||||
$this->fourn_id = $record["fourn_id"];
|
||||
$this->fourn_name = $record["supplier_name"];
|
||||
$this->id = $prodid;
|
||||
$this->db->free($resql);
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ -271,9 +271,6 @@ ALTER TABLE llx_adherent_extrafields ADD COLUMN import_key varchar(14);
|
||||
ALTER TABLE llx_product_extrafields ADD COLUMN import_key varchar(14);
|
||||
ALTER TABLE llx_societe_extrafields ADD COLUMN import_key varchar(14);
|
||||
|
||||
-- Disable foreign key checks for external modules constraints
|
||||
--SET FOREIGN_KEY_CHECKS=0;
|
||||
|
||||
DROP TABLE llx_c_currencies;
|
||||
create table llx_c_currencies
|
||||
(
|
||||
@ -425,11 +422,14 @@ INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'XEU'
|
||||
INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'ARP', NULL, 0, 'Pesos argentins');
|
||||
INSERT INTO llx_c_currencies ( code_iso, unicode, active, label ) VALUES ( 'MXP', NULL, 0, 'Pesos Mexicans');
|
||||
|
||||
--SET FOREIGN_KEY_CHECKS=1;
|
||||
|
||||
ALTER TABLE llx_propal ADD CONSTRAINT fk_propal_fk_currency FOREIGN KEY (fk_currency) REFERENCES llx_c_currencies (code_iso);
|
||||
ALTER TABLE llx_commande ADD CONSTRAINT fk_commande_fk_currency FOREIGN KEY (fk_currency) REFERENCES llx_c_currencies (code_iso);
|
||||
ALTER TABLE llx_facture ADD CONSTRAINT fk_facture_fk_currency FOREIGN KEY (fk_currency) REFERENCES llx_c_currencies (code_iso);
|
||||
|
||||
ALTER TABLE llx_expedition DROP COLUMN billed;
|
||||
|
||||
ALTER TABLE llx_product_fournisseur_price DROP FOREIGN KEY fk_product_fournisseur_price_fk_product_fournisseur;
|
||||
ALTER TABLE llx_product_fournisseur_price DROP INDEX idx_product_fournisseur_price_fk_product_fournisseur;
|
||||
ALTER TABLE llx_product_fournisseur_price DROP COLUMN fk_product_fournisseur;
|
||||
ALTER TABLE llx_product_fournisseur_price ADD COLUMN tva_tx double(6,3) NOT NULL AFTER unitprice;
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
-- ============================================================================
|
||||
-- Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
-- Copyright (C) 2005 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
-- Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
-- Copyright (C) 2005-2012 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
-- Copyright (C) 2009-2012 Regis Houssin <regis@dolibarr.fr>
|
||||
--
|
||||
-- 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
|
||||
@ -19,10 +20,8 @@
|
||||
|
||||
|
||||
ALTER TABLE llx_product_fournisseur_price ADD INDEX idx_product_fournisseur_price_fk_user (fk_user);
|
||||
--ALTER TABLE llx_product_fournisseur_price ADD INDEX idx_product_fournisseur_price_fk_product_fournisseur (fk_product_fournisseur);
|
||||
|
||||
ALTER TABLE llx_product_fournisseur_price ADD CONSTRAINT fk_product_fournisseur_price_fk_user FOREIGN KEY (fk_user) REFERENCES llx_user (rowid);
|
||||
--ALTER TABLE llx_product_fournisseur_price ADD CONSTRAINT fk_product_fournisseur_price_fk_product_fournisseur FOREIGN KEY (fk_product_fournisseur) REFERENCES llx_product_fournisseur (rowid);
|
||||
|
||||
-- Added to remove table llx_product_fournisseur
|
||||
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
-- ============================================================================
|
||||
-- Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
-- Copyright (C) 2009-2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
-- Copyright (C) 2009-2011 Regis Houssin <regis@dolibarr.fr>
|
||||
-- Copyright (C) 2009-2012 Regis Houssin <regis@dolibarr.fr>
|
||||
--
|
||||
-- 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
|
||||
@ -20,17 +20,17 @@
|
||||
|
||||
create table llx_product_fournisseur_price
|
||||
(
|
||||
rowid integer AUTO_INCREMENT PRIMARY KEY,
|
||||
entity integer DEFAULT 1 NOT NULL, -- multi company id
|
||||
datec datetime,
|
||||
tms timestamp,
|
||||
fk_product_fournisseur integer NOT NULL, -- deprecated
|
||||
fk_product integer,
|
||||
fk_soc integer,
|
||||
ref_fourn varchar(30),
|
||||
fk_availability integer,
|
||||
price double(24,8) DEFAULT 0,
|
||||
quantity double,
|
||||
unitprice double(24,8) DEFAULT 0,
|
||||
fk_user integer
|
||||
rowid integer AUTO_INCREMENT PRIMARY KEY,
|
||||
entity integer DEFAULT 1 NOT NULL, -- multi company id
|
||||
datec datetime,
|
||||
tms timestamp,
|
||||
fk_product integer,
|
||||
fk_soc integer,
|
||||
ref_fourn varchar(30),
|
||||
fk_availability integer,
|
||||
price double(24,8) DEFAULT 0,
|
||||
quantity double,
|
||||
unitprice double(24,8) DEFAULT 0,
|
||||
tva_tx double(6,3) NOT NULL,
|
||||
fk_user integer
|
||||
)ENGINE=innodb;
|
||||
|
||||
@ -67,7 +67,6 @@ if (! $sortfield) $sortfield="s.nom";
|
||||
if (! $sortorder) $sortorder="ASC";
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
@ -93,13 +92,14 @@ if ($action == 'updateprice' && $_POST["cancel"] <> $langs->trans("Cancel"))
|
||||
$ref_fourn=GETPOST("ref_fourn");
|
||||
if (empty($ref_fourn)) $ref_fourn=GETPOST("search_ref_fourn");
|
||||
$quantity=GETPOST("qty");
|
||||
$tva_tx=GETPOST('tva_tx','alpha');
|
||||
|
||||
if (empty($quantity))
|
||||
{
|
||||
$error++;
|
||||
$mesg='<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->transnoentities("Qty")).'</div>';
|
||||
}
|
||||
if (empty($ref_fourn)) // TODO Why not making this optionnal ?
|
||||
if (empty($ref_fourn))
|
||||
{
|
||||
$error++;
|
||||
$mesg='<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->transnoentities("RefSupplier")).'</div>';
|
||||
@ -151,7 +151,7 @@ if ($action == 'updateprice' && $_POST["cancel"] <> $langs->trans("Cancel"))
|
||||
$supplier=new Fournisseur($db);
|
||||
$result=$supplier->fetch($id_fourn);
|
||||
|
||||
$ret=$product->update_buyprice($quantity, $_POST["price"], $user, $_POST["price_base_type"], $supplier, $_POST["oselDispo"], $ref_fourn);
|
||||
$ret=$product->update_buyprice($quantity, $_POST["price"], $user, $_POST["price_base_type"], $supplier, $_POST["oselDispo"], $ref_fourn, $tva_tx);
|
||||
if ($ret < 0)
|
||||
{
|
||||
$error++;
|
||||
@ -279,7 +279,9 @@ if ($id || $ref)
|
||||
}
|
||||
else
|
||||
{
|
||||
print $form->select_company(GETPOST("id_fourn"),'id_fourn','fournisseur=1',1);
|
||||
$events=array();
|
||||
$events[]=array('method' => 'getVatRates', 'url' => dol_buildpath('/core/ajax/vatrates.php',1), 'htmlname' => 'tva_tx', 'params' => array());
|
||||
print $form->select_company(GETPOST("id_fourn"),'id_fourn','fournisseur=1',1,0,0,$events);
|
||||
|
||||
if (is_object($hookmanager))
|
||||
{
|
||||
@ -301,9 +303,13 @@ if ($id || $ref)
|
||||
}
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
// Vat rate
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans("VATRate").'</td>';
|
||||
print '<td colspan="3">'.$form->load_tva('tva_tx',$product->tva_tx,$supplier,$mysoc).'</td></tr>';
|
||||
|
||||
// Availability
|
||||
if(!empty($conf->global->FOURN_PRODUCT_AVAILABILITY))
|
||||
if (! empty($conf->global->FOURN_PRODUCT_AVAILABILITY))
|
||||
{
|
||||
$langs->load("propal");
|
||||
print '<tr><td>'.$langs->trans("Availability").'</td><td colspan="3">';
|
||||
@ -313,8 +319,8 @@ if ($id || $ref)
|
||||
|
||||
// Qty min
|
||||
print '<tr>';
|
||||
print '<td class="fieldrequired" width="25%">'.$langs->trans("QtyMin").'</td>';
|
||||
print '<td width="25%">';
|
||||
print '<td class="fieldrequired">'.$langs->trans("QtyMin").'</td>';
|
||||
print '<td>';
|
||||
$quantity = $_REQUEST["qty"] ? $_REQUEST["qty"] : "1";
|
||||
if ($_GET["rowid"])
|
||||
{
|
||||
@ -326,8 +332,10 @@ if ($id || $ref)
|
||||
print '<input class="flat" name="qty" size="5" value="'.$quantity.'">';
|
||||
}
|
||||
print '</td>';
|
||||
print '<td class="fieldrequired" width="25%">'.$langs->trans("PriceQtyMin").'</td>';
|
||||
print '<td width="25%"><input class="flat" name="price" size="8" value="'.($_POST["price"]?$_POST["price"]:(isset($product->fourn_price)?price($product->fourn_price):'')).'">';
|
||||
|
||||
// Price qty min
|
||||
print '<td class="fieldrequired">'.$langs->trans("PriceQtyMin").'</td>';
|
||||
print '<td><input class="flat" name="price" size="8" value="'.($_POST["price"]?$_POST["price"]:(isset($product->fourn_price)?price($product->fourn_price):'')).'">';
|
||||
print ' ';
|
||||
print $form->select_PriceBaseType(($_POST["price_base_type"]?$_POST["price_base_type"]:$product->price_base_type), "price_base_type");
|
||||
print '</td>';
|
||||
@ -335,7 +343,7 @@ if ($id || $ref)
|
||||
|
||||
print '</table>';
|
||||
|
||||
print '<center><input class="button" type="submit" value="'.$langs->trans("Save").'">';
|
||||
print '<br><center><input class="button" type="submit" value="'.$langs->trans("Save").'">';
|
||||
print ' ';
|
||||
print '<input class="button" type="submit" name="cancel" value="'.$langs->trans("Cancel").'"></center>';
|
||||
|
||||
@ -376,6 +384,7 @@ if ($id || $ref)
|
||||
print '<td class="liste_titre">'.$langs->trans("SupplierRef").'</td>';
|
||||
if (!empty($conf->global->FOURN_PRODUCT_AVAILABILITY)) print_liste_field_titre($langs->trans("Availability"),$_SERVER["PHP_SELF"],"pfp.fk_availability","",$param,"",$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("QtyMin"),$_SERVER["PHP_SELF"],"pfp.quantity","",$param,'align="right"',$sortfield,$sortorder);
|
||||
print '<td class="liste_titre" align="right">'.$langs->trans("VATRate").'</td>';
|
||||
print '<td class="liste_titre" align="right">'.$langs->trans("PriceQtyMinHT").'</td>';
|
||||
print_liste_field_titre($langs->trans("UnitPriceHT"),$_SERVER["PHP_SELF"],"pfp.unitprice","",$param,'align="right"',$sortfield,$sortorder);
|
||||
print '<td class="liste_titre"></td>';
|
||||
@ -411,6 +420,11 @@ if ($id || $ref)
|
||||
print '<td align="right">';
|
||||
print $productfourn->fourn_qty;
|
||||
print '</td>';
|
||||
|
||||
// VAT rate
|
||||
print '<td align="right">';
|
||||
print vatrate($productfourn->fourn_tva_tx,true);
|
||||
print '</td>';
|
||||
|
||||
// Price quantity
|
||||
print '<td align="right">';
|
||||
@ -448,7 +462,7 @@ else
|
||||
}
|
||||
|
||||
|
||||
$db->close();
|
||||
|
||||
// End of page
|
||||
llxFooter();
|
||||
$db->close();
|
||||
?>
|
||||
@ -614,7 +614,7 @@ else
|
||||
|
||||
if ($conf->use_javascript_ajax)
|
||||
{
|
||||
print "\n".'<script type="text/javascript" language="javascript">';
|
||||
print "\n".'<script type="text/javascript">';
|
||||
print '$(document).ready(function () {
|
||||
id_te_private=8;
|
||||
id_ef15=1;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user