Skip to content
Snippets Groups Projects
Commit 440df980 authored by fmarcet's avatar fmarcet
Browse files

Fix SQL Query

parent dba952e5
No related branches found
No related tags found
No related merge requests found
...@@ -162,7 +162,7 @@ if (! empty($conf->global->DISPLAY_MARK_RATES)) { ...@@ -162,7 +162,7 @@ if (! empty($conf->global->DISPLAY_MARK_RATES)) {
print "</table>"; print "</table>";
print '</form>'; print '</form>';
$sql = "SELECT p.label, p.rowid, p.fk_product_type, p.ref, p.entity as pentity"; $sql = "SELECT p.label, p.rowid, p.fk_product_type, p.ref, p.entity as pentity,";
if ($id > 0) $sql.= " d.fk_product,"; if ($id > 0) $sql.= " d.fk_product,";
if ($id > 0) $sql.= " f.rowid as facid, f.facnumber, f.total as total_ht, f.datef, f.paye, f.fk_statut as statut,"; if ($id > 0) $sql.= " f.rowid as facid, f.facnumber, f.total as total_ht, f.datef, f.paye, f.fk_statut as statut,";
$sql.= " sum(d.total_ht) as selling_price,"; $sql.= " sum(d.total_ht) as selling_price,";
......
...@@ -285,7 +285,7 @@ $sql = $sql_select; ...@@ -285,7 +285,7 @@ $sql = $sql_select;
$sql.= ' d.description as description,'; $sql.= ' d.description as description,';
if ($type_element != 'fichinter' && $type_element != 'contract') $sql.= ' d.label, d.fk_product as product_id, d.fk_product as fk_product, d.info_bits, d.date_start, d.date_end, d.qty, d.qty as prod_qty,'; if ($type_element != 'fichinter' && $type_element != 'contract') $sql.= ' d.label, d.fk_product as product_id, d.fk_product as fk_product, d.info_bits, d.date_start, d.date_end, d.qty, d.qty as prod_qty,';
if ($type_element == 'contract') $sql.= ' d.label, d.fk_product as product_id, d.fk_product as fk_product, d.info_bits, d.date_ouverture as date_start, d.date_cloture as date_end, d.qty, d.qty as prod_qty,'; if ($type_element == 'contract') $sql.= ' d.label, d.fk_product as product_id, d.fk_product as fk_product, d.info_bits, d.date_ouverture as date_start, d.date_cloture as date_end, d.qty, d.qty as prod_qty,';
if ($type_element != 'fichinter') $sql.= ' p.ref as ref, p.rowid as prod_id, p.rowid as fk_product, p.fk_product_type as prod_type, p.fk_product_type as fk_product_type, p.entity as pentity'; if ($type_element != 'fichinter') $sql.= ' p.ref as ref, p.rowid as prod_id, p.rowid as fk_product, p.fk_product_type as prod_type, p.fk_product_type as fk_product_type, p.entity as pentity,';
$sql.= " s.rowid as socid "; $sql.= " s.rowid as socid ";
if ($type_element != 'fichinter') $sql.= ", p.ref as prod_ref, p.label as product_label"; if ($type_element != 'fichinter') $sql.= ", p.ref as prod_ref, p.label as product_label";
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s, ".$tables_from; $sql.= " FROM ".MAIN_DB_PREFIX."societe as s, ".$tables_from;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment