STPH#36712 INFO] Rapportage actuele voorraad incl totaalbedrag
svn path=/Website/trunk/; revision=31655
This commit is contained in:
@@ -28,6 +28,11 @@ function bes_voorraad_list (pautfunction, params)
|
||||
// params.outputmode : print to 0 = screen, 1 = printer, 2 = excel, etc.
|
||||
// params.showall : boolean (true | false)
|
||||
// params.catalogus_key : key
|
||||
// params.besgroep_key :
|
||||
// params.item_key :
|
||||
// params.searchtekst :
|
||||
// params.tebestellen :
|
||||
// params.voorraad : 0=bestelvoorraad, 1=actuele voorraad
|
||||
|
||||
var authparams = user.checkAutorisation(pautfunction);
|
||||
|
||||
@@ -40,6 +45,7 @@ function bes_voorraad_list (pautfunction, params)
|
||||
// Voor resulttable de globalen zetten; zou ng anders moeten.
|
||||
var outputmode = params.outputmode; // print to 0 = screen, 1 = printer, 2 = excel, etc.
|
||||
var showall = params.showall;
|
||||
var showvoorraad = params.voorraad;
|
||||
%>
|
||||
|
||||
<html>
|
||||
@@ -387,6 +393,12 @@ function bes_voorraad_list (pautfunction, params)
|
||||
+ " , bo.bes_srtdeel_eenheid"
|
||||
+ " , bo.bes_srtdeel_eenheid_intern";
|
||||
|
||||
var sql_prijs = "SELECT sp.bes_srtdeel_key"
|
||||
+ " , sp.bes_srtdeel_prijs_prijs"
|
||||
+ " , sp.bes_srtdeel_prijs_inkprijs"
|
||||
+ " FROM bes_srtdeel_prijs sp"
|
||||
+ " WHERE sp.bes_srtdeel_prijs_vervaldatum IS NULL"
|
||||
|
||||
var sql_val = "SELECT a.bes_srtdeel_key"
|
||||
+ " , a.bes_srtdeel_nr"
|
||||
+ " , a.inkoop_disc"
|
||||
@@ -407,10 +419,13 @@ function bes_voorraad_list (pautfunction, params)
|
||||
+ " , b.bes_srtdeel_omschrijving"
|
||||
+ " , a.bes_srtdeel_eenheid eenheid_extern"
|
||||
+ " , a.bes_srtdeel_eenheid_intern eenheid_intern"
|
||||
+ " , c.bes_srtdeel_prijs_prijs prijs_intern"
|
||||
+ " FROM (" + sql_from_all + ") a"
|
||||
+ " , (" + sql_srtdeel + ") b"
|
||||
+ " , (" + sql_prijs + ") c"
|
||||
+ " WHERE a.bes_srtdeel_nr = b.bes_srtdeel_nr"
|
||||
+ " AND a.inkoop_disc = b.ins_discipline_key"
|
||||
+ " AND a.bes_srtdeel_key = c.bes_srtdeel_key(+)"
|
||||
+ (params.catalogus_key
|
||||
? " AND a.inkoop_disc = " + params.catalogus_key
|
||||
: "")
|
||||
@@ -431,7 +446,8 @@ function bes_voorraad_list (pautfunction, params)
|
||||
+ " , b.intern_notitie"
|
||||
+ " , b.bes_srtdeel_omschrijving"
|
||||
+ " , a.bes_srtdeel_eenheid"
|
||||
+ " , a.bes_srtdeel_eenheid_intern";
|
||||
+ " , a.bes_srtdeel_eenheid_intern"
|
||||
+ " , c.bes_srtdeel_prijs_prijs";
|
||||
|
||||
var sql = "SELECT bes_srtdeel_key"
|
||||
+ " , bes_srtdeel_nr"
|
||||
@@ -475,6 +491,7 @@ function bes_voorraad_list (pautfunction, params)
|
||||
+ " AND sd.bes_srtdeel_key = l.bes_srtdeel_key) aantalkenmerken"
|
||||
+ " , l.eenheid_extern"
|
||||
+ " , l.eenheid_intern"
|
||||
+ " , l.prijs_intern"
|
||||
+ " FROM (" + sql_val + ") l";
|
||||
|
||||
|
||||
@@ -559,12 +576,39 @@ function bes_voorraad_list (pautfunction, params)
|
||||
return tebestellen;
|
||||
}
|
||||
|
||||
function fncolEenheidPrijs(oRs)
|
||||
{
|
||||
var factor = oRs("intern_voorraadfactor").Value;
|
||||
var prijs = oRs("prijs_intern").Value;
|
||||
var eenheidprijs = prijs / factor;
|
||||
|
||||
return eenheidprijs.toFixed(2);
|
||||
}
|
||||
|
||||
function fncolTotaalPrijs(oRs)
|
||||
{ // Door afronding van eenheidsprijs kan de totaalprijs afwijken.
|
||||
// Deze heeft echter wel de juiste waarde!
|
||||
var factor = oRs("intern_voorraadfactor").Value;
|
||||
var prijs = oRs("prijs_intern").Value;
|
||||
var aantal = oRs("voorraad_intern").Value;
|
||||
var eenheidprijs = prijs / factor;
|
||||
var totaal = aantal * eenheidprijs;
|
||||
|
||||
return totaal;
|
||||
}
|
||||
|
||||
function fncolTotaalPrijsText(oRs)
|
||||
{
|
||||
return safe.curr(fncolTotaalPrijs(oRs), false);
|
||||
}
|
||||
|
||||
/**************************************
|
||||
* End callback functies ResultsetTable
|
||||
*************************************/
|
||||
|
||||
var buttons = [];
|
||||
buttons.push({ icon: "plus.png", title: L("lcl_bes_order_lastcolumn"), action: "bes_bestel()" });
|
||||
if (!showvoorraad)
|
||||
buttons.push({ icon: "plus.png", title: L("lcl_bes_order_lastcolumn"), action: "bes_bestel()" });
|
||||
|
||||
var rst = new ResultsetTable({ sql: sql,
|
||||
keyColumn: "inkoop_disc", // Is geen unique key. Dus id van <tr> krijgt geen unique id
|
||||
@@ -583,13 +627,20 @@ function bes_voorraad_list (pautfunction, params)
|
||||
rst.addColumn(new Column({caption: L("lcl_bes_notitie"), content: "bes_srtdeel_notitie"}));
|
||||
rst.addColumn(new Column({caption: L("lcl_bes_voorraad") + " (" + L("lcl_mld_intern") + ")", content: fncolVoorraadIntern, datatype: "number", total: true, thClass: "eenheiddiff", columnClass: function(){return "eenheiddiff";}}));
|
||||
rst.addColumn(new Column({caption: L("lcl_bes_unity"), content: "eenheid_intern", thClass: "eenheiddiff", columnClass: function(){return "eenheiddiff";}}));
|
||||
rst.addColumn(new Column({caption: L("lcl_bes_aantal_in"), content: "aantal_geleverd", datatype: "number", total: true}));
|
||||
rst.addColumn(new Column({caption: L("lcl_bes_aantal_uit"), content: "aantal_extern_uit", datatype: "number", total: true}));
|
||||
rst.addColumn(new Column({caption: L("lcl_bes_voorraad"), content: "voorraad", datatype: "number", total: true}));
|
||||
rst.addColumn(new Column({caption: L("lcl_bes_unity"), content: "eenheid_extern"}));
|
||||
rst.addColumn(new Column({caption: L("lcl_bes_lopend"), content: "aantal_open_order", datatype: "number", total: true}));
|
||||
rst.addColumn(new Column({caption: L("lcl_bes_bestellen"), content: fncolTeBestellen, datatype: "number", total: true}));
|
||||
|
||||
if (!showvoorraad)
|
||||
{
|
||||
rst.addColumn(new Column({caption: L("lcl_bes_aantal_in"), content: "aantal_geleverd", datatype: "number", total: true}));
|
||||
rst.addColumn(new Column({caption: L("lcl_bes_aantal_uit"), content: "aantal_extern_uit", datatype: "number", total: true}));
|
||||
rst.addColumn(new Column({caption: L("lcl_bes_voorraad"), content: "voorraad", datatype: "number", total: true}));
|
||||
rst.addColumn(new Column({caption: L("lcl_bes_unity"), content: "eenheid_extern"}));
|
||||
rst.addColumn(new Column({caption: L("lcl_bes_lopend"), content: "aantal_open_order", datatype: "number", total: true}));
|
||||
rst.addColumn(new Column({caption: L("lcl_bes_bestellen"), content: fncolTeBestellen, datatype: "number", total: true}));
|
||||
}
|
||||
else
|
||||
{
|
||||
rst.addColumn(new Column({caption: L("lcl_bes_price_per_unity"), content: fncolEenheidPrijs, datatype: "currency"}));
|
||||
rst.addColumn(new Column({caption: L("lcl_bes_price_total"), content: fncolTotaalPrijsText, fnAmount: fncolTotaalPrijs, datatype: "currency", total: true}));
|
||||
}
|
||||
// Acties
|
||||
// Geen acties
|
||||
|
||||
|
||||
@@ -149,6 +149,10 @@ var authparams = user.checkAutorisation(autfunction);
|
||||
</nobr>
|
||||
</td>
|
||||
</tr>
|
||||
<%
|
||||
// Actuele voorraad
|
||||
RWCHECKBOXTR("instock", "fldcheck", L("lcl_bes_artikel_voorraad"), 0, { trclass: "primsearch" });
|
||||
%>
|
||||
</table>
|
||||
</td><!-- end column 2-->
|
||||
</tr>
|
||||
|
||||
@@ -34,6 +34,7 @@ var besgroep_key = getQParamInt("srtgroup", -1); // Groep
|
||||
var item_key = getQParamInt("srtdeelmulti", -1); // Item
|
||||
var searchtekst = getQParam("searchtekst", ""); // Zoektekst
|
||||
var tebestellen = getQParamInt("tebestellen", 0) == 1;
|
||||
var voorraad = getQParam("instock", "off") == "on"
|
||||
|
||||
var autfunction = "";
|
||||
switch(urole)
|
||||
@@ -56,7 +57,8 @@ bes_voorraad_list ( autfunction,
|
||||
besgroep_key: (besgroep_key != -1? besgroep_key : null),
|
||||
item_key: (item_key != -1? item_key : null),
|
||||
searchtekst: (searchtekst != "" ? searchtekst : null),
|
||||
tebestellen: tebestellen
|
||||
tebestellen: tebestellen,
|
||||
voorraad: voorraad
|
||||
}
|
||||
);
|
||||
%>
|
||||
Reference in New Issue
Block a user