Drug order book
Set backend
1. Variables
a. Rupee symbol
// rupee symbol variable
ensure var VarRupeeSymbol kind: text
modules: ["Pharmacy", "Jewellery"]
deploy: fixedOnDeploy
value: "₹"
b. Order status
// order status variable
ensure var VarOrderStatus kind: setOfText
modules: ["Pharmacy", "Jewellery"]
deploy: fixedOnDeploy
value: "<root>
<node key='1'>Created</node>
<node key='2'>CreditCheck</node>
<node key='3'>Dispatched</node>
<node key='4'>Completed</node>
<node key='5'>Cancelled</node>
</root>"
2. Creating SS for order
// this spreadsheet stores order information
ensure spreadsheet: DrugOrderBook
withFields: [Date, Name, Address, MobileNumber]
ofTypes: [date, text, paragraph, mobileNumber]
modules: ["Pharmacy"]
readRoleSet: [Owner, $Pulbic]
insertRoleSet: [Owner, $Pulbic]
removeRoleSet: [Owner]
updateRoleSet: [Owner]
ensure form FormDrugOrderBook
commentRoleSet: [Owner, $Public]
allowToPrintForm: true
ctx rename EntityDrugOrder
ensure section: Details
ensure field Date defaultValue: now
ensure field Name required: true
ensure field Address required: true
ensure field MobileNumber required: true
helperText: "+91xxxxxxxxxx"
ensure grid: Items
ensure field Quantity kind: counter
min: 0
max: 99999
step: 1
ensure field ItemRef kind: ref
spreadsheet: DrugMaster
copyFieldMap: {
'Pack': 'Pack',
'Name': 'Name',
'Ingredient': 'Ingredient',
'DiscountedPrice': 'DiscountedPrice',
'Dose': 'Dose',
'MRP': 'MRP',
'Brand': 'Brand',
'ItemMasterRowId': '$RowId'
}
layoutSpreadsheet: List
overlayLayoutSpreadsheet.item.firstLine.caption.lineFields: [Quantity]
ensure field ItemMasterRowId defaultValue: now
permissionMatrix: {
'defaultPermission': 'hide'
}
ensure field DiscountedPrice
prefixVar: {
'var': 'VarRupeeSymbol'
}
ensure field MRP
prefixVar: {
'var': 'VarRupeeSymbol'
}
ensure layoutGrid TableLayout
showComps: [Items.Name, Ingredient, Brand, Dose, Pack, DiscountedPrice, Quantity, Total]
ensure section: Summary
ensure field OrderStatus kind: pickText
sourceVar: VarOrderStatus
defaultOptionId: "1"
ensure field TotalBill kind: number
disabled: true
prefixVar: {
'var': 'VarRupeeSymbol'
}
ensure spreadsheet DrugOrderBook
searchables: [Brand]
ensure layoutSpreadsheet ListLayout kind: list
filter.showSearchBar: true
firstLine.first.lineFields: [Brand]
ensure form FormDrugBrandMaster
label: "Brand"
modules: ["Pharmacy"]
ctx rename EntityDrugBrand