Om - POS with discount amount

Discussion in 'Free Source Codes' started by Devendra_Rawat, Jul 25, 2019.

    
  1. Devendra_Rawat

    Devendra_Rawat Well-Known Member


    By Omkar

    Only cash mode is supported

    Members are invited to modify other payment mode and contribute
    Code:
    [#Part : CMP TallyShopFeaturesTitle]
        Add    : Line    : After        : CMP TallyShopFeaturesTitle    : OM_POS_Enabled
    
    [Line : OM_POS_Enabled]
       
        Field    : Long Prompt, OM_POS_Enabled
        Local    : Field    : Long Prompt    : Info    : $$LocaleString:"Enable Quick POS ?"
        Local    : Field    : Long Prompt    : Width    : 50
       
    [Field : OM_POS_Enabled ]
       
        Use     : Logical Field
        Storage : Udf_POS_IsEnabled
        On        : Accept    : Yes: Set : OM_POS_Enabled : $$Value
        On        : Accept    : Yes: Field Accept
    
    
    [System : UDF]
        Udf_POS_IsEnabled : Logical : 1900
    
    [Variable : OM_POS_Enabled]
        Type        : Logical
        Persistent    : Yes
       
    [System : Variables]
        OM_POS_Enabled  : No
    
    [System : Formula]
        OM_POS_IsEnabled : $Udf_POS_IsEnabled:Company:##SVCurrentCompany
    ;-------------------------------------------------------------------------------------------------------------------------
    
    [#Menu: Gateway Of Tally]
    
            Add : Item : Before : @@locQuit: Quick POS : Alter : OM_POS_Sales    : @@OM_POS_IsEnabled
    
    ;----------------------------------------------------------------------------------------------------------------------
           
    [#Form: POS Invoice Color]
        Option    : OM_Pos_Form : @@OM_POS_IsEnabled
    
    [#Form: Voucher]
        Add     : Switch    : VchTypeColor    : OM_Pos_Form : $$IsSales:##SVVoucherType AND @@IsPOSInvoice AND  @@OM_POS_IsEnabled
    
    [#Part: EI InvInfo]
        Add: Total: OM_POS_InvDiscount
       
    [#Line: EI InvInfo]
        Add: Right Field: OM_POS_InvDiscount
    
            
    [Field    : OM_POS_InvDiscount]
        Use            : Amount Forex Field
        Set As        : @Discount
        Discount    : ($Rate * $BilledQty) * $Discount / 100
        Invisible    : Yes
    ;-------------------------------------------------------------------------------------------------------------------------
    
    [Report: OM_POS_Sales]
        Use        : Voucher
        Delete    : Forms
        Add        : Form     : OM_POS_Sales
        Title     : "POS Sales Form"
        ;Set        : svVoucherType    :  "Pos Invoice"
        Set        : svVoucherType    :  $$FilterValue:$Name:VoucherType:1:PosInvoiceName
    
    [Form: OM_POS_Sales]
        Use        : Voucher
        Add     : Switch    : VchTypeColor    : OM_Pos_Form : $$IsSales:##SVVoucherType AND @@IsPOSInvoice AND  @@OM_POS_IsEnabled
       
        Set        : svVoucherType    :  $$FilterValue:$Name:VoucherType:1:PosInvoiceName
        SET        : InventoryVch     : Yes
        SET     : AccountsVch     : No
       
    [System    : Formulae]
        PosInvoiceName : $UseForPOSInvoice = Yes
       
    [!Form: OM_Pos_Form ]
        ;Use        : Voucher
        Use        : POS Invoice
        Delete    : Bottom Part
        Add        : Bottom Part:  OM_POS_Bottom, VCH POS Narration  ;OM_POS_Bottom
       
    [Part    : OM_POS_Bottom]
       
        Left Part    : OM_CustInfo
        Right Part    : OM_ModeOfReceipts
        Scroll        : Horizontal
       
       
    [{Part    : OM_CustInfo]
        Line    : OM_CustName, Om_CustMobile
        Border    : Thin Top
       
        [Line: OM_CustName]
            Field    : Long Prompt, Om_CustName
            Local  : Field : Long Prompt   : Set as        : $$LocaleString:"Customer Name"
            Local    : Field    : Default : Style    : Small Bold
            Local  : Field : Long Prompt   : Style    : Normal
            Space Bottom    : .20
                    
        [Line: Om_CustMobile]
            Field    : Long  Prompt, Om_CustMobile
            Local  : Field : Long Prompt   : Set as        : $$LocaleString:"Customer Mobile"
            Local    : Field    : Default : Style    : Small Bold
            Local  : Field : Long Prompt   : Style    : Normal
            Space Bottom    : .20
                    
            [Field    : OM_CustName]
                Use: Name Field
                Storage    : uPOS_CustName
                Width    : @@NameWidth
               
            [Field    : OM_CustMobile]
                Use        : Number Field
                Storage    : uPOS_CustMobile
                Format    : NoComa
                Width    : @@NameWidth
    
    [System    : UDF]
        uPOS_CustName     : String: 1020
        uPOS_CustMobile : Number: 1030
               
    ;;--------------------------------------------------------------------
    
    [Part: OM_ModeOfReceipts]
                Local   : Field        : Short Prompt          : Width             : @@MediumWidth
                Local   : Field        : Short Prompt          : Skip              : Yes
                Local   : Field        : Medium Prompt         : Width             : 12
    
                Switch    : VCH POSRecptMode                    : OM_POS_NORMAL : (NOT @@POSINVClassFmt) OR $$InDuplicateMode
                Switch    : VCH POSRecptMode                    : VCH POS WithClass : @@POSINVClassFmt
               
                Option    : Small Size Part
                Border    : Thin Top
    
            [!Part: OM_POS_NORMAL]
    
                    Line    : OM_POS_InvoiceTotalLines, VCH POS Coupon Receipt, VCH POS Card Receipt
                    Line    : VCH POS Bank Receipt, OM_POS_ Cash Receipt
                    Height    : 10
                   
                    [Line    : OM_POS_InvoiceTotalLines]
                        Line: OM_POS_InvoiceTotal, OM_POS_Discount,  OM_POS_NET
                   
                    [Line: OM_POS_InvoiceTotal]
                        Fields    : Long Prompt
                       
                        Right Fields: EI QtyTotal,VchInclRateTitle, EI RateTotal, EI RatePerTotal, EI DiscTotal,OM_POS_InvoiceTotal
                        Local  : Field : Long Prompt   : Set as       : $$LocaleString:"Total"
                        Local    : Field    : Default    : Delete    : Border
                       
                        ;Local    : Field    : Default    :  Border: Sub Totals
                        ;Border    : Sub Totals
                        Space Bottom    : .10
                       
                        [Field: OM_POS_InvoiceTotal]
    
                            Use         : Amount Field
                            Set as      : $$AmountAdd:@SetVal:#OM_POS_Discount
                            SetVal      : $$AmountAdd:@AccValTotal:$$Total:VCHValue             ;;In case of negative Bill Value, NetAmount failed to give correct Total, so AmountAdd is Used
                            AccValTotal : If (@@UseClassFmt AND $$InCreateMode AND NOT $$InduplicateMode) Then $$Total:CIValue Else $$Total:EIValue
                            Set always  : Yes
                            Skip        : Yes
                            Border      : Totals
                            Width       : If @@IsRightToLeftScript Then @@VCHAmountWidth Else (@@VCHAmountWidth + (@@VCHRateUnitsWidth + @@VCHRateWidth + 1.9))
                            Format      : "All Symbols"    
                       
                    [Line    : OM_POS_Discount]
                        Fields    : Long Prompt,
                        Right Field    :  EI QtyTotal, VchInclRateTitle, EI RateTotal, EI RatePerTotal, EI DiscTotal, OM_POS_Discount
                        Local  : Field : Long Prompt   : Set as       : $$LocaleString:"Discount Amount"
                        Local    : Field    : VchInclRateTitle    : Set as    :  ""
                        Local    : Field    : EI BilledQtyTotal    : Set as    :  ""
                        Local    : Field    : EI ActualQtyTotal    : Set as    :  ""
                        Local    : Field    : Default    : Delete    : Border
                        Local  : Field : Long Prompt   : Style    : Normal
                        ;Border    : Sub Totals
                       
                    [Line    :OM_POS_NET]
                            Fields    : Long Prompt
                           
                            Right Field    :  EI QtyTotal, VchInclRateTitle, EI RateTotal, EI RatePerTotal, EI DiscTotal, OM_POS_NET
                            Local   : Field : Long Prompt   : Set as        : $$LocaleString:"Net Amount"
                            Local    : Field    : VchInclRateTitle    : Set as    :  ""
    ;                        Local    : Field    : EI RateTotal        : Delete    : Invisible
    ;                        Local    : Field    : EI RatePerTotal    : Delete    : Invisible
                            Local    : Field    : EI DiscTotal        : Delete    : Invisible
                            Local    : Field    : VchInclRateTitle    : Border    : Totals
                            Local    : Field    : Default : Style    : Small Bold
                            Local   : Field : Long Prompt   : Style    : Normal
                            Space Bottom: 0.5
                       
                            [Field    : OM_POS_Discount]
                                Use            : Amount Forex Field
                                Skip        : Yes
                                Set as        : $$Total:OM_POS_InvDiscount
                                Border      : Totals
                                Width       : If @@IsRightToLeftScript Then @@VCHAmountWidth Else (@@VCHAmountWidth + (@@VCHRateUnitsWidth + @@VCHRateWidth + 1.9))
                                Format      : "All Symbols"    
    
                            
                            [Field    : OM_POS_Net]
                                Use            : Amount Forex Field
                                Set as      : $$AmountSubtract:@SetVal
                                Border      : Totals
                                Width       : If @@IsRightToLeftScript Then @@VCHAmountWidth Else (@@VCHAmountWidth + (@@VCHRateUnitsWidth + @@VCHRateWidth + 1.9))
                                Format      : "All Symbols"    
                                Skip        : Yes
                                SetVal      : $$AmountAdd:@AccValTotal:$$Total:VCHValue             ;;In case of negative Bill Value, NetAmount failed to give correct Total, so AmountAdd is Used
                                AccValTotal : If (@@UseClassFmt AND $$InCreateMode AND NOT $$InduplicateMode) Then $$Total:CIValue Else $$Total:EIValue
                           
                               
                    [Line: OM_POS_ Cash Receipt]
                            Lines        : OM_POS_Invisible_Line, OM_POS_Visible_Lines
                           
                        [Line    : OM_POS_Invisible_Line]
                            Field     : VCH POSCashPaymentType, VCH POS  CashDeemedPos,  VCH POSCashLedgerName, VCH POSCashNoZero
                       
                        [Line    :    OM_POS_Visible_Lines]
                                Lines    : OM_POS_CashLedger,  OM_POS_CashAmt, OM_POS_Tender, OM_POS_Balance
                               
                            [Line    : OM_POS_CashLedger]
                                 Fields    : Long Prompt, OM_PO_CashLedger
                                 Local  : Field : Long Prompt   : Set as        : $$LocaleString:"Cash"
                                 Local    : Field    : Default : Style    : Small Bold
                                 Local  : Field : Long Prompt   : Style    : Normal
                                 Space Bottom    : .10
                                
                            [Line    : OM_POS_Tender]
                                Field   : Long Prompt, OM_POS_MoneyTendered
                                Local   : Field : VCH POS MoneyTendered : Inactive      : $$IsEmpty:#OM_POSCashAmount
                                Local  : Field : Long Prompt   : Set as        : $$LocaleString:"Money Tendered"
                                Local    : Field    : Default : Style    : Small Bold
                                Local  : Field : Long Prompt   : Style    : Normal
                                Space Bottom    : .10
                               
                            [Field: OM_PO_CashLedger]
    
                                Use         : Name Field
                                Storage     : LedgerName:LedgerEntries:First:@@IsPOSCashLedger
                                Table       : POS Cash Ledgers                          : ##POSSinglePayment   
                                Table       : POS Cash Ledgers Extract, NOT Applicable  : NOT ##POSSinglePayment
                                Keys        : Create Ledger, Alter Ledger
                                Variable    : SV Ledger
                                Width       : @@VCHNameWidth
                                Show Table  : On Blank
                               
                                PaymentTotal: ($$Abs:@@POSGiftAmount + $$Abs:@@POSCardAmount + $$Abs:@@POSBankAmount)
                                InvoiceTotal: $$Abs:#OM_POS_InvoiceTotal
                               
                                Skip        : @PaymentTotal = @InvoiceTotal OR #OM_POS_InvoiceTotal = 0
                                Option      : VCH POSForced : NOT $$InAlterMode
                                Validate    : If @PaymentTotal = @InvoiceTotal Then Yes Else NOT $$IsNotApplicable:$$Value
               
                            [Line    : OM_POS_CashAmt]
                                Fields    : Long Prompt ,  OM_POSCashAmount
                                Local  : Field : Long Prompt   : Set as        : $$LocaleString:"Cash Amount"
                                Local    : Field    : Default : Style    : Small Bold
                                Local  : Field : Long Prompt   : Style    : Normal
                                Space Bottom    : .10
                           
    
                            [Line    : OM_POS_Balance]
                                Field   : Long Prompt , OM_POS_Balance
                                Local  : Field : Long Prompt   : Set as        : $$LocaleString:"Balance/ Returned"
                                Local    : Field    : Default : Style    : Small Bold
                                Local  : Field : Long Prompt   : Style    : Normal
                                Space Bottom    : .20
                                
    
    ;                        Local           : Field : Medium Prompt                 : Set as        : If $$IsNOTApplicable:#VCHPOSCashLedger Then " " Else $$LocaleString:"Cash tendered:"
    ;                       Local           : Field : Simple Prompt                 : Set as        : If $$IsNOTApplicable:#VCHPOSCashLedger Then " " Else $$LocaleString:"Balance" + ":"
                            Local           : Field : Simple Prompt                 : Width         : 8
      ;                     
    
    [Field    : OM_POSCashAmount]
        Use                 : Amount Forex Field
        Storage             : Amount:LedgerEntries:First:@@IsPOSCashLedger
                         
        Set By Condition    : ##POSSinglePayment                        : @locPOSSingleAmt
        Set By Condition    : @PaymentBalance = @InvoiceTotal            : $$AsAmount:0
        Set By Condition    : @IsFieldEdited                            : @InvoiceTotal - @PaymentBalance
        Set By Condition    : ($$InCreateMode AND @IsEmptyPayment)         : @InvoiceTotal
        Set as                : $$Value
    
        IsEmptyPayment        : @IsEmptyGiftAmount AND @IsEmptyBankAmount AND @IsEmptyCashAmount
    
        IsEmptyGiftAmount    : ($$IsEmpty:$LedgerEntries[1, @@IsPOSGiftLedger].Amount)
        IsEmptyBankAmount    : ($$IsEmpty:$LedgerEntries[1, @@IsPOSChequeLedger].Amount)
        IsEmptyCashAmount    : ($$IsEmpty:$LedgerEntries[1, @@IsPOSCashLedger].Amount)
       
    ;Below formula is introduce to resolve the Cash Calculation Problem, if any of below fields values are getting change then re-calculation will happen
        IsFieldEdited         : ($$IsFieldEdited:VCHPOSCouponAmount OR $$IsFieldEdited:VCHPOSCardAmount OR $$IsFieldEdited:VCHPOSBankAmount)
    
        InvoiceTotal        : $$Abs:#OM_POS_Net
        PaymentBalance        : $$Abs:(#VCHPOSCouponAmount + #VCHPOSCardAmount + #VCHPOSBankAmount)
        PaymentTotal        : $$Abs:@@POSGiftAmount + $$Abs:@@POSCardAmount + $$Abs:@@POSBankAmount + $$Abs:@@POSCashAmount
    
        Validate            : If $$IsNegative:#OM_POS_Net Then $$Abs:($$Value + #VCHPOSBankAmount + #VCHPOSCardAmount + #VCHPOSCouponAmount) = $$Abs:#OM_POS_Net Else +
                                $$Abs:($$Value + #VCHPOSBankAmount + #VCHPOSCardAmount + #VCHPOSCouponAmount) = $$Abs:#OM_POS_Net AND NOT $$IsNegative:$$Value
    
        Set Always          : Yes
        Format              : "Symbol, No Zero," + ##ShowForex 
               
        Inactive            : $$IsNOTApplicable:#VCHPOSCashLedger OR $$IsEmpty:#VCHPOSCashLedger
        Skip                : $$IsNotApplicable:#VCHPOSCashLedger OR $$AmountAdd:#VCHPOSBankAmount:$$AmountAdd:#VCHPOSCardAmount:#VCHPOSCouponAmount = #OM_POS_Net OR ##POSSinglePayment
       
        locPOSSingleAmt     : If $$IsEmpty:#VCHPOSCardAmount AND $$IsEmpty:#VCHPOSCouponAmount AND $$IsEmpty:#VCHPOSBankAmount +
                                Then #OM_POS_Net Else $$Value
       
    [Field: OM_POS_MoneyTendered]
    
        Use         : Amount Forex Field
        Storage     : POSCashReceived                        
        Validate    :  If (@@UseClassFmt AND $$InCreateMode) AND NOT $$InDuplicateMode +
                       Then $$Value >= $$AsPositive:#CIPOSCashAmount Else $$Value >= $$AsPositive:#OM_POSCashAmount      ;;AsPositive is used so that the cases of Positive and Negative Cash Amount both are considered.
        Format      : "Symbol, No Zero," + ##ShowForex
        Set Always  : Yes
    
    [Field: OM_POS_Balance]
    
        Use         : Amount Forex Field
        ;;AsPositive is used so that the cases of Positive and Negative Cash Amount both are considered.                 
        Set as      : If NOT $$IsEmpty:#OM_POSCashAmount AND #OM_POS_MoneyTendered > $$AsPositive:#OM_POSCashAmount Then $POSCashReceived - $$AsPositive:#OM_POSCashAmount Else +
                      If NOT $$IsEmpty:#CIPOSCashAmount AND #OM_POS_MoneyTendered > $$AsPositive:#CIPOSCashAmount Then $POSCashReceived - $$AsPositive:#CIPOSCashAmount Else ""         
        Set Always  : Yes
        Skip        : Yes
        Format      : "Symbol, No Zero," + ##ShowForex 
    
    pai OM Pos.jpg
     
    sandeep76out, ONKAR and Rohit Khedar like this.


  2. ONKAR

    ONKAR Active Member


    @garima aka Devendra Rawat sir, thank you so much, you are great sir, thank you so much. keep help me like this, good work sir.✌✌
     
    sandeep76out likes this.


  3. tejeet

    tejeet Member


    Tdl help needed - i am not able to print msme reg. no in invoice print, so please correct my code, so that i can able to print msme registration no on my invoice, my codes are as follows :-

    [System: UDF]
    [#Part: CMP AccFeat Left]
    Line : my msme

    [Line: my msme]
    Field : Long Prompt, my msme
    Local : Field : Long Prompt : Set as : $$LocaleString:"my msme reg. no."
    Local : Field : Default : Style : Small Bold
    Local : Field : Long Prompt : Style : Normal
    Space Bottom : .20

    [Field : my msme]
    Use: Name Field
    Storage : my msme1
    Width : @@NameWidth

    [System : UDF]
    my msme1 : String: 1020
    [#Part: EXPINV Basicleft]
    Add: Parts: sms1011
    [Part: sms1011]
    Line: EXP INV SubTitle
    Bottom Line : sm1011
    Height : 9 mms
    Border : Full Thin Bottom
    Local : Field : EXPINV SubTitle : Info : "Our Msme Reg. No.:"
    [Line : sm1011 ]
    Field : Name Field
    Local : Field : Name Field :Set As : $my msme1
    Local : Field : Name Field : Width: 0 PAGE



    ;;-------------End List---------------;;
     
    ONKAR likes this.


  4. ONKAR

    ONKAR Active Member


    check this post

    http://tdlexpert.com/index.php?threads/print-msme-reg-number-in-invoice-print.6841/
     
    tejeet likes this.


  5. tejeet

    tejeet Member


    THANK YOU VERY MUCH MR. ONKAR
     
    ONKAR likes this.


  6. ONKAR

    ONKAR Active Member


    have a good day bro , keep always helps others
     


  7. sandeep76out

    sandeep76out New Member


    Good Job Sir _()_ thank you for you help to new members god bless all of you :)
     
    ONKAR likes this.


  8. udaya

    udaya Active Member


    Great.....
     


Share This Page