Free Source code : SMS Module

Discussion in 'Free Source Codes' started by lumos, Mar 22, 2019.

    
  1. lumos

    lumos Member


    Hello Everyone, I am new here and this forum has helped me immensely in learning TDL.
    This is a simple code to send SMS at Gateway of Tally.
    Replace API code with yours.
    This is built upon existing code found in forums with further improvements.

    Code:
    ;;**********==============Sending SMS at Gateway=============***********;;
    
    ;;[#Menu: Gateway OF Tally] ;;Adding button in main menu
    ;;    Add: Buttons: PartyLedgerhotkey
    ;;    Add :Key Item :Before : @@locQuit : Sms Party :: Alter:partyLedgerclosingbalance
    
    [Button: PartyLedgerhotkey] ;;Adding Another on the side
        Key: ALT + Z
        Action: alter : PartyLedgerclosingbalance
        Title: "SMS Party"
    
    [Report: PartyLedgerclosingbalance] ;;calling report definition
        Form: PartyLedgerclosingbalance
        Title: "SMS Party"
        Variable:partyLedgerselect
    ;=================================================;;
    
    
    ;;================PartyLedgerSelect ==============;
    
    [Variable : PartyLedgerselect]
        Type : String
        Persistent : Yes
    
    [Field: PartyLedgerselect] ;;selecting name of party
        Use: short name field
        Table: Ledger
        Modifies: PartyLedgerselect
    
    ;=================================================;;
    
    
    ;;============PartyLedgerclosingbalance===========;
    
    [Form: PartyLedgerclosingbalance]  ;;SMS Text form
        ON : Form Accept : Yes : CALL : TestSMS  ;;calling for sms function
        Part: PartyLedgerclosingbalance
    
    [Part: PartyLedgerclosingbalance]
        Line: PartyLedgerName, SMSText,PartyLedgerclosingbalance  ;;Name, sms text and closing balance fields of selected party
    
    ;================================================;;
    
    
    ;;===========Defining Feilds for sms=============;
    
    ;;============Name Field=========;
    [Line: PartyLedgerName]
        Field:partyLedgerName ,PartyLedgerselect
    
      [Field:partyLedgerName]
          Use:Name field
          Set as:"Party Name :"
          Skip:Yes
    ;===============================;;
    
    ;;============Text Field=========;
    [Line:SMSText]
        Field:SMSTitle,SMSText
      [Field:smstitle]
          Use:Name Field
          Set as:"SMS Text :"
          Skip:Yes
      [Field:SMSText]
          Use:Name field
          Set as:"Dear Customer your closing balance is "
          Width: 75 mms
          Line:5
          ;Storage: SMSUDF
    ;===============================;;
    
    ;;====Closing balance Field=====;
    [Line: PartyLedgerclosingbalance]
        Field: PartyClosingBalance,Clbal
    
      [Field:partyClosingBalance]
          Use:Name field
          set as:"Party Closing Balance :"
          Skip:Yes
      [Field:Clbal]
          Use:Name field
          Set as:$ClosingBalance:Ledger:#PartyLedgerselect
    
    ;===============================;;
    
    ;================================================;;
    
    ;;================Function for sms===============;
    
    [Function:TestSMS]
    
    00 : WALK COLLECTION : Send SMS Coll
    10 : END WALK
    20 : MSGBox : "Status":"Message Sent \n Successful"
    30 : Return
    
    ;===============================================;;
    
    
    ;;============Collection For SMS===============;
    [Collection: Send SMS Coll]
    Remote URL :"http://api.msg91.com/api/sendhttp.php?authkey=<Your auth key here>&sender=<Sender>&route=4&mobiles="+@@getmob+"&message="+@@smsText+@@clbal
    ;==============================================;;
    
    
    ;;============Formula for accessing============;
    [System : formula]
    Getmob : $LedgerMobile:Ledger:#PartyLedgerselect
    Clbal : #clbal
    smstext : #SMSTEXT
    
    [System : Formulae]
    PartyLedgerselect : ""
    ;==============================================;;
    
    
    ;;*************==============End of Code=============*************;;
    Suggest improvements if any.
     
    Last edited: Mar 24, 2019


  2. gcom

    gcom New Member


    sms not working
     


  3. Amit Kamdar

    Amit Kamdar Administrator Staff Member


    Please read the 3rd line in Post # 1............. replace that and it will work.
     


  4. lumos

    lumos Member


    As pointed out by Amit Sir you will need to register to a SMS gateway provider and replace api key/credentials provided with yours.
     


  5. Zeedk90

    Zeedk90 New Member


    I am really happy to find all of these details! Finding appropriate options as per your budget for the marketing is very difficult thing but I'm so glad that with the help of business texting service I have been getting awesome results. This service was suggested to me by my cousin and I will suggest it to other business owners as well.
     


  6. saket

    saket New Member


    Can anybody help me the below code i want to add message box that "do you want to send sms" yes or no

    [System: Formula]
    Billno : $$String:$Vouchernumber
    Mobileno : $Ledgermobile:Ledger:$Partyledgername
    Party : $$Stringwordex:$Partyledgername:" ":1



    Linemsg : "Dear%20Customer%20,"+"Your%20Invoice%20No:%20"+$$String:$VoucherNumber+",%20Amount%20"+$$String:$amount+"%20Date%20"+$$String:##VARVchDate+"has%20been%20generated%20From%20Saket%20Electronics."

    [#Form: Sales Color]
    Add : Button : SENT MSG

    [Button: SENT MSG]
    Option : SalesSMSA : $VoucherTypeName="Sales"

    [!Button: SalesSMSA]
    Key : Alt + S
    Action :Call :TestFunction

    [Function:TestFunction]
    10 : WALK COLLECTION : Send SMS Coll
    20 : MSGBox : "Status":"Message Sent \n Successful"
    30 : END WALK

    [Collection: Send SMS Coll]
    Remote URL :"http://msg.myctrlbox.com/API/WebSMS/Http/v2.3.6/api.php?username=xxxx&api_key=xxx&sender=xxxx&to=91"+@@Mobileno+"&message="+@@Linemsg



    ;; DEM

    [#Form: Sales Color]


    On : Form Accept: @@IsSales : CALL : TestFunction
     


  7. saket

    saket New Member


    Here is Simple working SMS Code

    ;;;;;;;;;;;;;;;;;Start of SMS Code

    ;;;;;;;;;;;;;;;Add Mobile Number in POS Voucher

    [System: UDF]
    POS_Mobile: String: 1001

    [#Part: EI PartyLedger]
    Add : Line : Before : EI PartyAddress : POS_lnMobile

    [Line: POS_lnMobile]
    Add: Field: POS_lblMobile
    Add: Field: POS_fldMobile

    [Field: POS_lblMobile]
    Info: "Mobile Number :"
    Width: 20
    [Field: POS_fldMobile]
    Use: Short Name Field
    Storage: POS_Mobile
    Width: 12

    ;;;;;;;;;;;;;;;SMS Code for Sales Voucher

    [System: Formula]
    Billno : $$String:$Vouchernumber
    Mobileno : $Ledgermobile:Ledger:$Partyledgername
    Party : $$Stringwordex:$Partyledgername:" ":1

    Linemsg : "Dear%20Customer%20,"+"Your%20Invoice%20No:%20"+$$String:$VoucherNumber+",%20Amount%20"+$$String:$amount+"%20Date%20"+$$String:##VARVchDate+"has%20been%20generated%20From"

    [#Form: Sales Color]
    Add : Button : SENT MSG

    [Button: SENT MSG]
    Option : SalesSMSA : $VoucherTypeName="Sales"

    [!Button: SalesSMSA]
    Key : Alt + S
    Action :Call :TestFunction

    [Function:TestFunction]
    10 : QUERYBOX : "Send SMS ?" : Yes:No
    20 : IF : $$LastResult
    30 : WALK COLLECTION : Send SMS Coll
    40 : END WALK
    50 : MSGBox : "Status":"Message Sent \n Successful"
    60 : ENDIF

    [Collection: Send SMS Coll]
    Remote URL :"http://msg.myctrlbox.com/api.php?username=xxx&api_key=xxx&sender=xxxx&to=91"+@@Mobileno+"&message="+@@Linemsg

    [#Form: Sales Color]

    On : Form Accept: YES : CALL : TestFunction

    ;;;;;;;;;;;;;;;SMS Code for POS Sales Voucher

    [System: Formula]
    Billno : $$String:$Vouchernumber
    Mobileno1 : $$String:$POS_Mobile
    Party : $$Stringwordex:$Partyledgername:" ":1

    Linemsg1 : "Thank's%20For%20Shopping%20at%20With%20Us."+"Your%20Invoice%20No%20is:%20"+$$String:$VoucherNumber+

    [#Form: POS Invoice Color]
    Add : Button : SENT MSG POS

    [Button: SENT MSG POS]
    Option : SalesSMSAPSO : @@IsPOSInvoice

    [!Button: SalesSMSAPOS]
    Key : Alt + S
    Action :Call :posSMS

    [Function:posSMS]
    10 : QUERYBOX : "Send SMS ?" : Yes:No
    20 : IF : $$LastResult
    30 : WALK COLLECTION : Send Pos SMS Coll
    40 : END WALK
    50 : MSGBox : "Status":"Message Sent \n Successful"
    60 : ENDIF

    [Collection: Send Pos SMS Coll]
    Remote URL :"http://msg.myctrlbox.com/api.php?username=xxx&api_key=xxx&sender=xxx&to=91"+@@Mobileno1+"&message="+@@Linemsg1

    [#Form: POS Invoice Color]

    On : Form Accept: YES : CALL : PosSMS

    ;;;;;;;;;;;;;;;;;End of SMS Code
     


  8. mharit1

    mharit1 Member


    How to Buy SMS and API
     


  9. saket

    saket New Member



  10. Yash Agarwal

    Yash Agarwal New Member



    Is there any way we can add Vehicle Number & Total Billed Qty. in the message?
     


  11. Dipak_0003

    Dipak_0003 New Member


    I am looking for SMS module work in Kenya. Is it possible?
     


Share This Page