279 |
/* |
/* |
280 |
* Lignes contrats liées à un produit |
* Lignes contrats liées à un produit |
281 |
*/ |
*/ |
282 |
$sql = "SELECT d.description, p.rowid, p.label, p.description as product_desc, p.ref,"; |
$sql = "SELECT p.rowid, p.label, p.description as product_desc, p.ref,"; |
283 |
$sql.= " d.price_ht, d.tva_tx, d.qty, d.remise_percent, d.subprice"; |
$sql.= " d.description, d.price_ht, d.tva_tx, d.qty, d.remise_percent, d.subprice,"; |
284 |
|
$sql.= " d.date_ouverture_prevue, d.date_ouverture,"; |
285 |
|
$sql.= " d.date_fin_validite, d.date_cloture"; |
286 |
$sql.= " FROM ".MAIN_DB_PREFIX."contratdet as d, ".MAIN_DB_PREFIX."product as p"; |
$sql.= " FROM ".MAIN_DB_PREFIX."contratdet as d, ".MAIN_DB_PREFIX."product as p"; |
287 |
$sql.= " WHERE d.fk_contrat = ".$this->id ." AND d.fk_product = p.rowid"; |
$sql.= " WHERE d.fk_contrat = ".$this->id ." AND d.fk_product = p.rowid"; |
288 |
$sql.= " ORDER by d.rowid ASC"; |
$sql.= " ORDER by d.rowid ASC"; |
298 |
$objp = $this->db->fetch_object($result); |
$objp = $this->db->fetch_object($result); |
299 |
|
|
300 |
$ligne = new ContratLigne(); |
$ligne = new ContratLigne(); |
301 |
|
$ligne->id = $objp->rowid; |
302 |
$ligne->desc = stripslashes($objp->description); // Description ligne |
$ligne->desc = stripslashes($objp->description); // Description ligne |
303 |
$ligne->libelle = stripslashes($objp->label); // Label produit |
$ligne->libelle = stripslashes($objp->label); // Label produit |
304 |
$ligne->product_desc = stripslashes($objp->product_desc); // Description produit |
$ligne->product_desc = stripslashes($objp->product_desc); // Description produit |
309 |
$ligne->remise_percent = $objp->remise_percent; |
$ligne->remise_percent = $objp->remise_percent; |
310 |
$ligne->price = $objp->price; |
$ligne->price = $objp->price; |
311 |
$ligne->product_id = $objp->rowid; |
$ligne->product_id = $objp->rowid; |
312 |
|
|
313 |
|
$ligne->date_debut_prevue = $objp->date_ouverture_prevue; |
314 |
|
$ligne->date_debut_reel = $objp->date_ouverture; |
315 |
|
$ligne->date_fin_prevue = $objp->date_fin_validite; |
316 |
|
$ligne->date_fin_reel = $objp->date_cloture; |
317 |
|
|
318 |
$this->lignes[$i] = $ligne; |
$this->lignes[$i] = $ligne; |
319 |
//dolibarr_syslog("1 ".$ligne->desc); |
//dolibarr_syslog("1 ".$ligne->desc); |
331 |
/* |
/* |
332 |
* Lignes contrat liées à aucun produit |
* Lignes contrat liées à aucun produit |
333 |
*/ |
*/ |
334 |
$sql = "SELECT d.qty, d.description, d.price_ht, d.subprice, d.tva_tx, d.rowid, d.remise_percent"; |
$sql = "SELECT d.qty, d.description, d.price_ht, d.subprice, d.tva_tx, d.rowid, d.remise_percent,"; |
335 |
$sql .= " FROM ".MAIN_DB_PREFIX."contratdet as d"; |
$sql.= " d.date_ouverture_prevue, d.date_ouverture,"; |
336 |
$sql .= " WHERE d.fk_contrat = ".$this->id ." AND d.fk_product = 0"; |
$sql.= " d.date_fin_validite, d.date_cloture"; |
337 |
|
$sql.= " FROM ".MAIN_DB_PREFIX."contratdet as d"; |
338 |
|
$sql.= " WHERE d.fk_contrat = ".$this->id ." AND d.fk_product = 0"; |
339 |
|
|
340 |
$result = $this->db->query($sql); |
$result = $this->db->query($sql); |
341 |
if ($result) |
if ($result) |
357 |
$ligne->price = $objp->price; |
$ligne->price = $objp->price; |
358 |
$ligne->product_id = 0; |
$ligne->product_id = 0; |
359 |
|
|
360 |
|
$ligne->date_debut_prevue = $objp->date_ouverture_prevue; |
361 |
|
$ligne->date_debut_reel = $objp->date_ouverture; |
362 |
|
$ligne->date_fin_prevue = $objp->date_fin_validite; |
363 |
|
$ligne->date_fin_reel = $objp->date_cloture; |
364 |
|
|
365 |
$this->lignes[$i] = $ligne; |
$this->lignes[$i] = $ligne; |
366 |
$i++; |
$i++; |
367 |
$j++; |
$j++; |
1087 |
|
|
1088 |
class ContratLigne |
class ContratLigne |
1089 |
{ |
{ |
1090 |
|
var $id; |
1091 |
|
var $desc; |
1092 |
|
var $libelle; |
1093 |
|
var $product_desc; |
1094 |
|
var $qty; |
1095 |
|
var $ref; |
1096 |
|
var $tva_tx; |
1097 |
|
var $subprice; |
1098 |
|
var $remise_percent; |
1099 |
|
var $price; |
1100 |
|
var $product_id; |
1101 |
|
|
1102 |
|
var $date_debut_prevue; |
1103 |
|
var $date_debut_reel; |
1104 |
|
var $date_fin_prevue; |
1105 |
|
var $date_fin_reel; |
1106 |
|
|
1107 |
function ContratLigne() |
function ContratLigne() |
1108 |
{ |
{ |
1109 |
} |
} |