The following pre-save script will pop open a cash drawer when a document with a payment on it is saved. This example script was written to support an APG 100-series single cash drawer and can be customized with additional conditions for when the drawer should be opened.
Note: This script was updated on 5/25/2017
if (sd.val_Sales_Doc_ID == "WALK-IN" && sd.val_On_Account < sd.val_Total)
{
foreach (Bus.SalesDocumentPayment p in sd.Payments)
{
short paymentType = p.val_Payment_Type;
// Cash Deposit, Check Deposit, Cash Payment, Check Payment
if (paymentType == 1 || paymentType == 2 || paymentType == 4 || paymentType == 5)
{
try
{
System.Reflection.Assembly a =
System.Reflection.Assembly.LoadFrom(String.Format("{0}\\554QFNET11.dll", Apollo.Controller.StartupPath));
Type t2 = a.GetType("APGCashDrawer.APG554QFNET11"); object drawer = System.Activator.CreateInstance(t2); System.Reflection.MethodInfo mi = t2.GetMethod("OpenDrawer");
int result = Convert.ToInt32(mi.Invoke(drawer, new Object[] { })); if (result != 1)
{
string str = "Communication error [USB554]: OpenDrawer";
Messenger.Show(str);
}
}
catch (Exception ex)
{
Messenger.Show(ex.Message);
}
}
}
}
An additional DLL is required and can be downloaded here:
http://www.cashdrawer.com/wp-content/uploads/drivers/APG_USB554QFNet_v1.10.zip
Note: These drivers are provided by a third party and are not something that SalesPad controls
Important Reminders and Suggestions:
- This script is considered "as is" and any changes/modifications that might be needed would require a signed quote.
- If you are required to change a Security Option or Setting, your users will need to restart SalesPad before the changes take effect.
- Please install this on a test machine and run it against a test database before using it on your live system.
- You should always make sure you have a database backup prior to installing new software.
- Database Triggers, after final delivery, are the responsibility of the dealer/customer. SalesPad will not be responsible for maintaining copies of custom database objects.
- C# scripts, after final delivery, are the responsibility of the dealer/customer.
- This script will not work in a terminal server environment.