📁 Showcase
Payment Collect Sheet

Payment collection sheet

Backend

1. Variables

// picker variable for payment type

ensure var VarSetOfTextPaymentType kind: setOfText 
  deploy: fixedOnDeploy 
  value: "<root>
      <node key='neft'>NEFT/RTGS</node>
      <node key='cheque'>Cheque</node>
      <node key='cash'>Cash</node>
    </root>"

2. PaymentCollectionSheet

// this spreadsheet stores payment collection data

ensure spreadsheet: PaymentCollectionSheet
  withFields: [Date]
  ofTypes: [date]
  removeRoleSet: [Owner]
  insertRoleSet: [Agent]
  updateRoleSet: [Owner]  
  readRoleSet: [Owner]

ensure form EntityPayment label: "Payment Collection"
ensure section: Details
ensure field VisitRef kind: ref
  spreadsheet: VisitBook 
  copyFieldMap: {
      'VisitRowId': '$RowId',
      'CustomerName': 'CustomerName',
      'MobileNumber': 'MobileNumber',
      'CustomerType': 'CustomerType',
      'GSTNo': 'GSTNo'
    } 
  layoutSpreadsheet: ListLayout 
ensure field Amount kind: number 
ensure field PaymentMode kind: pickText sourceVar: VarSetOfTextPaymentType
ensure field DepositDate kind: date 
ensure field ChequeImage kind: camera 
  placeHolder: "Cheque Image" 
  helperText: "Cheque Image" 
  showLabel: false
ensure field Attachment kind: document fileTypeSet: ["any"]
ensure field Remarks kind: paragraph 

ensure visibilityRule IfCheque 
  condition: "<root>
      <or>
        <stmt>Details.PaymentMode == ${d:PaymentMode.cheque}</stmt>
      </or>
    </root>"
ensure actionMapIfTrue ShowChequeImage 
  comp: Details.ChequeImage 
  visibilityAction: visible
ensure actionMapIfTrue ShowDepositDate 
  comp: Details.DepositDate 
  visibilityAction: visible

ensure visibilityRule NotCheque 
  condition: "<root>
      <or>
        <stmt>Details.PaymentMode != ${d:PaymentMode.cheque}</stmt>
      </or>
    </root>"
ensure actionMapIfTrue HideChequeImage 
  comp: Details.ChequeImage 
  visibilityAction: hidden
ensure actionMapIfTrue HideDepositDate 
  comp: Details.DepositDate 
  visibilityAction: hidden

ensure visibilityRule PaymentModeNEFT 
  condition: "<root>
      <stmt>Details.PaymentMode == ${d:PaymentMode.neft}</stmt>
    </root>"
ensure actionMapIfTrue ShowAttachment 
  comp: Details.Attachment 
  visibilityAction: visible 
  visibilityActionOn: field
ensure actionMapIfFalse HideAttachment
  comp: Details.Attachment 
  visibilityAction: hidden 
  visibilityActionOn: field

Frontend

1. AddPaymentCollection

// this action will insert payment collection to spreadsheet

ensure action AddPaymentCollection kind: rowInsert 
  icon: "AddCardRounded" 
  spreadsheet: PaymentCollectionSheet 
  sendMessageToInbox: true

2. ViewPaymentCollectionSheet

// this action will allow user to view and edit payment

ensure spreadsheet PaymentCollectionSheet 
ensure layoutSpreadsheet TableLayout kind: table 
  showComps: [Date, CustomerName, MobileNumber, CustomerType, GSTNo, Amount, PaymentMode] 

ensure action ViewPaymentCollectionSheet kind: spreadsheetEditor 
  icon: "ViewListRounded" 
  spreadsheet: PaymentCollectionSheet 
  layoutSpreadsheet: TableLayout

3. Group actions

// this group has all the actions those can be performed on payment

ensure group MyVisits 
  pinnedActions: [AddVisit, AddOrder, AddPaymentCollection, ViewVisitSheet, ViewOrderBook, ViewPaymentCollectionSheet, CallReportVisit, CallReportMonthlySales] 
  pinnedActionSetMobile: [AddVisit, AddOrder, AddPaymentCollection] 
  actionPermission: {
      'AddPaymentCollection': {
        'menuGroup': '1',
        'roles': [
          'Agent'
        ]
      },
      'ViewPaymentCollectionSheet': {
        'menuGroup': '2',
        'roles': [
          'Owner'
        ]
      }
    }