📁 Showcase
Collection Sheet

Payment collection sheet

Backend

1. Variables

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. CollectionSheet

This spreadsheet stores payment collection data for Salesman.

ensure spreadsheet: CollectionSheet
  withFields: [Date]
  ofTypes: [date]
  removeRoleSet: [Owner]
  insertRoleSet: [Salesman]
  updateRoleSet: [Owner]
  readRoleSet: [Owner]

ensure form EntityPayment label: "Payment"
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

3. VisibilityRules

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. Actions

1. AddPayment

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

2. EditCollectionSheet

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

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

2. Group actions

This is the final group of actions. Merging the grouped actions from OrderBook > Reports.

ensure group MyVisits
  pinnedActions: [AddVisit, AddOrder, AddPayment, EditOrderBook, ReportVisit, ReportMonthlySales]
  pinnedActionSetMobile: [AddVisit, AddOrder]
  actionPermission: {
      'AddVisit': {
        'menuGroup': '1',
        'roles': [
          'Salesman'
        ]
      },
      'AddOrder': {
        'menuGroup': '1',
        'roles': [
          'Salesman'
        ]
      },
      'AddPayment': {
        'menuGroup': '1',
        'roles': [
          'Salesman'
        ]
      },
      'EditVisitSheet': {
        'menuGroup': '2',
        'roles': [
          'Owner'
        ]
      },
      'EditOrderBook': {
        'menuGroup': '2',
        'roles': [
          'Owner'
        ]
      },
      'EditCollectionSheet': {
        'menuGroup': '2',
        'roles': [
          'Owner'
        ]
      },
      'ReportVisit': {
        'menuGroup': '3',
        'roles': [
          'Owner'
        ]
      },
      'ReportMonthlySales': {
        'menuGroup': '3',
        'roles': [
          'Owner'
        ]
      }
    }