Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Micros POS Version 2 Isl script from Version 1

Status
Not open for further replies.

Ashutosh1234

Technical User
Sep 16, 2020
6
AU
Hi All

We are migrating from Micros V1 to Micros version 2 where few elements of the ISL script are not working or not available and micros pos is showing error not available on this verison



The script was written to calculate correct service charge amount on the initiated payment amount and then call the Credit card payment method

Example : if the check is for $100 and we are doing a partial payment of $20 on that check the below will calculate service charge @ 1.2% on $20 and not on $100

the below are lines are where the error is coming up. Can someone please point me at the right direction

// The below key is calling the event inquiry 2 which is below //

LoadKyBdMacro Key(11, 1001) //
And

Event Inq : 2

LoadKyBdMacro MakeKeys(dFinalCCAmount),Key(11, 1061)


Below is full script

RetainGlobalVar
// Prorate


Var bTrue : N1 = 1
Var bFalse : N1 = 0
Var bRES32 : N1
Var bTesting : N1 = 0
Var nSurchargeItem : N9 = 1020

Var dSurchargeAmount : $12
Var dCCAmount : $12
Var dFinalCCAmount : $12


Var errNothingToPay : A40 = "Nothing on check to pay"

//*********************************************************************************************************************
//**************************************************** Event Inq : 1 **************************************************
//************************************* Apply CC Surcharge And Call CC Amount Entry ***********************************
//*********************************************************************************************************************

Event Inq : 1



if (@TTLDUE = 0)
exitwitherror errNothingToPay
endif


Var nCnt : N9
Var dItemTotal : $12
Var dDiscTotal : $12
Var dSvcTotal : $12
Var dTMedTotal : $12
Var dCheckTotal : $12

Var dSurchargePercent : $12
Var dCCPercent : $12
Var dSurchargeAmount : $12
Var dCCAmount : $12
Var strCCAmount : A20
Var bSurchargeFound : N1
Var nDtlCnt : N9


dItemTotal = 0.00
dDiscTotal = 0.00
dSvcTotal = 0.00
dTMedTotal = 0.00
dCheckTotal = 0.00

If Len(@USERENTRY) = 0 Then
//ExitWithError "You Must Enter An Amount First !!!"
dccAmount = @TTLDUE
Else
If @USERENTRY = 0 Then
//ExitWithError "Zero Is Not A Valid Amount !!!"
dccAmount = @TTLDUE
else

strCCAmount = @USERENTRY

If Instr(1, strCCAmount, ".") = 0 Then
If Len(strCCAmount) = 1 Then
Format strCCAmount As "." , "0", @USERENTRY
Else
Format strCCAmount As Mid(@USERENTRY, 1, ((Len(@USERENTRY) - 2))), ".", Mid(@USERENTRY, (Len(@USERENTRY) - 1), 2)
EndIf
EndIf

dCCAmount = strCCAmount

EndIf

EndIf
dCCPercent = 1.2




var tmpAmount : $12 = dCCAmount
Call roundAmount(tmpAmount)

if (tmpAmount <> dCCAmount)
ExitWithError "Amount must be round"
endif



dSurchargeAmount = ((dCCAmount * dCCPercent) / 100)
Call roundAmount(dSurchargeAmount)

If dCCPercent <> 0 Then
// LoadKyBdMacro Key(1, nSurchargeItem), MakeKeys(dSurchargeAmount), @KEY_ENTER
LoadKyBdMacro Key(5, 3), MakeKeys(dSurchargeAmount), @KEY_ENTER
EndIf

dFinalCCAmount = (dCCAmount + dSurchargeAmount)

if (bTesting)
waitforconfirm "surcharge amount: " , dSurchargeAmount
waitforconfirm "final amount: " , dFinalCCAmount
EndIf


// The below key is calling the event inquiry 2 which is below //

LoadKyBdMacro Key(11, 1001) //

EndEvent

sub roundAmount(ref calcTtl)


var nDelta : N1
var bigInt : N12

bigInt = ToInteger(calcTtl)
nDelta = bigInt % 10

if (nDelta > 0) and (nDelta <> 5)
if nDelta < 3
bigInt = bigInt - nDelta
elseif nDelta < 5
bigInt = bigInt + (5 - nDelta)
elseif nDelta < 8
bigInt = bigInt - (nDelta - 5)
else
bigInt = bigInt + (10 - nDelta)
endif
calcTtl = bigInt
calcTtl = (calcTtl / 100)
endif


endsub


//*********************************************************************************************************************
//**************************************************** Event Inq : 2 **************************************************
//************************************* Enter Credit Card Amount And Call MPG CC Pay **********************************
//*********************************************************************************************************************

Event Inq : 2

LoadKyBdMacro MakeKeys(dFinalCCAmount),Key(11, 1061)

EndEvent
 
In Simphony2, The way macros executed has changed.

To Call inquiry 2, replace the ZoneKey with your Zone Key name for the extension application
Code:
var inq2 :key =defkey("SimInquire" ,a:"ZoneKkey:2")
loadkybdmacro inq2

To Call a Payment
Code:
var amt:$
Input amt,"Enter Amount"
var cash :key =defkey("Payment" ,n:2,a:"Cash:Cash")
loadkybdmacro MakeKeys(amt),cash

To figure out what you need to send for n and a arguments, go to your page design, right click on the button you want to use in your macro, select copy. Then paste it in notepad and look for:
* OpsCommand
* OpsCommandNumber
* OpsCommandArguments

Good luck
 
Hi CodexPOSed

Thanks for the response we ended up doing the below

var myKey : key
myKey = defkey("Payment", N:0, A:"CreditDebit:Loadable CreditAuthAndPay")
loadkybdmacro myKey


The only issue we are having is that its not calculating service fee on the payment amount

Example if the total amount on check is $13 @ 1.2 % service charge = .16 which is correct but if the user enter $5 it should should calculate service charge $.06

I think the problem is in line LoadKyBdMacro Key(5, 3), MakeKeys(dSurchargeAmount), @KEY_ENTER

If you could help me with this that will be highly appreciated


 
If you program a key in the Simphony page designer for what you want, copy it and paste it into notepad it will give you the button settings in XML.
You can use this XML to figure out how to make the defkey.

Example button coppied.

<ControlClipboard xmlns="clr-namespace:EMC.Application.General.Controls.MicrosGridEditor;assembly=EMC" xmlns:mouic="clr-namespace:Micros.OpsUI.Controls;assembly=OpsUI" xmlns:av=" <mouic:Button OpsCommand="ServiceCharge" OpsCommandText="" OpsCommandIndex="0" OpsCommandNumber="1" OpsCommandArguments="" Width="Auto" Height="Auto" Focusable="False" av:InputMethod.IsInputMethodEnabled="True" av:Grid.Column="12" av:Grid.Row="4" av:Grid.ColumnSpan="4" av:Grid.RowSpan="4" av:AutomationProperties.AutomationId="micros.generated.ServiceCharge.1.0..">
<mouic:TranslatedEntryManager.TranslatedEntryList>
<mouic:TranslatedEntryCollection>
<mouic:TranslatedEntry LanguageObjNumber="1" Text="Svc" />
</mouic:TranslatedEntryCollection>
</mouic:TranslatedEntryManager.TranslatedEntryList>
</mouic:Button>
</ControlClipboard>

If you look at the XML you can see the OpsCommand, OpsCommandText, OpsCommandIndex, OpsCommandNumber and OpsCommandArguments.
These all correspond to the defkey values.
In this case because its a button you will only have the OpsCommand name and the number. The number means its applying service charge 1.
Text should define the amount.

eg. Defkey("ServiceCharge", N:1, T:0.16)

Specialist in creating custom applications for the Micros POS range: 3700, 9700, Simphony FE, Simphony. SIM Scripts, Data Exports, Simphony extension applications, API Creation and integration. If you need anything please contact me via my website
 
thanks for the above reply. It still wont calculate the correct amount
var CCKey : key
CCKey = defkey("ServiceCharge", N:3, A"")
loadkybdmacro CCKey, MakeKeys(dSurchargeAmount) @KEY_ENTER


Still no luck
 
@Ashutosh1234, can you post the latest version of your entire script?
 
Hi CodexPOSed

Please find the latest script below

********************************************************************

RetainGlobalVar
//Prorate


Var bTrue : N1 = 1
Var bFalse : N1 = 0
Var bRES32 : N1
Var bTesting : N1 = 0
Var nSurchargeItem : N9 = 1020

Var dSurchargeAmount : $12
Var dCCAmount : $12
Var dFinalCCAmount : $12


Var errNothingToPay : A40 = "Nothing on check to pay"

//*********************************************************************************************************************
//**************************************************** Event Inq : 1 **************************************************
//************************************* Apply CC Surcharge And Call CC Amount Entry ***********************************
//*********************************************************************************************************************

Event Inq : 1

Prorate

if (@TTLDUE = 0)
exitwitherror errNothingToPay
endif


Var nCnt : N9
Var dItemTotal : $12
Var dDiscTotal : $12
Var dSvcTotal : $12
Var dTMedTotal : $12
Var dCheckTotal : $12

Var dSurchargePercent : $12
Var dCCPercent : $12
Var dSurchargeAmount : $12
Var dCCAmount : $12
Var strCCAmount : A20
Var bSurchargeFound : N1
Var nDtlCnt : N9


dItemTotal = 0.00
dDiscTotal = 0.00
dSvcTotal = 0.00
dTMedTotal = 0.00
dCheckTotal = 0.00

If Len(@USERENTRY) = 0 Then
//ExitWithError "You Must Enter An Amount First !!!"
dccAmount = @TTLDUE
Else
If @USERENTRY = 0 Then
//ExitWithError "Zero Is Not A Valid Amount !!!"
dccAmount = @TTLDUE
else

strCCAmount = @USERENTRY

If Instr(1, strCCAmount, ".") = 0 Then
If Len(strCCAmount) = 1 Then
Format strCCAmount As "." , "0", @USERENTRY
Else
Format strCCAmount As Mid(@USERENTRY, 1, ((Len(@USERENTRY) - 2))), ".", Mid(@USERENTRY, (Len(@USERENTRY) - 1), 2)
EndIf
EndIf

dCCAmount = strCCAmount

EndIf

EndIf
dCCPercent = 1.2




var tmpAmount : $12 = dCCAmount
Call roundAmount(tmpAmount)

if (tmpAmount <> dCCAmount)
ExitWithError "Amount must be round"
endif



dSurchargeAmount = ((dCCAmount * dCCPercent) / 100)
Call roundAmount(dSurchargeAmount)

If dCCPercent <> 0 Then
// LoadKyBdMacro Key(1, nSurchargeItem), MakeKeys(dSurchargeAmount), @KEY_ENTER
LoadKyBdMacro Key(5, 3), MakeKeys(dSurchargeAmount), @KEY_ENTER
EndIf

dFinalCCAmount = (dCCAmount + dSurchargeAmount)

if (bTesting)
waitforconfirm "surcharge amount: " , dSurchargeAmount
waitforconfirm "final amount: " , dFinalCCAmount
EndIf

// The below key is calling the event inquiry 2 which is below //

//LoadKyBdMacro Key(11, 1001)

// Calling Simphony 2x SPI CC Pay
var myKey : key
myKey = defkey("SimInquire", A:"EXECCOMP:2")
loadkybdmacro myKey

EndEvent

sub roundAmount(ref calcTtl)


var nDelta : N1
var bigInt : N12

bigInt = ToInteger(calcTtl)
nDelta = bigInt % 10

if (nDelta > 0) and (nDelta <> 5)
if nDelta < 3
bigInt = bigInt - nDelta
elseif nDelta < 5
bigInt = bigInt + (5 - nDelta)
elseif nDelta < 8
bigInt = bigInt - (nDelta - 5)
else
bigInt = bigInt + (10 - nDelta)
endif
calcTtl = bigInt
calcTtl = (calcTtl / 100)
endif


endsub


//*********************************************************************************************************************
//**************************************************** Event Inq : 2 **************************************************
//************************************* Enter Credit Card Amount And Call MPG CC Pay **********************************
//*********************************************************************************************************************

Event Inq : 2

//LoadKyBdMacro MakeKeys(dFinalCCAmount),Key(11, 1061)

// Calling Simphony 2x SPI CC Pay
var myKey : key
myKey = defkey("Payment", N:0, A:"CreditDebit:Loadable CreditAuthAndPay")
loadkybdmacro myKey, makekeys(dFinalCCAmount), @KEY_ENTER

EndEvent
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top