AnsweredAssumed Answered

Problem set field in print script

Question asked by willrollo on Feb 23, 2013
Latest reply on Feb 24, 2013 by philmodjunk

Title

Problem set field in print script

Post


     Here is my script for creating and then printing a deposit invoice. What I want, is to set field on another related layout depending in whether the customer has paid - I priovide the choice by a custom dialogue and subsequent if statements. I have tried adding this to the script after the choice if customer has paid, but it doesnt work...any ideas why?

     Go to layout ["Schedule"(invoice details)]

     Set Field [ INVOICE DETAILS::status; "Yes" ]

      

         
  •           Allow User Abort [ Off ]
  •      
  •           Set Error Capture [ On ]
  •      
  •           If [ INVOICE DETAILS::Deposit Created = "No" ]
  •      
  •           #Set up variables
  •      
  •           Freeze Window
  •      
  •           Set Variable [ $OriginalInvoiceID; Value:INVOICE DETAILS::ID_Invoice_pk ]
  •      
  •           Set Variable [ $order; Value:INVOICE DETAILS::fk_Order ]
  •      
  •           Set Variable [ $customerID; Value:INVOICE DETAILS::ID_Customer_Billing_fk ]
  •      
  •           Set Variable [ $DepositID; Value:INVOICE DETAILS::Deposit Amount ]
  •      
  •           Set Variable [ $Ref; Value:INVOICE DETAILS::Reference ]
  •      
  •           Set Variable [ $link; Value:INVOICE DETAILS::Deposit Link ]
  •      
  •           Set Field [ INVOICE DETAILS::Tax_Percentage; invoicedetails_PREF::Tax Rate ]
  •      
  •           Set Field [ INVOICE DETAILS::Tax Code; "Standard" ]
  •      
  •           Set Variable [ $VAT; Value:INVOICE DETAILS::Tax_Percentage ]
  •      
  •           Set Variable [ $VATCODE; Value:INVOICE DETAILS::Tax Code ]
  •      
  •           Set Field [ INVOICE DETAILS::Deposit Created; "Yes" ]
  •      
  •           #New Invoice details record
  •      
  •           New Record/Request
  •      
  •           #New Invoice record
  •      
  •           Set Field [ Invoices::fk_Invoice details ID; INVOICE DETAILS::ID_Invoice_pk ]
  •      
  •           Set Field [ INVOICE DETAILS::fk_Invoice; Invoices::Invoice Number ]
  •      
  •           Set Field [ INVOICE DETAILS::fk_Invoice Date; Invoices::Invoice Date ]
  •      
  •           Set Field [ INVOICE DETAILS::fk_Order; $order ]
  •      
  •           Set Field [ INVOICE DETAILS::ID_Customer_Billing_fk; $customerID ]
  •      
  •           Set Field [ INVOICE DETAILS::Deposit Amount; $DepositID ]
  •      
  •           Set Field [ INVOICE DETAILS::Reference; $Ref ]
  •      
  •           Set Field [ INVOICE DETAILS::Deposit Link; INVOICE DETAILS::ID_Invoice_pk ]
  •      
  •           Set Field [ INVOICE DETAILS::Deposit Link; $Link ]
  •      
  •           Set Field [ INVOICE DETAILS::Type; "Deposit" ]
  •      
  •           Set Field [ INVOICE DETAILS::Tax Code; $VATCODE ]
  •      
  •           Set Field [ INVOICE DETAILS::Tax_Percentage; $VAT ]
  •      
  •           Set Field [ INVOICE DETAILS::Deposit Created; "Yes" ]
  •      
  •           Perform Script [ “Copy Shipping to Shipping” ]
  •      
  •           Set Variable [ $InvoiceID; Value:INVOICE DETAILS::ID_Invoice_pk ]
  •      
  •           Freeze Window
  •      
  •           #Set up line items
  •      
  •           Go to Layout [ “Invoice Items” (invoicedetails_INVOICEITEM) ]
  •      
  •           New Record/Request
  •      
  •           Set Field [ invoicedetails_INVOICEITEM::ID_Invoice_fk; $InvoiceID ]
  •      
  •           Set Field [ invoicedetails_INVOICEITEM::Item; "Dep" ]
  •      
  •           Set Field [ invoicedetails_INVOICEITEM::Description; "Deposit for Club Fender" ]
  •      
  •           Set Field [ invoicedetails_INVOICEITEM::Price; INVOICE DETAILS::Deposit Amount/(INVOICE DETAILS::Tax_Percentage + 1) ]
  •      
  •           #Confirm payment
  •      
  •           Show Custom Dialog [ Title: "Settle Deposit"; Message: "Has the customer paid the deposit?"; Default Button: “Yes”, Commit: “Yes”; Button 2: “No”, Commit: “No” ]
  •      
  •           If [ Get (LastMessageChoice) = 1 ]
  •      
  •           Freeze Window
  •      
  •           

    Go to layout ["Schedule"(invoice details)]

         
  •      
  •           

    Set Field [ INVOICE DETAILS::status; "Yes" ]

         
  •      
  •           Go to Layout [ “Invoice” (INVOICE DETAILS) ]
  •      
  •           Set Field [ INVOICE DETAILS::Comments Invoice; "Received with thanks the sum of £" & INVOICE DETAILS::Deposit Amount ]
  •      
  •           Go to Layout [ “Schedule” (INVOICE DETAILS) ]
  •      
  •           Set Field [ INVOICE DETAILS::Schedule Base; "Deposit Paid" ]
  •      
  •           Refresh Window
  •      
  •           Commit Records/Requests [ Skip data entry validation; No dialog ]
  •      
  •           Go to Related Record [ From table: “invoicedetails_INVOICEITEM”; Using layout: “Invoice Print” (INVOICEITEMS) ] [ Show only related records ]
  •      
  •           Print Setup [ Orientation: Portrait; Paper size: 8.26" x 11.69" ] [ Restore; No dialog ]
  •      
  •           Print [ Current record; All Pages; Orientation: Portrait; Paper size: 8.26" x 11.69" ] [ Restore: Brother HL-3070CW series; No dialog ]
  •      
  •           Perform Find [ Specified Find Requests: Find Records; Criteria: INVOICE DETAILS::ID_Invoice_pk: “$OriginalInvoiceID” ] [ Restore ]
  •      
  •           Set Field [ INVOICE DETAILS::Deposit Link; $OriginalInvoiceID ]
  •      
  •           Set Field [ INVOICE DETAILS::Deposit Link; $InvoiceID ]
  •      
  •           Show Custom Dialog [ Title: "Select Customer"; Message: "Please add a new payment for this customer"; Default Button: “OK”, Commit: “Yes” ]
  •      
  •           Go to Layout [ “Payment List” (PYMNT) ]
  •      
  •           End If
  •      
  •           If [ Get (LastMessageChoice) = 2 ]
  •      
  •           Freeze Window
  •      
  •           

    Go to layout ["Schedule"(invoice details)]

         
  •      
  •           

    Set Field [ INVOICE DETAILS::status; "No" ]

         
  •      
  •           Go to Layout [ “Invoice” (INVOICE DETAILS) ]
  •      
  •           Set Field [ INVOICE DETAILS::Comments Invoice; "We shall commence manufacture on receipt of this deposit." ]
  •      
  •           Commit Records/Requests [ Skip data entry validation; No dialog ]
  •      
  •           Go to Related Record [ From table: “invoicedetails_INVOICEITEM”; Using layout: “Invoice Print” (INVOICEITEMS) ] [ Show only related records ]
  •      
  •           Print Setup [ Orientation: Portrait; Paper size: 8.26" x 11.69" ] [ Restore; No dialog ]
  •      
  •           Print [ Current record; All Pages; Orientation: Portrait; Paper size: 8.26" x 11.69" ] [ Restore: Brother HL-3070CW series; No dialog ]
  •      
  •           If [ Get (LastError) = 0 ]
  •      
  •           #Set Print TimeStamp
  •      
  •           Enter Browse Mode
  •      
  •           Go to Layout [ “Invoice” (INVOICE DETAILS) ]
  •      
  •           Set Field [ INVOICE DETAILS::TimeStamp_Printed Invoice; Get (CurrentTimeStamp) ]
  •      
  •           End If
  •      
  •           Go to Layout [ “Order” (INVOICE DETAILS) ]
  •      
  •           Show Custom Dialog [ Title: "Reminder!!"; Message: "Don't forget to chase the customer for the deposit!"; Default Button: “OK”, Commit: “Yes” ]
  •      
  •           Perform Find [ Specified Find Requests: Find Records; Criteria: INVOICE DETAILS::ID_Invoice_pk: “$OriginalInvoiceID” ] [ Restore ]
  •      
  •           Set Field [ INVOICE DETAILS::Deposit Link; $OriginalInvoiceID ]
  •      
  •           Set Field [ INVOICE DETAILS::Deposit Link; $InvoiceID ]
  •      
  •           Go to Layout [ “Schedule” (INVOICE DETAILS) ]
  •      
  •           Set Field [ INVOICE DETAILS::Schedule Base; "Awaiting Deposit" ]
  •      
  •           Go to Layout [ “Order” (INVOICE DETAILS) ]
  •      
  •           End If
  •      
  •           End If

Outcomes