AAAH#34949 -- Koppeling met Absoluta werkt niet in productie
svn path=/Website/branches/v2015.3/; revision=27603
This commit is contained in:
122
CUST/AAAH/custfunctions.wsc
Normal file
122
CUST/AAAH/custfunctions.wsc
Normal file
@@ -0,0 +1,122 @@
|
||||
<?xml version="1.0"?>
|
||||
<component>
|
||||
<?component error="true" debug="true"?>
|
||||
<registration
|
||||
description="custfunctions"
|
||||
progid="custfunction.wsc"
|
||||
version="1.00"
|
||||
classid="{4F51571C-1DFC-4769-B8DD-37B356378F12}"
|
||||
>
|
||||
</registration>
|
||||
|
||||
<public>
|
||||
|
||||
<!-- properties -->
|
||||
<property name="Oracle">
|
||||
<put/>
|
||||
</property>
|
||||
<property name="__Log">
|
||||
<put/>
|
||||
</property>
|
||||
<property name="__DoLog">
|
||||
<put/>
|
||||
</property>
|
||||
<property name="safe">
|
||||
<put/>
|
||||
</property>
|
||||
|
||||
<!-- methods -->
|
||||
<method name="bes_punch_receive">
|
||||
<PARAMETER name="RequestForm"/>
|
||||
<PARAMETER name="bes_srtdeel_key"/>
|
||||
<PARAMETER name="item"/>
|
||||
</method>
|
||||
</public>
|
||||
|
||||
<script language="javascript">
|
||||
<![CDATA[
|
||||
|
||||
/* properties */
|
||||
function put_Oracle(newValue) {Oracle = newValue};
|
||||
function put___Log(newValue) {__Log = newValue};
|
||||
function put___DoLog(newValue) {__DoLog = newValue};
|
||||
function put_safe(newValue) {safe = newValue};
|
||||
|
||||
/* methods */
|
||||
/*
|
||||
$Revision$
|
||||
$Id$
|
||||
|
||||
File: custfunction.wsc
|
||||
|
||||
*/
|
||||
|
||||
/* Dit zijn de enige drie functies die je mag gebruiken */
|
||||
var Oracle;
|
||||
var __Log;
|
||||
var __DoLog;
|
||||
var safe;
|
||||
|
||||
bes_punch_receive = function (RequestForm, bes_srtdeel_key, item, pResult)
|
||||
{
|
||||
var result = {orderurl: ""};
|
||||
sql = "SELECT sd.prs_bedrijf_key FROM bes_srtdeel sd WHERE sd.bes_srtdeel_key = " + bes_srtdeel_key;
|
||||
oRs = Oracle.Execute(sql);
|
||||
bedr_key = oRs("prs_bedrijf_key").value;
|
||||
|
||||
function punchNVL(nm, n, def)
|
||||
{
|
||||
nm = nm.replace('#', n);
|
||||
if (RequestForm(nm).Count() == 0)
|
||||
return def;
|
||||
if (RequestForm(nm) == "")
|
||||
return def;
|
||||
return RequestForm(nm)(1);
|
||||
};
|
||||
|
||||
// Alleen voor leverancier Absoluta uitvoeren (prs_bedrijf_key = 32201)
|
||||
// Bij Absoluta moet de lange omschrijving van de bestelling in het opmerkingen veld
|
||||
// geplaatst worden.
|
||||
if (bedr_key == 941)
|
||||
{
|
||||
var opm = punchNVL("NEW_ITEM-LONGTEXT_#:132[]", item, "");
|
||||
sql = "UPDATE bes_srtdeel SET bes_srtdeel_opmerking = " + safe.quoted_sql(opm)
|
||||
+ " WHERE bes_srtdeel_key = " + bes_srtdeel_key;
|
||||
oRs = Oracle.Execute(sql);
|
||||
|
||||
// voeg de bezorg informatie toe datum in CUST_FIELD3 en tijd in CUST_FIELD4
|
||||
var bezorgdatum = punchNVL("NEW_ITEM-CUST_FIELD3[#]", item, "Leeg");
|
||||
var bezorgtijd = punchNVL("NEW_ITEM-CUST_FIELD4[#]", item, "Leeg");
|
||||
if (bezorgdatum != "Leeg" && bezorgtijd != "Leeg")
|
||||
{
|
||||
sql = "UPDATE bes_srtdeel SET bes_srtdeel_notitie = " + safe.quoted_sql(bezorgdatum + "T" + bezorgtijd + ":00")
|
||||
+ " WHERE bes_srtdeel_key = " + bes_srtdeel_key;
|
||||
oRs = Oracle.Execute(sql);
|
||||
}
|
||||
if (bezorgdatum != "Leeg" && item == 1 )
|
||||
{
|
||||
sql = "SELECT fac.safe_to_date(" + safe.quoted_sql(bezorgdatum) + ", 'yyyy-mm-dd') leverdatum FROM DUAL";
|
||||
oRs = Oracle.Execute(sql);
|
||||
var leverdatum = oRs("leverdatum").value;
|
||||
result.orderurl = "&leverdatum=" + (new Date(leverdatum)).getTime();
|
||||
}
|
||||
var btw = punchNVL("NEW_ITEM-CUST_FIELD2[#]", item, "H");
|
||||
sql = "UPDATE bes_srtdeel SET bes_srtdeel_btw = DECODE("+safe.quoted_sql(btw)+",'H', 21, 'L', 6, 0)"
|
||||
+ " WHERE bes_srtdeel_key = " + bes_srtdeel_key;
|
||||
oRs = Oracle.Execute(sql);
|
||||
|
||||
var artikelnr = punchNVL("NEW_ITEM-EXT_PRODUCT_ID[#]", item, "Leeg");
|
||||
if (artikelnr != "Leeg")
|
||||
{
|
||||
sql = "UPDATE bes_srtdeel SET bes_srtdeel_nr = bes_srtdeel_nr || '/' ||" + safe.quoted_sql(artikelnr)
|
||||
+ " WHERE bes_srtdeel_key = " + bes_srtdeel_key;
|
||||
oRs = Oracle.Execute(sql);
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
]]>
|
||||
</script>
|
||||
</component>
|
||||
Reference in New Issue
Block a user