digikhata-mashreq-sdk 1.0.0 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (718) hide show
  1. package/lib/module/App.js +13 -26
  2. package/lib/module/App.js.map +1 -1
  3. package/lib/module/app/api/api.js +12 -0
  4. package/lib/module/app/api/api.js.map +1 -0
  5. package/lib/module/app/assets/Icons/Bill.png +0 -0
  6. package/lib/module/app/assets/Icons/Bill_Grey.png +0 -0
  7. package/lib/module/app/assets/Icons/Cash.png +0 -0
  8. package/lib/module/app/assets/Icons/Cash_Grey.png +0 -0
  9. package/lib/module/app/assets/Icons/Expense.png +0 -0
  10. package/lib/module/app/assets/Icons/Expense_Grey.png +0 -0
  11. package/lib/module/app/assets/Icons/Staff.png +0 -0
  12. package/lib/module/app/assets/Icons/Stock.png +0 -0
  13. package/lib/module/app/assets/Icons/Stock_Grey.png +0 -0
  14. package/lib/module/app/assets/Icons/abc.png +0 -0
  15. package/lib/module/app/assets/Icons/bank_logo.png +0 -0
  16. package/lib/module/app/assets/Icons/download_sale.png +0 -0
  17. package/lib/module/app/assets/Icons/recycle-bin.png +0 -0
  18. package/lib/module/app/assets/animations/recording.json +1 -0
  19. package/lib/module/app/assets/animations/success.json +1 -0
  20. package/lib/module/app/assets/animations/voice_visualization.json +1 -0
  21. package/lib/module/app/assets/businessCards/card_11.png +0 -0
  22. package/lib/module/app/assets/businessCards/card_12_bg.png +0 -0
  23. package/lib/module/app/assets/businessCards/card_wall_01.jpeg +0 -0
  24. package/lib/module/app/assets/businessCards/card_wall_02.jpeg +0 -0
  25. package/lib/module/app/assets/businessCards/card_wall_03.jpeg +0 -0
  26. package/lib/module/app/assets/businessCards/card_wall_04.jpeg +0 -0
  27. package/lib/module/app/assets/businessCards/card_wall_05.jpeg +0 -0
  28. package/lib/module/app/assets/businessCards/card_wall_06.jpeg +0 -0
  29. package/lib/module/app/assets/businessCards/card_wall_07.jpeg +0 -0
  30. package/lib/module/app/assets/businessCards/card_wall_08.jpeg +0 -0
  31. package/lib/module/app/assets/illustrations/empty.png +0 -0
  32. package/lib/module/app/assets/illustrations/packages.png +0 -0
  33. package/lib/module/app/assets/images/Digikhata_idzarHgH0q_0.png +0 -0
  34. package/lib/module/app/assets/images/bank.png +0 -0
  35. package/lib/module/app/assets/images/digiLogo-main.png +0 -0
  36. package/lib/module/app/assets/images/svgviewer-output.svg +57 -0
  37. package/lib/module/app/assets/images/user.png +0 -0
  38. package/lib/module/app/assets/oldIcons/BILL.svg +3 -0
  39. package/lib/module/app/assets/oldIcons/CASH.svg +4 -0
  40. package/lib/module/app/assets/oldIcons/EXPENSE.svg +6 -0
  41. package/lib/module/app/assets/oldIcons/STAFF.svg +3 -0
  42. package/lib/module/app/assets/oldIcons/Sale Active.svg +14 -0
  43. package/lib/module/app/assets/oldIcons/Stock.svg +5 -0
  44. package/lib/module/app/assets/svg/BILL.svg +4 -0
  45. package/lib/module/app/assets/svg/CASH.svg +6 -0
  46. package/lib/module/app/assets/svg/EXPENSE.svg +5 -0
  47. package/lib/module/app/assets/svg/More Icon.svg +6 -0
  48. package/lib/module/app/assets/svg/Payment Icon.svg +4 -0
  49. package/lib/module/app/assets/svg/Pos.svg +13 -0
  50. package/lib/module/app/assets/svg/STAFF.svg +5 -0
  51. package/lib/module/app/assets/svg/Sale Active.svg +8 -0
  52. package/lib/module/app/assets/svg/Sale Icon.svg +3 -0
  53. package/lib/module/app/assets/svg/Stock.svg +5 -0
  54. package/lib/module/app/components/AccountSetupSteps.js +64 -0
  55. package/lib/module/app/components/AccountSetupSteps.js.map +1 -0
  56. package/lib/module/app/components/AddItemBillParent.js +366 -0
  57. package/lib/module/app/components/AddItemBillParent.js.map +1 -0
  58. package/lib/module/app/components/AdditemBillChild.js +1123 -0
  59. package/lib/module/app/components/AdditemBillChild.js.map +1 -0
  60. package/lib/module/app/components/Balance.js +116 -70
  61. package/lib/module/app/components/Balance.js.map +1 -1
  62. package/lib/module/app/components/BillList.js +428 -0
  63. package/lib/module/app/components/BillList.js.map +1 -0
  64. package/lib/module/app/components/BillSetupSteps.js +64 -0
  65. package/lib/module/app/components/BillSetupSteps.js.map +1 -0
  66. package/lib/module/app/components/BottomView.js +35 -0
  67. package/lib/module/app/components/BottomView.js.map +1 -0
  68. package/lib/module/app/components/BusinessCards/Card1.js +202 -0
  69. package/lib/module/app/components/BusinessCards/Card1.js.map +1 -0
  70. package/lib/module/app/components/BusinessCards/Card10.js +234 -0
  71. package/lib/module/app/components/BusinessCards/Card10.js.map +1 -0
  72. package/lib/module/app/components/BusinessCards/Card2.js +190 -0
  73. package/lib/module/app/components/BusinessCards/Card2.js.map +1 -0
  74. package/lib/module/app/components/BusinessCards/Card3.js +186 -0
  75. package/lib/module/app/components/BusinessCards/Card3.js.map +1 -0
  76. package/lib/module/app/components/BusinessCards/Card4.js +186 -0
  77. package/lib/module/app/components/BusinessCards/Card4.js.map +1 -0
  78. package/lib/module/app/components/BusinessCards/Card5.js +189 -0
  79. package/lib/module/app/components/BusinessCards/Card5.js.map +1 -0
  80. package/lib/module/app/components/BusinessCards/Card6.js +198 -0
  81. package/lib/module/app/components/BusinessCards/Card6.js.map +1 -0
  82. package/lib/module/app/components/BusinessCards/Card7.js +185 -0
  83. package/lib/module/app/components/BusinessCards/Card7.js.map +1 -0
  84. package/lib/module/app/components/BusinessCards/Card8.js +187 -0
  85. package/lib/module/app/components/BusinessCards/Card8.js.map +1 -0
  86. package/lib/module/app/components/BusinessCards/Card9.js +234 -0
  87. package/lib/module/app/components/BusinessCards/Card9.js.map +1 -0
  88. package/lib/module/app/components/BusinessCards/index.js +13 -0
  89. package/lib/module/app/components/BusinessCards/index.js.map +1 -0
  90. package/lib/module/app/components/CashEntryComponent.js +256 -0
  91. package/lib/module/app/components/CashEntryComponent.js.map +1 -0
  92. package/lib/module/app/components/CityModal.js +116 -0
  93. package/lib/module/app/components/CityModal.js.map +1 -0
  94. package/lib/module/app/components/CountryPhoneInput.js +263 -166
  95. package/lib/module/app/components/CountryPhoneInput.js.map +1 -1
  96. package/lib/module/app/components/CreateExpenseAccount.js +139 -0
  97. package/lib/module/app/components/CreateExpenseAccount.js.map +1 -0
  98. package/lib/module/app/components/CustomStatusBar.js +29 -0
  99. package/lib/module/app/components/CustomStatusBar.js.map +1 -0
  100. package/lib/module/app/components/CustomToast.js +135 -0
  101. package/lib/module/app/components/CustomToast.js.map +1 -0
  102. package/lib/module/app/components/DeleteBusinessModal.js +174 -0
  103. package/lib/module/app/components/DeleteBusinessModal.js.map +1 -0
  104. package/lib/module/app/components/DiscountTaxModal.js +242 -0
  105. package/lib/module/app/components/DiscountTaxModal.js.map +1 -0
  106. package/lib/module/app/components/Entries.js +54 -32
  107. package/lib/module/app/components/Entries.js.map +1 -1
  108. package/lib/module/app/components/ExpenseList.js +402 -0
  109. package/lib/module/app/components/ExpenseList.js.map +1 -0
  110. package/lib/module/app/components/ExpenseParent.js +441 -0
  111. package/lib/module/app/components/ExpenseParent.js.map +1 -0
  112. package/lib/module/app/components/FloatingInput.js +159 -0
  113. package/lib/module/app/components/FloatingInput.js.map +1 -0
  114. package/lib/module/app/components/Header.js +107 -0
  115. package/lib/module/app/components/Header.js.map +1 -0
  116. package/lib/module/app/components/Loader.js +45 -0
  117. package/lib/module/app/components/Loader.js.map +1 -0
  118. package/lib/module/app/components/PartyModal.js +230 -0
  119. package/lib/module/app/components/PartyModal.js.map +1 -0
  120. package/lib/module/app/components/PickerModal.js +153 -0
  121. package/lib/module/app/components/PickerModal.js.map +1 -0
  122. package/lib/module/app/components/SalePaymentModal.js +743 -0
  123. package/lib/module/app/components/SalePaymentModal.js.map +1 -0
  124. package/lib/module/app/components/SearchBar.js +179 -42
  125. package/lib/module/app/components/SearchBar.js.map +1 -1
  126. package/lib/module/app/components/StockDetailChild.js +425 -0
  127. package/lib/module/app/components/StockDetailChild.js.map +1 -0
  128. package/lib/module/app/components/StockList.js +448 -0
  129. package/lib/module/app/components/StockList.js.map +1 -0
  130. package/lib/module/app/components/StockReportTransaction.js +182 -0
  131. package/lib/module/app/components/StockReportTransaction.js.map +1 -0
  132. package/lib/module/app/components/Transaction.js +193 -53
  133. package/lib/module/app/components/Transaction.js.map +1 -1
  134. package/lib/module/app/components/User.js +106 -51
  135. package/lib/module/app/components/User.js.map +1 -1
  136. package/lib/module/app/components/index.js +20 -1
  137. package/lib/module/app/components/index.js.map +1 -1
  138. package/lib/module/app/database/bill.js +247 -0
  139. package/lib/module/app/database/bill.js.map +1 -0
  140. package/lib/module/app/database/business.js +262 -0
  141. package/lib/module/app/database/business.js.map +1 -0
  142. package/lib/module/app/database/cash.js +299 -0
  143. package/lib/module/app/database/cash.js.map +1 -0
  144. package/lib/module/app/database/clients.js +1182 -36
  145. package/lib/module/app/database/clients.js.map +1 -1
  146. package/lib/module/app/database/expense.js +299 -0
  147. package/lib/module/app/database/expense.js.map +1 -0
  148. package/lib/module/app/database/schema.js +113 -3
  149. package/lib/module/app/database/schema.js.map +1 -1
  150. package/lib/module/app/database/stock.js +509 -0
  151. package/lib/module/app/database/stock.js.map +1 -0
  152. package/lib/module/app/htmlTemplates/htmlTemplates.js +2504 -0
  153. package/lib/module/app/htmlTemplates/htmlTemplates.js.map +1 -0
  154. package/lib/module/app/navigation/BillStack/BillStack.js +40 -0
  155. package/lib/module/app/navigation/BillStack/BillStack.js.map +1 -0
  156. package/lib/module/app/navigation/BottomTabs/BottomTabs.js +10 -5
  157. package/lib/module/app/navigation/BottomTabs/BottomTabs.js.map +1 -1
  158. package/lib/module/app/navigation/BusinessStack/BusinessStack.js +30 -0
  159. package/lib/module/app/navigation/BusinessStack/BusinessStack.js.map +1 -0
  160. package/lib/module/app/navigation/CashStack/CashStack.js +79 -0
  161. package/lib/module/app/navigation/CashStack/CashStack.js.map +1 -0
  162. package/lib/module/app/navigation/EntriesStack/EntriesStack.js +223 -0
  163. package/lib/module/app/navigation/EntriesStack/EntriesStack.js.map +1 -0
  164. package/lib/module/app/navigation/ExpenseStack.js/ExpenseStack.js +37 -0
  165. package/lib/module/app/navigation/ExpenseStack.js/ExpenseStack.js.map +1 -0
  166. package/lib/module/app/navigation/HomeStack/HomeStack.js +93 -1
  167. package/lib/module/app/navigation/HomeStack/HomeStack.js.map +1 -1
  168. package/lib/module/app/navigation/Root.js +10 -1
  169. package/lib/module/app/navigation/Root.js.map +1 -1
  170. package/lib/module/app/navigation/SaleStack/SaleStack.js +73 -0
  171. package/lib/module/app/navigation/SaleStack/SaleStack.js.map +1 -0
  172. package/lib/module/app/navigation/StockStack/StockStack.js +49 -0
  173. package/lib/module/app/navigation/StockStack/StockStack.js.map +1 -0
  174. package/lib/module/app/navigation/index.js +3 -1
  175. package/lib/module/app/navigation/index.js.map +1 -1
  176. package/lib/module/app/redux/Store.js +3 -1
  177. package/lib/module/app/redux/Store.js.map +1 -1
  178. package/lib/module/app/redux/reducers/client/client_reducers.js +23 -2
  179. package/lib/module/app/redux/reducers/client/client_reducers.js.map +1 -1
  180. package/lib/module/app/redux/reducers/client/client_types.js +5 -0
  181. package/lib/module/app/redux/reducers/client/client_types.js.map +1 -1
  182. package/lib/module/app/redux/reducers/user/user_reducers.js +22 -0
  183. package/lib/module/app/redux/reducers/user/user_reducers.js.map +1 -0
  184. package/lib/module/app/redux/reducers/user/user_types.js +6 -0
  185. package/lib/module/app/redux/reducers/user/user_types.js.map +1 -0
  186. package/lib/module/app/screens/AddBank.js +237 -0
  187. package/lib/module/app/screens/AddBank.js.map +1 -0
  188. package/lib/module/app/screens/AddBusiness.js +905 -0
  189. package/lib/module/app/screens/AddBusiness.js.map +1 -0
  190. package/lib/module/app/screens/AddItems.js +433 -0
  191. package/lib/module/app/screens/AddItems.js.map +1 -0
  192. package/lib/module/app/screens/AddScreen.js +341 -77
  193. package/lib/module/app/screens/AddScreen.js.map +1 -1
  194. package/lib/module/app/screens/All.js +836 -0
  195. package/lib/module/app/screens/All.js.map +1 -0
  196. package/lib/module/app/screens/AllTransactions.js +846 -0
  197. package/lib/module/app/screens/AllTransactions.js.map +1 -0
  198. package/lib/module/app/screens/Banks.js +807 -48
  199. package/lib/module/app/screens/Banks.js.map +1 -1
  200. package/lib/module/app/screens/BillDetails.js +1033 -0
  201. package/lib/module/app/screens/BillDetails.js.map +1 -0
  202. package/lib/module/app/screens/BillHome.js +102 -0
  203. package/lib/module/app/screens/BillHome.js.map +1 -0
  204. package/lib/module/app/screens/BillParent.js +373 -0
  205. package/lib/module/app/screens/BillParent.js.map +1 -0
  206. package/lib/module/app/screens/BusinessDetail.js +787 -0
  207. package/lib/module/app/screens/BusinessDetail.js.map +1 -0
  208. package/lib/module/app/screens/CashEntry.js +2429 -0
  209. package/lib/module/app/screens/CashEntry.js.map +1 -0
  210. package/lib/module/app/screens/CashEntryDetails.js +574 -0
  211. package/lib/module/app/screens/CashEntryDetails.js.map +1 -0
  212. package/lib/module/app/screens/CashHome.js +544 -0
  213. package/lib/module/app/screens/CashHome.js.map +1 -0
  214. package/lib/module/app/screens/CashReport.js +1297 -0
  215. package/lib/module/app/screens/CashReport.js.map +1 -0
  216. package/lib/module/app/screens/CashSummary.js +602 -0
  217. package/lib/module/app/screens/CashSummary.js.map +1 -0
  218. package/lib/module/app/screens/CreateBill.js +2137 -0
  219. package/lib/module/app/screens/CreateBill.js.map +1 -0
  220. package/lib/module/app/screens/CustomerEntries.js +1093 -184
  221. package/lib/module/app/screens/CustomerEntries.js.map +1 -1
  222. package/lib/module/app/screens/Customers.js +727 -96
  223. package/lib/module/app/screens/Customers.js.map +1 -1
  224. package/lib/module/app/screens/EditCategory.js +299 -0
  225. package/lib/module/app/screens/EditCategory.js.map +1 -0
  226. package/lib/module/app/screens/EditCategoryStock.js +302 -0
  227. package/lib/module/app/screens/EditCategoryStock.js.map +1 -0
  228. package/lib/module/app/screens/Entry.js +1838 -275
  229. package/lib/module/app/screens/Entry.js.map +1 -1
  230. package/lib/module/app/screens/ExpenseDetail.js +15 -0
  231. package/lib/module/app/screens/ExpenseDetail.js.map +1 -0
  232. package/lib/module/app/screens/ExpenseEntries.js +713 -0
  233. package/lib/module/app/screens/ExpenseEntries.js.map +1 -0
  234. package/lib/module/app/screens/ExpenseEntry.js +2095 -0
  235. package/lib/module/app/screens/ExpenseEntry.js.map +1 -0
  236. package/lib/module/app/screens/ExpenseEntryDetails.js +508 -0
  237. package/lib/module/app/screens/ExpenseEntryDetails.js.map +1 -0
  238. package/lib/module/app/screens/ExpenseEntryReport.js +792 -0
  239. package/lib/module/app/screens/ExpenseEntryReport.js.map +1 -0
  240. package/lib/module/app/screens/ExpenseReport.js +792 -0
  241. package/lib/module/app/screens/ExpenseReport.js.map +1 -0
  242. package/lib/module/app/screens/Geolocation.js +374 -0
  243. package/lib/module/app/screens/Geolocation.js.map +1 -0
  244. package/lib/module/app/screens/GetStarted.js +213 -0
  245. package/lib/module/app/screens/GetStarted.js.map +1 -0
  246. package/lib/module/app/screens/HomeScreen.js +202 -55
  247. package/lib/module/app/screens/HomeScreen.js.map +1 -1
  248. package/lib/module/app/screens/InBuy.js +854 -0
  249. package/lib/module/app/screens/InBuy.js.map +1 -0
  250. package/lib/module/app/screens/ItemEntryDetails.js +652 -0
  251. package/lib/module/app/screens/ItemEntryDetails.js.map +1 -0
  252. package/lib/module/app/screens/LowStock.js +372 -0
  253. package/lib/module/app/screens/LowStock.js.map +1 -0
  254. package/lib/module/app/screens/NewPin.js +234 -0
  255. package/lib/module/app/screens/NewPin.js.map +1 -0
  256. package/lib/module/app/screens/OutSell.js +1883 -0
  257. package/lib/module/app/screens/OutSell.js.map +1 -0
  258. package/lib/module/app/screens/POSSale.js +637 -0
  259. package/lib/module/app/screens/POSSale.js.map +1 -0
  260. package/lib/module/app/screens/PinScreen.js +663 -0
  261. package/lib/module/app/screens/PinScreen.js.map +1 -0
  262. package/lib/module/app/screens/PreviewBill.js +329 -0
  263. package/lib/module/app/screens/PreviewBill.js.map +1 -0
  264. package/lib/module/app/screens/Profile.js +1160 -0
  265. package/lib/module/app/screens/Profile.js.map +1 -0
  266. package/lib/module/app/screens/RateList.js +432 -0
  267. package/lib/module/app/screens/RateList.js.map +1 -0
  268. package/lib/module/app/screens/Report.js +1105 -0
  269. package/lib/module/app/screens/Report.js.map +1 -0
  270. package/lib/module/app/screens/SaleItemDetail.js +1047 -0
  271. package/lib/module/app/screens/SaleItemDetail.js.map +1 -0
  272. package/lib/module/app/screens/SaleParent.js +289 -0
  273. package/lib/module/app/screens/SaleParent.js.map +1 -0
  274. package/lib/module/app/screens/SelectBank.js +220 -0
  275. package/lib/module/app/screens/SelectBank.js.map +1 -0
  276. package/lib/module/app/screens/SelectBusiness.js +497 -93
  277. package/lib/module/app/screens/SelectBusiness.js.map +1 -1
  278. package/lib/module/app/screens/Splash.js +93 -20
  279. package/lib/module/app/screens/Splash.js.map +1 -1
  280. package/lib/module/app/screens/StockChild.js +362 -0
  281. package/lib/module/app/screens/StockChild.js.map +1 -0
  282. package/lib/module/app/screens/StockDetail.js +705 -0
  283. package/lib/module/app/screens/StockDetail.js.map +1 -0
  284. package/lib/module/app/screens/StockParent.js +260 -0
  285. package/lib/module/app/screens/StockParent.js.map +1 -0
  286. package/lib/module/app/screens/StockReport.js +1031 -0
  287. package/lib/module/app/screens/StockReport.js.map +1 -0
  288. package/lib/module/app/screens/StockValue.js +545 -0
  289. package/lib/module/app/screens/StockValue.js.map +1 -0
  290. package/lib/module/app/screens/Suppliers.js +753 -98
  291. package/lib/module/app/screens/Suppliers.js.map +1 -1
  292. package/lib/module/app/screens/TransactionDetails.js +1169 -81
  293. package/lib/module/app/screens/TransactionDetails.js.map +1 -1
  294. package/lib/module/app/screens/UpdateBusiness.js +707 -0
  295. package/lib/module/app/screens/UpdateBusiness.js.map +1 -0
  296. package/lib/module/app/screens/VisionCamera.js +60 -0
  297. package/lib/module/app/screens/VisionCamera.js.map +1 -0
  298. package/lib/module/app/screens/index.js +46 -1
  299. package/lib/module/app/screens/index.js.map +1 -1
  300. package/lib/module/app/screens/new.html +171 -0
  301. package/lib/module/app/themes/config.js +299 -30
  302. package/lib/module/app/themes/config.js.map +1 -1
  303. package/lib/module/app/utils/city.json +7265 -0
  304. package/lib/typescript/eslint.config.d.mts +1 -1
  305. package/lib/typescript/src/App.d.ts.map +1 -1
  306. package/lib/typescript/src/app/api/api.d.ts +10 -0
  307. package/lib/typescript/src/app/api/api.d.ts.map +1 -0
  308. package/lib/typescript/src/app/components/AccountSetupSteps.d.ts +3 -0
  309. package/lib/typescript/src/app/components/AccountSetupSteps.d.ts.map +1 -0
  310. package/lib/typescript/src/app/components/AddItemBillParent.d.ts +5 -0
  311. package/lib/typescript/src/app/components/AddItemBillParent.d.ts.map +1 -0
  312. package/lib/typescript/src/app/components/AdditemBillChild.d.ts +6 -0
  313. package/lib/typescript/src/app/components/AdditemBillChild.d.ts.map +1 -0
  314. package/lib/typescript/src/app/components/Balance.d.ts +3 -1
  315. package/lib/typescript/src/app/components/Balance.d.ts.map +1 -1
  316. package/lib/typescript/src/app/components/BillList.d.ts +5 -0
  317. package/lib/typescript/src/app/components/BillList.d.ts.map +1 -0
  318. package/lib/typescript/src/app/components/BillSetupSteps.d.ts +3 -0
  319. package/lib/typescript/src/app/components/BillSetupSteps.d.ts.map +1 -0
  320. package/lib/typescript/src/app/components/BottomView.d.ts +6 -0
  321. package/lib/typescript/src/app/components/BottomView.d.ts.map +1 -0
  322. package/lib/typescript/src/app/components/BusinessCards/Card1.d.ts +14 -0
  323. package/lib/typescript/src/app/components/BusinessCards/Card1.d.ts.map +1 -0
  324. package/lib/typescript/src/app/components/BusinessCards/Card10.d.ts +14 -0
  325. package/lib/typescript/src/app/components/BusinessCards/Card10.d.ts.map +1 -0
  326. package/lib/typescript/src/app/components/BusinessCards/Card2.d.ts +14 -0
  327. package/lib/typescript/src/app/components/BusinessCards/Card2.d.ts.map +1 -0
  328. package/lib/typescript/src/app/components/BusinessCards/Card3.d.ts +14 -0
  329. package/lib/typescript/src/app/components/BusinessCards/Card3.d.ts.map +1 -0
  330. package/lib/typescript/src/app/components/BusinessCards/Card4.d.ts +14 -0
  331. package/lib/typescript/src/app/components/BusinessCards/Card4.d.ts.map +1 -0
  332. package/lib/typescript/src/app/components/BusinessCards/Card5.d.ts +14 -0
  333. package/lib/typescript/src/app/components/BusinessCards/Card5.d.ts.map +1 -0
  334. package/lib/typescript/src/app/components/BusinessCards/Card6.d.ts +14 -0
  335. package/lib/typescript/src/app/components/BusinessCards/Card6.d.ts.map +1 -0
  336. package/lib/typescript/src/app/components/BusinessCards/Card7.d.ts +14 -0
  337. package/lib/typescript/src/app/components/BusinessCards/Card7.d.ts.map +1 -0
  338. package/lib/typescript/src/app/components/BusinessCards/Card8.d.ts +14 -0
  339. package/lib/typescript/src/app/components/BusinessCards/Card8.d.ts.map +1 -0
  340. package/lib/typescript/src/app/components/BusinessCards/Card9.d.ts +14 -0
  341. package/lib/typescript/src/app/components/BusinessCards/Card9.d.ts.map +1 -0
  342. package/lib/typescript/src/app/components/BusinessCards/index.d.ts +11 -0
  343. package/lib/typescript/src/app/components/BusinessCards/index.d.ts.map +1 -0
  344. package/lib/typescript/src/app/components/CashEntryComponent.d.ts +8 -0
  345. package/lib/typescript/src/app/components/CashEntryComponent.d.ts.map +1 -0
  346. package/lib/typescript/src/app/components/CityModal.d.ts +7 -0
  347. package/lib/typescript/src/app/components/CityModal.d.ts.map +1 -0
  348. package/lib/typescript/src/app/components/CountryPhoneInput.d.ts +4 -1
  349. package/lib/typescript/src/app/components/CountryPhoneInput.d.ts.map +1 -1
  350. package/lib/typescript/src/app/components/CreateExpenseAccount.d.ts +9 -0
  351. package/lib/typescript/src/app/components/CreateExpenseAccount.d.ts.map +1 -0
  352. package/lib/typescript/src/app/components/CustomStatusBar.d.ts +3 -0
  353. package/lib/typescript/src/app/components/CustomStatusBar.d.ts.map +1 -0
  354. package/lib/typescript/src/app/components/CustomToast.d.ts +10 -0
  355. package/lib/typescript/src/app/components/CustomToast.d.ts.map +1 -0
  356. package/lib/typescript/src/app/components/DeleteBusinessModal.d.ts +8 -0
  357. package/lib/typescript/src/app/components/DeleteBusinessModal.d.ts.map +1 -0
  358. package/lib/typescript/src/app/components/DiscountTaxModal.d.ts +9 -0
  359. package/lib/typescript/src/app/components/DiscountTaxModal.d.ts.map +1 -0
  360. package/lib/typescript/src/app/components/Entries.d.ts.map +1 -1
  361. package/lib/typescript/src/app/components/ExpenseList.d.ts +6 -0
  362. package/lib/typescript/src/app/components/ExpenseList.d.ts.map +1 -0
  363. package/lib/typescript/src/app/components/ExpenseParent.d.ts +4 -0
  364. package/lib/typescript/src/app/components/ExpenseParent.d.ts.map +1 -0
  365. package/lib/typescript/src/app/components/FloatingInput.d.ts +18 -0
  366. package/lib/typescript/src/app/components/FloatingInput.d.ts.map +1 -0
  367. package/lib/typescript/src/app/components/Header.d.ts +11 -0
  368. package/lib/typescript/src/app/components/Header.d.ts.map +1 -0
  369. package/lib/typescript/src/app/components/Loader.d.ts +5 -0
  370. package/lib/typescript/src/app/components/Loader.d.ts.map +1 -0
  371. package/lib/typescript/src/app/components/PartyModal.d.ts +7 -0
  372. package/lib/typescript/src/app/components/PartyModal.d.ts.map +1 -0
  373. package/lib/typescript/src/app/components/PickerModal.d.ts +8 -0
  374. package/lib/typescript/src/app/components/PickerModal.d.ts.map +1 -0
  375. package/lib/typescript/src/app/components/SalePaymentModal.d.ts +15 -0
  376. package/lib/typescript/src/app/components/SalePaymentModal.d.ts.map +1 -0
  377. package/lib/typescript/src/app/components/SearchBar.d.ts +2 -4
  378. package/lib/typescript/src/app/components/SearchBar.d.ts.map +1 -1
  379. package/lib/typescript/src/app/components/StockDetailChild.d.ts +5 -0
  380. package/lib/typescript/src/app/components/StockDetailChild.d.ts.map +1 -0
  381. package/lib/typescript/src/app/components/StockList.d.ts +6 -0
  382. package/lib/typescript/src/app/components/StockList.d.ts.map +1 -0
  383. package/lib/typescript/src/app/components/StockReportTransaction.d.ts +18 -0
  384. package/lib/typescript/src/app/components/StockReportTransaction.d.ts.map +1 -0
  385. package/lib/typescript/src/app/components/Transaction.d.ts +9 -2
  386. package/lib/typescript/src/app/components/Transaction.d.ts.map +1 -1
  387. package/lib/typescript/src/app/components/User.d.ts +3 -1
  388. package/lib/typescript/src/app/components/User.d.ts.map +1 -1
  389. package/lib/typescript/src/app/components/index.d.ts +26 -7
  390. package/lib/typescript/src/app/components/index.d.ts.map +1 -1
  391. package/lib/typescript/src/app/database/bill.d.ts +7 -0
  392. package/lib/typescript/src/app/database/bill.d.ts.map +1 -0
  393. package/lib/typescript/src/app/database/business.d.ts +9 -0
  394. package/lib/typescript/src/app/database/business.d.ts.map +1 -0
  395. package/lib/typescript/src/app/database/cash.d.ts +14 -0
  396. package/lib/typescript/src/app/database/cash.d.ts.map +1 -0
  397. package/lib/typescript/src/app/database/clients.d.ts +36 -5
  398. package/lib/typescript/src/app/database/clients.d.ts.map +1 -1
  399. package/lib/typescript/src/app/database/expense.d.ts +12 -0
  400. package/lib/typescript/src/app/database/expense.d.ts.map +1 -0
  401. package/lib/typescript/src/app/database/schema.d.ts.map +1 -1
  402. package/lib/typescript/src/app/database/stock.d.ts +16 -0
  403. package/lib/typescript/src/app/database/stock.d.ts.map +1 -0
  404. package/lib/typescript/src/app/htmlTemplates/htmlTemplates.d.ts +29 -0
  405. package/lib/typescript/src/app/htmlTemplates/htmlTemplates.d.ts.map +1 -0
  406. package/lib/typescript/src/app/navigation/BillStack/BillStack.d.ts +2 -0
  407. package/lib/typescript/src/app/navigation/BillStack/BillStack.d.ts.map +1 -0
  408. package/lib/typescript/src/app/navigation/BottomTabs/BottomTabs.d.ts.map +1 -1
  409. package/lib/typescript/src/app/navigation/BusinessStack/BusinessStack.d.ts +2 -0
  410. package/lib/typescript/src/app/navigation/BusinessStack/BusinessStack.d.ts.map +1 -0
  411. package/lib/typescript/src/app/navigation/CashStack/CashStack.d.ts +2 -0
  412. package/lib/typescript/src/app/navigation/CashStack/CashStack.d.ts.map +1 -0
  413. package/lib/typescript/src/app/navigation/EntriesStack/EntriesStack.d.ts +2 -0
  414. package/lib/typescript/src/app/navigation/EntriesStack/EntriesStack.d.ts.map +1 -0
  415. package/lib/typescript/src/app/navigation/ExpenseStack.js/ExpenseStack.d.ts +2 -0
  416. package/lib/typescript/src/app/navigation/ExpenseStack.js/ExpenseStack.d.ts.map +1 -0
  417. package/lib/typescript/src/app/navigation/HomeStack/HomeStack.d.ts.map +1 -1
  418. package/lib/typescript/src/app/navigation/Root.d.ts.map +1 -1
  419. package/lib/typescript/src/app/navigation/SaleStack/SaleStack.d.ts +2 -0
  420. package/lib/typescript/src/app/navigation/SaleStack/SaleStack.d.ts.map +1 -0
  421. package/lib/typescript/src/app/navigation/StockStack/StockStack.d.ts +2 -0
  422. package/lib/typescript/src/app/navigation/StockStack/StockStack.d.ts.map +1 -0
  423. package/lib/typescript/src/app/navigation/index.d.ts +3 -1
  424. package/lib/typescript/src/app/navigation/index.d.ts.map +1 -1
  425. package/lib/typescript/src/app/redux/Store.d.ts.map +1 -1
  426. package/lib/typescript/src/app/redux/reducers/client/client_reducers.d.ts.map +1 -1
  427. package/lib/typescript/src/app/redux/reducers/client/client_types.d.ts +5 -0
  428. package/lib/typescript/src/app/redux/reducers/client/client_types.d.ts.map +1 -1
  429. package/lib/typescript/src/app/redux/reducers/user/user_reducers.d.ts +3 -0
  430. package/lib/typescript/src/app/redux/reducers/user/user_reducers.d.ts.map +1 -0
  431. package/lib/typescript/src/app/redux/reducers/user/user_types.d.ts +4 -0
  432. package/lib/typescript/src/app/redux/reducers/user/user_types.d.ts.map +1 -0
  433. package/lib/typescript/src/app/screens/AddBank.d.ts +5 -0
  434. package/lib/typescript/src/app/screens/AddBank.d.ts.map +1 -0
  435. package/lib/typescript/src/app/screens/AddBusiness.d.ts +4 -0
  436. package/lib/typescript/src/app/screens/AddBusiness.d.ts.map +1 -0
  437. package/lib/typescript/src/app/screens/AddItems.d.ts +5 -0
  438. package/lib/typescript/src/app/screens/AddItems.d.ts.map +1 -0
  439. package/lib/typescript/src/app/screens/AddScreen.d.ts.map +1 -1
  440. package/lib/typescript/src/app/screens/All.d.ts +2 -0
  441. package/lib/typescript/src/app/screens/All.d.ts.map +1 -0
  442. package/lib/typescript/src/app/screens/AllTransactions.d.ts +5 -0
  443. package/lib/typescript/src/app/screens/AllTransactions.d.ts.map +1 -0
  444. package/lib/typescript/src/app/screens/Banks.d.ts.map +1 -1
  445. package/lib/typescript/src/app/screens/BillDetails.d.ts +6 -0
  446. package/lib/typescript/src/app/screens/BillDetails.d.ts.map +1 -0
  447. package/lib/typescript/src/app/screens/BillHome.d.ts +5 -0
  448. package/lib/typescript/src/app/screens/BillHome.d.ts.map +1 -0
  449. package/lib/typescript/src/app/screens/BillParent.d.ts +5 -0
  450. package/lib/typescript/src/app/screens/BillParent.d.ts.map +1 -0
  451. package/lib/typescript/src/app/screens/BusinessDetail.d.ts +4 -0
  452. package/lib/typescript/src/app/screens/BusinessDetail.d.ts.map +1 -0
  453. package/lib/typescript/src/app/screens/CashEntry.d.ts +5 -0
  454. package/lib/typescript/src/app/screens/CashEntry.d.ts.map +1 -0
  455. package/lib/typescript/src/app/screens/CashEntryDetails.d.ts +5 -0
  456. package/lib/typescript/src/app/screens/CashEntryDetails.d.ts.map +1 -0
  457. package/lib/typescript/src/app/screens/CashHome.d.ts +4 -0
  458. package/lib/typescript/src/app/screens/CashHome.d.ts.map +1 -0
  459. package/lib/typescript/src/app/screens/CashReport.d.ts +4 -0
  460. package/lib/typescript/src/app/screens/CashReport.d.ts.map +1 -0
  461. package/lib/typescript/src/app/screens/CashSummary.d.ts +5 -0
  462. package/lib/typescript/src/app/screens/CashSummary.d.ts.map +1 -0
  463. package/lib/typescript/src/app/screens/CreateBill.d.ts +5 -0
  464. package/lib/typescript/src/app/screens/CreateBill.d.ts.map +1 -0
  465. package/lib/typescript/src/app/screens/CustomerEntries.d.ts.map +1 -1
  466. package/lib/typescript/src/app/screens/Customers.d.ts +1 -3
  467. package/lib/typescript/src/app/screens/Customers.d.ts.map +1 -1
  468. package/lib/typescript/src/app/screens/EditCategory.d.ts +4 -0
  469. package/lib/typescript/src/app/screens/EditCategory.d.ts.map +1 -0
  470. package/lib/typescript/src/app/screens/EditCategoryStock.d.ts +4 -0
  471. package/lib/typescript/src/app/screens/EditCategoryStock.d.ts.map +1 -0
  472. package/lib/typescript/src/app/screens/Entry.d.ts.map +1 -1
  473. package/lib/typescript/src/app/screens/ExpenseDetail.d.ts +3 -0
  474. package/lib/typescript/src/app/screens/ExpenseDetail.d.ts.map +1 -0
  475. package/lib/typescript/src/app/screens/ExpenseEntries.d.ts +5 -0
  476. package/lib/typescript/src/app/screens/ExpenseEntries.d.ts.map +1 -0
  477. package/lib/typescript/src/app/screens/ExpenseEntry.d.ts +5 -0
  478. package/lib/typescript/src/app/screens/ExpenseEntry.d.ts.map +1 -0
  479. package/lib/typescript/src/app/screens/ExpenseEntryDetails.d.ts +5 -0
  480. package/lib/typescript/src/app/screens/ExpenseEntryDetails.d.ts.map +1 -0
  481. package/lib/typescript/src/app/screens/ExpenseEntryReport.d.ts +5 -0
  482. package/lib/typescript/src/app/screens/ExpenseEntryReport.d.ts.map +1 -0
  483. package/lib/typescript/src/app/screens/ExpenseReport.d.ts +5 -0
  484. package/lib/typescript/src/app/screens/ExpenseReport.d.ts.map +1 -0
  485. package/lib/typescript/src/app/screens/Geolocation.d.ts +5 -0
  486. package/lib/typescript/src/app/screens/Geolocation.d.ts.map +1 -0
  487. package/lib/typescript/src/app/screens/GetStarted.d.ts +4 -0
  488. package/lib/typescript/src/app/screens/GetStarted.d.ts.map +1 -0
  489. package/lib/typescript/src/app/screens/HomeScreen.d.ts.map +1 -1
  490. package/lib/typescript/src/app/screens/InBuy.d.ts +5 -0
  491. package/lib/typescript/src/app/screens/InBuy.d.ts.map +1 -0
  492. package/lib/typescript/src/app/screens/ItemEntryDetails.d.ts +5 -0
  493. package/lib/typescript/src/app/screens/ItemEntryDetails.d.ts.map +1 -0
  494. package/lib/typescript/src/app/screens/LowStock.d.ts +4 -0
  495. package/lib/typescript/src/app/screens/LowStock.d.ts.map +1 -0
  496. package/lib/typescript/src/app/screens/NewPin.d.ts +5 -0
  497. package/lib/typescript/src/app/screens/NewPin.d.ts.map +1 -0
  498. package/lib/typescript/src/app/screens/OutSell.d.ts +6 -0
  499. package/lib/typescript/src/app/screens/OutSell.d.ts.map +1 -0
  500. package/lib/typescript/src/app/screens/POSSale.d.ts +9 -0
  501. package/lib/typescript/src/app/screens/POSSale.d.ts.map +1 -0
  502. package/lib/typescript/src/app/screens/PinScreen.d.ts +5 -0
  503. package/lib/typescript/src/app/screens/PinScreen.d.ts.map +1 -0
  504. package/lib/typescript/src/app/screens/PreviewBill.d.ts +5 -0
  505. package/lib/typescript/src/app/screens/PreviewBill.d.ts.map +1 -0
  506. package/lib/typescript/src/app/screens/Profile.d.ts +5 -0
  507. package/lib/typescript/src/app/screens/Profile.d.ts.map +1 -0
  508. package/lib/typescript/src/app/screens/RateList.d.ts +5 -0
  509. package/lib/typescript/src/app/screens/RateList.d.ts.map +1 -0
  510. package/lib/typescript/src/app/screens/Report.d.ts +5 -0
  511. package/lib/typescript/src/app/screens/Report.d.ts.map +1 -0
  512. package/lib/typescript/src/app/screens/SaleItemDetail.d.ts +6 -0
  513. package/lib/typescript/src/app/screens/SaleItemDetail.d.ts.map +1 -0
  514. package/lib/typescript/src/app/screens/SaleParent.d.ts +2 -0
  515. package/lib/typescript/src/app/screens/SaleParent.d.ts.map +1 -0
  516. package/lib/typescript/src/app/screens/SelectBank.d.ts +4 -0
  517. package/lib/typescript/src/app/screens/SelectBank.d.ts.map +1 -0
  518. package/lib/typescript/src/app/screens/SelectBusiness.d.ts.map +1 -1
  519. package/lib/typescript/src/app/screens/Splash.d.ts.map +1 -1
  520. package/lib/typescript/src/app/screens/StockChild.d.ts +7 -0
  521. package/lib/typescript/src/app/screens/StockChild.d.ts.map +1 -0
  522. package/lib/typescript/src/app/screens/StockDetail.d.ts +5 -0
  523. package/lib/typescript/src/app/screens/StockDetail.d.ts.map +1 -0
  524. package/lib/typescript/src/app/screens/StockParent.d.ts +2 -0
  525. package/lib/typescript/src/app/screens/StockParent.d.ts.map +1 -0
  526. package/lib/typescript/src/app/screens/StockReport.d.ts +5 -0
  527. package/lib/typescript/src/app/screens/StockReport.d.ts.map +1 -0
  528. package/lib/typescript/src/app/screens/StockValue.d.ts +5 -0
  529. package/lib/typescript/src/app/screens/StockValue.d.ts.map +1 -0
  530. package/lib/typescript/src/app/screens/Suppliers.d.ts +1 -3
  531. package/lib/typescript/src/app/screens/Suppliers.d.ts.map +1 -1
  532. package/lib/typescript/src/app/screens/TransactionDetails.d.ts.map +1 -1
  533. package/lib/typescript/src/app/screens/UpdateBusiness.d.ts +5 -0
  534. package/lib/typescript/src/app/screens/UpdateBusiness.d.ts.map +1 -0
  535. package/lib/typescript/src/app/screens/VisionCamera.d.ts +2 -0
  536. package/lib/typescript/src/app/screens/VisionCamera.d.ts.map +1 -0
  537. package/lib/typescript/src/app/screens/index.d.ts +56 -11
  538. package/lib/typescript/src/app/screens/index.d.ts.map +1 -1
  539. package/lib/typescript/src/app/themes/config.d.ts +60 -8
  540. package/lib/typescript/src/app/themes/config.d.ts.map +1 -1
  541. package/package.json +6 -2
  542. package/src/App.js +30 -34
  543. package/src/app/api/api.js +11 -0
  544. package/src/app/assets/Icons/Bill.png +0 -0
  545. package/src/app/assets/Icons/Bill_Grey.png +0 -0
  546. package/src/app/assets/Icons/Cash.png +0 -0
  547. package/src/app/assets/Icons/Cash_Grey.png +0 -0
  548. package/src/app/assets/Icons/Expense.png +0 -0
  549. package/src/app/assets/Icons/Expense_Grey.png +0 -0
  550. package/src/app/assets/Icons/Staff.png +0 -0
  551. package/src/app/assets/Icons/Stock.png +0 -0
  552. package/src/app/assets/Icons/Stock_Grey.png +0 -0
  553. package/src/app/assets/Icons/abc.png +0 -0
  554. package/src/app/assets/Icons/bank_logo.png +0 -0
  555. package/src/app/assets/Icons/download_sale.png +0 -0
  556. package/src/app/assets/Icons/recycle-bin.png +0 -0
  557. package/src/app/assets/animations/recording.json +1 -0
  558. package/src/app/assets/animations/success.json +1 -0
  559. package/src/app/assets/animations/voice_visualization.json +1 -0
  560. package/src/app/assets/businessCards/card_11.png +0 -0
  561. package/src/app/assets/businessCards/card_12_bg.png +0 -0
  562. package/src/app/assets/businessCards/card_wall_01.jpeg +0 -0
  563. package/src/app/assets/businessCards/card_wall_02.jpeg +0 -0
  564. package/src/app/assets/businessCards/card_wall_03.jpeg +0 -0
  565. package/src/app/assets/businessCards/card_wall_04.jpeg +0 -0
  566. package/src/app/assets/businessCards/card_wall_05.jpeg +0 -0
  567. package/src/app/assets/businessCards/card_wall_06.jpeg +0 -0
  568. package/src/app/assets/businessCards/card_wall_07.jpeg +0 -0
  569. package/src/app/assets/businessCards/card_wall_08.jpeg +0 -0
  570. package/src/app/assets/illustrations/empty.png +0 -0
  571. package/src/app/assets/illustrations/packages.png +0 -0
  572. package/src/app/assets/images/Digikhata_idzarHgH0q_0.png +0 -0
  573. package/src/app/assets/images/bank.png +0 -0
  574. package/src/app/assets/images/digiLogo-main.png +0 -0
  575. package/src/app/assets/images/svgviewer-output.svg +57 -0
  576. package/src/app/assets/images/user.png +0 -0
  577. package/src/app/assets/oldIcons/BILL.svg +3 -0
  578. package/src/app/assets/oldIcons/CASH.svg +4 -0
  579. package/src/app/assets/oldIcons/EXPENSE.svg +6 -0
  580. package/src/app/assets/oldIcons/STAFF.svg +3 -0
  581. package/src/app/assets/oldIcons/Sale Active.svg +14 -0
  582. package/src/app/assets/oldIcons/Stock.svg +5 -0
  583. package/src/app/assets/svg/BILL.svg +4 -0
  584. package/src/app/assets/svg/CASH.svg +6 -0
  585. package/src/app/assets/svg/EXPENSE.svg +5 -0
  586. package/src/app/assets/svg/More Icon.svg +6 -0
  587. package/src/app/assets/svg/Payment Icon.svg +4 -0
  588. package/src/app/assets/svg/Pos.svg +13 -0
  589. package/src/app/assets/svg/STAFF.svg +5 -0
  590. package/src/app/assets/svg/Sale Active.svg +8 -0
  591. package/src/app/assets/svg/Sale Icon.svg +3 -0
  592. package/src/app/assets/svg/Stock.svg +5 -0
  593. package/src/app/components/AccountSetupSteps.js +58 -0
  594. package/src/app/components/AddItemBillParent.js +373 -0
  595. package/src/app/components/AdditemBillChild.js +1257 -0
  596. package/src/app/components/Balance.js +211 -114
  597. package/src/app/components/BillList.js +548 -0
  598. package/src/app/components/BillSetupSteps.js +56 -0
  599. package/src/app/components/BottomView.js +39 -0
  600. package/src/app/components/BusinessCards/Card1.js +160 -0
  601. package/src/app/components/BusinessCards/Card10.js +209 -0
  602. package/src/app/components/BusinessCards/Card2.js +148 -0
  603. package/src/app/components/BusinessCards/Card3.js +147 -0
  604. package/src/app/components/BusinessCards/Card4.js +147 -0
  605. package/src/app/components/BusinessCards/Card5.js +151 -0
  606. package/src/app/components/BusinessCards/Card6.js +157 -0
  607. package/src/app/components/BusinessCards/Card7.js +146 -0
  608. package/src/app/components/BusinessCards/Card8.js +170 -0
  609. package/src/app/components/BusinessCards/Card9.js +209 -0
  610. package/src/app/components/BusinessCards/index.js +10 -0
  611. package/src/app/components/CashEntryComponent.js +297 -0
  612. package/src/app/components/CityModal.js +117 -0
  613. package/src/app/components/CountryPhoneInput.js +373 -267
  614. package/src/app/components/CreateExpenseAccount.js +141 -0
  615. package/src/app/components/CustomStatusBar.js +33 -0
  616. package/src/app/components/CustomToast.js +143 -0
  617. package/src/app/components/DeleteBusinessModal.js +196 -0
  618. package/src/app/components/DiscountTaxModal.js +256 -0
  619. package/src/app/components/Entries.js +87 -67
  620. package/src/app/components/ExpenseList.js +507 -0
  621. package/src/app/components/ExpenseParent.js +446 -0
  622. package/src/app/components/FloatingInput.js +188 -0
  623. package/src/app/components/Header.js +121 -0
  624. package/src/app/components/Loader.js +35 -0
  625. package/src/app/components/PartyModal.js +213 -0
  626. package/src/app/components/PickerModal.js +176 -0
  627. package/src/app/components/SalePaymentModal.js +822 -0
  628. package/src/app/components/SearchBar.js +225 -47
  629. package/src/app/components/StockDetailChild.js +461 -0
  630. package/src/app/components/StockList.js +582 -0
  631. package/src/app/components/StockReportTransaction.js +192 -0
  632. package/src/app/components/Transaction.js +277 -86
  633. package/src/app/components/User.js +188 -80
  634. package/src/app/components/index.js +51 -13
  635. package/src/app/database/bill.js +305 -0
  636. package/src/app/database/business.js +499 -0
  637. package/src/app/database/cash.js +451 -0
  638. package/src/app/database/clients.js +1536 -43
  639. package/src/app/database/expense.js +439 -0
  640. package/src/app/database/schema.js +115 -4
  641. package/src/app/database/stock.js +724 -0
  642. package/src/app/htmlTemplates/htmlTemplates.js +2603 -0
  643. package/src/app/navigation/BillStack/BillStack.js +38 -0
  644. package/src/app/navigation/BottomTabs/BottomTabs.js +24 -19
  645. package/src/app/navigation/BusinessStack/BusinessStack.js +27 -0
  646. package/src/app/navigation/CashStack/CashStack.js +59 -0
  647. package/src/app/navigation/EntriesStack/EntriesStack.js +186 -0
  648. package/src/app/navigation/ExpenseStack.js/ExpenseStack.js +50 -0
  649. package/src/app/navigation/HomeStack/HomeStack.js +106 -39
  650. package/src/app/navigation/Root.js +16 -1
  651. package/src/app/navigation/SaleStack/SaleStack.js +62 -0
  652. package/src/app/navigation/StockStack/StockStack.js +48 -0
  653. package/src/app/navigation/index.js +5 -1
  654. package/src/app/redux/Store.js +2 -0
  655. package/src/app/redux/reducers/client/client_reducers.js +31 -2
  656. package/src/app/redux/reducers/client/client_types.js +8 -1
  657. package/src/app/redux/reducers/user/user_reducers.js +24 -0
  658. package/src/app/redux/reducers/user/user_types.js +3 -0
  659. package/src/app/screens/AddBank.js +353 -0
  660. package/src/app/screens/AddBusiness.js +1161 -0
  661. package/src/app/screens/AddItems.js +515 -0
  662. package/src/app/screens/AddScreen.js +525 -165
  663. package/src/app/screens/All.js +1074 -0
  664. package/src/app/screens/AllTransactions.js +1138 -0
  665. package/src/app/screens/Banks.js +1134 -133
  666. package/src/app/screens/BillDetails.js +989 -0
  667. package/src/app/screens/BillHome.js +97 -0
  668. package/src/app/screens/BillParent.js +419 -0
  669. package/src/app/screens/BusinessDetail.js +939 -0
  670. package/src/app/screens/CashEntry.js +2913 -0
  671. package/src/app/screens/CashEntryDetails.js +650 -0
  672. package/src/app/screens/CashHome.js +594 -0
  673. package/src/app/screens/CashReport.js +1658 -0
  674. package/src/app/screens/CashSummary.js +607 -0
  675. package/src/app/screens/CreateBill.js +2504 -0
  676. package/src/app/screens/CustomerEntries.js +1578 -350
  677. package/src/app/screens/Customers.js +1066 -213
  678. package/src/app/screens/EditCategory.js +316 -0
  679. package/src/app/screens/EditCategoryStock.js +320 -0
  680. package/src/app/screens/Entry.js +2555 -585
  681. package/src/app/screens/ExpenseDetail.js +14 -0
  682. package/src/app/screens/ExpenseEntries.js +837 -0
  683. package/src/app/screens/ExpenseEntry.js +2478 -0
  684. package/src/app/screens/ExpenseEntryDetails.js +612 -0
  685. package/src/app/screens/ExpenseEntryReport.js +1059 -0
  686. package/src/app/screens/ExpenseReport.js +1071 -0
  687. package/src/app/screens/Geolocation.js +435 -0
  688. package/src/app/screens/GetStarted.js +201 -0
  689. package/src/app/screens/HomeScreen.js +368 -132
  690. package/src/app/screens/InBuy.js +918 -0
  691. package/src/app/screens/ItemEntryDetails.js +582 -0
  692. package/src/app/screens/LowStock.js +417 -0
  693. package/src/app/screens/NewPin.js +225 -0
  694. package/src/app/screens/OutSell.js +2153 -0
  695. package/src/app/screens/POSSale.js +639 -0
  696. package/src/app/screens/PinScreen.js +720 -0
  697. package/src/app/screens/PreviewBill.js +302 -0
  698. package/src/app/screens/Profile.js +1594 -0
  699. package/src/app/screens/RateList.js +525 -0
  700. package/src/app/screens/Report.js +1401 -0
  701. package/src/app/screens/SaleItemDetail.js +1187 -0
  702. package/src/app/screens/SaleParent.js +345 -0
  703. package/src/app/screens/SelectBank.js +220 -0
  704. package/src/app/screens/SelectBusiness.js +670 -163
  705. package/src/app/screens/Splash.js +96 -15
  706. package/src/app/screens/StockChild.js +372 -0
  707. package/src/app/screens/StockDetail.js +758 -0
  708. package/src/app/screens/StockParent.js +287 -0
  709. package/src/app/screens/StockReport.js +1359 -0
  710. package/src/app/screens/StockValue.js +720 -0
  711. package/src/app/screens/Suppliers.js +1098 -205
  712. package/src/app/screens/TransactionDetails.js +1674 -180
  713. package/src/app/screens/UpdateBusiness.js +837 -0
  714. package/src/app/screens/VisionCamera.js +54 -0
  715. package/src/app/screens/index.js +111 -21
  716. package/src/app/screens/new.html +171 -0
  717. package/src/app/themes/config.js +431 -114
  718. package/src/app/utils/city.json +7265 -0
@@ -1,9 +1,10 @@
1
1
  "use strict";
2
2
 
3
3
  import db from "./database.js";
4
- export const addClient = (name, phoneNum, type) => {
4
+ export const addClient = (name, phoneNum, type, business_id = null, serverId = null,
5
+ // NEW: serverId
6
+ created_at = null, updated_at = null) => {
5
7
  return new Promise((resolve, reject) => {
6
- // Default JSON for status
7
8
  const defaultStatus = JSON.stringify({
8
9
  flat: "",
9
10
  landmark: "",
@@ -11,23 +12,138 @@ export const addClient = (name, phoneNum, type) => {
11
12
  city: "",
12
13
  state: ""
13
14
  });
15
+ const normalizedPhone = phoneNum ? String(phoneNum).trim() : "";
14
16
  db.transaction(tx => {
15
- tx.executeSql("INSERT INTO Clients (name, phone, type, status) VALUES (?, ?, ?, ?)", [name, phoneNum, type, defaultStatus], (txObj, resultSet) => resolve(resultSet), (txObj, error) => reject(error));
17
+ // 🟢 Case 1: No phone number insert directly
18
+ if (!normalizedPhone) {
19
+ const fields = ["name", "phone", "type", "status", "isDeleted", "business_id"];
20
+ const placeholders = ["?", "?", "?", "?", 0, "?"];
21
+ const values = [name, null, type, defaultStatus, business_id];
22
+ if (serverId !== null) {
23
+ fields.push("serverId");
24
+ placeholders.push("?");
25
+ values.push(serverId);
26
+ }
27
+ if (created_at) {
28
+ fields.push("created_at");
29
+ placeholders.push("?");
30
+ values.push(created_at);
31
+ }
32
+ if (updated_at) {
33
+ fields.push("updated_at");
34
+ placeholders.push("?");
35
+ values.push(updated_at);
36
+ }
37
+ const sql = `INSERT INTO Clients (${fields.join(",")}) VALUES (${placeholders.join(",")})`;
38
+ tx.executeSql(sql, values, (txObj, insertResult) => resolve(insertResult), (txObj, error) => reject(error));
39
+ return;
40
+ }
41
+
42
+ // 🟢 Case 2: Check for existing client (same phone & same business)
43
+ tx.executeSql(`
44
+ SELECT * FROM Clients
45
+ WHERE phone = ?
46
+ AND (isDeleted IS NULL OR isDeleted = 0)
47
+ AND business_id = ?
48
+ `, [normalizedPhone, business_id], (txObj, resultSet) => {
49
+ if (resultSet.rows.length > 0) {
50
+ // 🟥 Duplicate found → don't insert
51
+ const existing = resultSet.rows.item(0);
52
+ resolve({
53
+ insertId: existing.id,
54
+ rowsAffected: 0,
55
+ existing: true,
56
+ client: existing
57
+ });
58
+ } else {
59
+ // 🟢 Case 3: Insert new client (unique phone + business_id)
60
+ const fields = ["name", "phone", "type", "status", "isDeleted", "business_id"];
61
+ const placeholders = ["?", "?", "?", "?", 0, "?"];
62
+ const values = [name, normalizedPhone, type, defaultStatus, business_id];
63
+ if (serverId !== null) {
64
+ fields.push("serverId");
65
+ placeholders.push("?");
66
+ values.push(serverId);
67
+ }
68
+ if (created_at) {
69
+ fields.push("created_at");
70
+ placeholders.push("?");
71
+ values.push(created_at);
72
+ }
73
+ if (updated_at) {
74
+ fields.push("updated_at");
75
+ placeholders.push("?");
76
+ values.push(updated_at);
77
+ }
78
+ const sql = `INSERT INTO Clients (${fields.join(",")}) VALUES (${placeholders.join(",")})`;
79
+ tx.executeSql(sql, values, (txObj, insertResult) => resolve(insertResult), (txObj, error) => reject(error));
80
+ }
81
+ }, (txObj, error) => reject(error));
16
82
  });
17
83
  });
18
84
  };
19
- export const getAllClients = () => {
85
+ export const getAllClients = (sortBy = 'most_recent', business_id = null) => {
20
86
  return new Promise((resolve, reject) => {
21
87
  db.transaction(tx => {
22
- tx.executeSql("SELECT * FROM Clients", [], (txObj, resultSet) => {
23
- let results = [];
88
+ // Base query
89
+ let sql = `
90
+ SELECT
91
+ c.id,
92
+ c.serverId AS serverId, -- ✅ Ensure serverId is returned
93
+ c.name,
94
+ c.type,
95
+ c.local_path,
96
+ c.notification,
97
+ c.phone,
98
+ c.paydate,
99
+ c.business_id,
100
+
101
+ IFNULL(SUM(CAST(t.amount AS REAL)), 0) AS total_amount,
102
+ IFNULL(SUM(CAST(t.subamount AS REAL)), 0) AS total_subamount,
103
+ IFNULL(MAX(t.created_at), '') AS latest_created_at,
104
+ IFNULL(MAX(t.updated_at), '') AS latest_updated_at,
105
+ IFNULL(MAX(c.created_at), '') AS created_at,
106
+ IFNULL(MAX(t.date), '') AS latest_transaction_date,
107
+ COALESCE(MAX(t.date), MAX(c.created_at)) AS effective_date
108
+ FROM Clients c
109
+ LEFT JOIN Transactions t
110
+ ON c.id = t.customer_id
111
+ AND (t.isDeleted IS NULL OR t.isDeleted = 0)
112
+ WHERE
113
+ (c.isDeleted IS NULL OR c.isDeleted = 0)
114
+ `;
115
+ const params = [];
116
+ // Add filter if business_id is provided
117
+ if (business_id !== null && business_id !== undefined) {
118
+ sql += ` AND c.business_id = ?`;
119
+ params.push(business_id);
120
+ }
121
+
122
+ // GROUP BY clause
123
+ sql += `
124
+ GROUP BY
125
+ c.id,
126
+ c.serverId, -- ✅ Include in GROUP BY
127
+ c.name,
128
+ c.type,
129
+ c.local_path,
130
+ c.notification,
131
+ c.phone,
132
+ c.paydate,
133
+ c.business_id
134
+ `;
135
+
136
+ // Sorting logic
137
+ if (sortBy === 'most_recent') sql += ` ORDER BY effective_date DESC`;else if (sortBy === 'oldest') sql += ` ORDER BY effective_date ASC`;else if (sortBy === 'name_az') sql += ` ORDER BY c.name COLLATE NOCASE ASC`;else if (sortBy === 'name_za') sql += ` ORDER BY c.name COLLATE NOCASE DESC`;else sql += ` ORDER BY effective_date DESC`;
138
+
139
+ // Execute SQL
140
+ tx.executeSql(sql, params, (txObj, resultSet) => {
141
+ const data = [];
24
142
  for (let i = 0; i < resultSet.rows.length; i++) {
25
- results.push(resultSet.rows.item(i));
143
+ data.push(resultSet.rows.item(i));
26
144
  }
27
- resolve(results);
28
- }, (txObj, error) => {
29
- reject(error);
30
- });
145
+ resolve(data);
146
+ }, (txObj, error) => reject(error));
31
147
  });
32
148
  });
33
149
  };
@@ -46,37 +162,277 @@ export const deleteClientById = id => {
46
162
  });
47
163
  });
48
164
  };
49
- export const getClientsByType = type => {
165
+ export const getClientsByType = (type, sortBy = 'most_recent', monthName = null, business_id) => {
50
166
  return new Promise((resolve, reject) => {
51
167
  db.transaction(tx => {
52
- tx.executeSql(`SELECT
53
- c.id,
54
- c.name,
55
- c.type,
56
- IFNULL(SUM(t.amount), 0) AS total_amount,
57
- IFNULL(SUM(t.subamount), 0) AS total_subamount,
58
- IFNULL(MAX(t.created_at), DATETIME('now')) AS latest_created_at,
59
- IFNULL(MAX(t.updated_at), DATETIME('now')) AS latest_updated_at
60
- FROM Clients c
61
- LEFT JOIN Transactions t
62
- ON c.id = t.customer_id
63
- WHERE c.type = ?
64
- GROUP BY c.id, c.name, c.type;`, [type], (txObj, resultSet) => {
65
- let data = [];
168
+ let sql = `
169
+ SELECT
170
+ c.id,
171
+ c.name,
172
+ c.type,
173
+ c.account, -- Added account
174
+ c.local_path,
175
+ c.notification,
176
+ c.phone,
177
+ c.paydate,
178
+ c.business_id,
179
+
180
+ IFNULL(SUM(CAST(t.amount AS REAL)), 0) AS total_amount,
181
+ IFNULL(SUM(CAST(t.subamount AS REAL)), 0) AS total_subamount,
182
+ IFNULL(MAX(t.created_at), '') AS latest_created_at,
183
+ IFNULL(MAX(t.updated_at), '') AS latest_updated_at,
184
+ IFNULL(MAX(c.updated_at), '') AS created_at,
185
+ IFNULL(MAX(t.date), '') AS latest_transaction_date,
186
+ COALESCE(MAX(t.date), MAX(c.created_at)) AS effective_date
187
+ FROM Clients c
188
+ LEFT JOIN Transactions t
189
+ ON c.id = t.customer_id
190
+ AND (t.isDeleted IS NULL OR t.isDeleted = 0)
191
+ WHERE
192
+ c.type = ?
193
+ AND c.business_id = ?
194
+ AND (c.isDeleted IS NULL OR c.isDeleted = 0)
195
+ GROUP BY
196
+ c.id,
197
+ c.name,
198
+ c.type,
199
+ c.account, -- ✅ Added to GROUP BY
200
+ c.local_path,
201
+ c.notification,
202
+ c.phone,
203
+ c.paydate,
204
+ c.business_id
205
+ `;
206
+
207
+ // Sorting
208
+ if (sortBy === 'most_recent') sql += ` ORDER BY effective_date DESC`;else if (sortBy === 'oldest') sql += ` ORDER BY effective_date ASC`;else if (sortBy === 'name_az') sql += ` ORDER BY c.name COLLATE NOCASE ASC`;else if (sortBy === 'name_za') sql += ` ORDER BY c.name COLLATE NOCASE DESC`;else sql += ` ORDER BY effective_date DESC`;
209
+ tx.executeSql(sql, [type, business_id], (txObj, resultSet) => {
210
+ const data = [];
66
211
  for (let i = 0; i < resultSet.rows.length; i++) {
67
212
  data.push(resultSet.rows.item(i));
68
213
  }
69
- resolve(data);
70
- }, (txObj, error) => {
71
- reject(error);
72
- });
214
+
215
+ // Optional month filter
216
+ let filteredData = data;
217
+ if (monthName) {
218
+ const months = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];
219
+ filteredData = data.filter(item => {
220
+ const dateStr = item?.latest_transaction_date || item?.created_at;
221
+ if (!dateStr) return false;
222
+ const date = new Date(dateStr.replace(" ", "T"));
223
+ return months[date.getMonth()] === monthName;
224
+ });
225
+ }
226
+ resolve(filteredData);
227
+ }, (txObj, error) => reject(error));
228
+ });
229
+ });
230
+ };
231
+
232
+ // export const getClientsByType = (type, sortBy = 'most_recent') => {
233
+ // return new Promise((resolve, reject) => {
234
+ // db.transaction((tx) => {
235
+ // // Base query
236
+ // let sql = `
237
+ // SELECT
238
+ // c.id,
239
+ // c.name,
240
+ // c.type,
241
+ // c.local_path,
242
+ // c.notification,
243
+ // c.phone,
244
+ // c.paydate, -- added here
245
+
246
+ // IFNULL(SUM(t.amount), 0) AS total_amount,
247
+ // IFNULL(SUM(t.subamount), 0) AS total_subamount,
248
+ // IFNULL(MAX(t.created_at), '') AS latest_created_at,
249
+ // IFNULL(MAX(t.updated_at), '') AS latest_updated_at,
250
+ // IFNULL(MAX(c.updated_at), '') AS created_at,
251
+ // IFNULL(MAX(t.date), '') AS latest_transaction_date,
252
+ // COALESCE(MAX(t.date), MAX(c.created_at)) AS effective_date
253
+ // FROM Clients c
254
+ // LEFT JOIN Transactions t
255
+ // ON c.id = t.customer_id
256
+ // AND (t.isDeleted IS NULL OR t.isDeleted = 0) -- exclude deleted transactions
257
+ // WHERE c.type = ?
258
+ // GROUP BY
259
+ // c.id,
260
+ // c.name,
261
+ // c.type,
262
+ // c.local_path,
263
+ // c.notification,
264
+ // c.phone,
265
+ // c.paydate
266
+ // `;
267
+
268
+ // // Decide order by clause based on sortBy
269
+ // if (sortBy === 'most_recent') {
270
+ // sql += ` ORDER BY effective_date DESC`;
271
+ // } else if (sortBy === 'oldest') {
272
+ // sql += ` ORDER BY effective_date ASC`;
273
+ // } else if (sortBy === 'name_az') {
274
+ // sql += ` ORDER BY c.name COLLATE NOCASE ASC`;
275
+ // } else if (sortBy === 'name_za') {
276
+ // sql += ` ORDER BY c.name COLLATE NOCASE DESC`;
277
+ // } else {
278
+ // // default
279
+ // sql += ` ORDER BY effective_date DESC`;
280
+ // }
281
+
282
+ // tx.executeSql(
283
+ // sql,
284
+ // [type],
285
+ // (txObj, resultSet) => {
286
+ // let data = [];
287
+ // for (let i = 0; i < resultSet.rows.length; i++) {
288
+ // data.push(resultSet.rows.item(i));
289
+ // }
290
+ // resolve(data);
291
+ // },
292
+ // (txObj, error) => {
293
+ // reject(error);
294
+ // }
295
+ // );
296
+ // });
297
+ // });
298
+ // };
299
+
300
+ // export const getClientsByType = (type, sortBy = 'most_recent') => {
301
+ // return new Promise((resolve, reject) => {
302
+ // db.transaction((tx) => {
303
+ // // Base query
304
+ // let sql = `
305
+ // SELECT
306
+ // c.id,
307
+ // c.name,
308
+ // c.type,
309
+ // c.local_path,
310
+ // c.notification,
311
+ // c.phone,
312
+ // c.paydate, -- added here
313
+
314
+ // IFNULL(SUM(t.amount), 0) AS total_amount,
315
+ // IFNULL(SUM(t.subamount), 0) AS total_subamount,
316
+ // IFNULL(MAX(t.created_at), '') AS latest_created_at,
317
+ // IFNULL(MAX(t.updated_at), '') AS latest_updated_at,
318
+ // IFNULL(MAX(c.updated_at), '') AS created_at,
319
+ // IFNULL(MAX(t.date), '') AS latest_transaction_date,
320
+ // COALESCE(MAX(t.date), MAX(c.created_at)) AS effective_date
321
+ // FROM Clients c
322
+ // LEFT JOIN Transactions t
323
+ // ON c.id = t.customer_id
324
+ // WHERE c.type = ?
325
+ // GROUP BY
326
+ // c.id,
327
+ // c.name,
328
+ // c.type,
329
+ // c.local_path,
330
+ // c.notification,
331
+ // c.phone,
332
+ // c.paydate
333
+ // `;
334
+
335
+ // // Decide order by clause based on sortBy
336
+ // if (sortBy === 'most_recent') {
337
+ // sql += ` ORDER BY effective_date DESC`;
338
+ // } else if (sortBy === 'oldest') {
339
+ // sql += ` ORDER BY effective_date ASC`;
340
+ // } else if (sortBy === 'name_az') {
341
+ // sql += ` ORDER BY c.name COLLATE NOCASE ASC`;
342
+ // } else if (sortBy === 'name_za') {
343
+ // sql += ` ORDER BY c.name COLLATE NOCASE DESC`;
344
+ // } else {
345
+ // // default
346
+ // sql += ` ORDER BY effective_date DESC`;
347
+ // }
348
+
349
+ // tx.executeSql(
350
+ // sql,
351
+ // [type],
352
+ // (txObj, resultSet) => {
353
+ // let data = [];
354
+ // for (let i = 0; i < resultSet.rows.length; i++) {
355
+ // data.push(resultSet.rows.item(i));
356
+ // }
357
+ // resolve(data);
358
+ // },
359
+ // (txObj, error) => {
360
+ // reject(error);
361
+ // }
362
+ // );
363
+ // });
364
+ // });
365
+ // };
366
+
367
+ export const addTransaction = (customer_id, amount, subamount, notes, date, local_path, cash_type, items = '',
368
+ // optional field
369
+ isInstallment = 0,
370
+ // optional field
371
+ serverId = null,
372
+ // optional serverId
373
+ created_at = null,
374
+ // optional created_at
375
+ updated_at = null // optional updated_at
376
+ ) => {
377
+ return new Promise((resolve, reject) => {
378
+ db.transaction(tx => {
379
+ const fields = ["customer_id", "amount", "subamount", "notes", "date", "local_path", "cash_type", "items", "isInstallment"];
380
+ const placeholders = ["?", "?", "?", "?", "?", "?", "?", "?", "?"];
381
+ const values = [customer_id, amount, subamount, notes, date, local_path, cash_type, items, isInstallment];
382
+
383
+ // Add serverId if provided
384
+ if (serverId) {
385
+ fields.push("serverId");
386
+ placeholders.push("?");
387
+ values.push(serverId);
388
+ }
389
+
390
+ // Add created_at if provided
391
+ if (created_at) {
392
+ fields.push("created_at");
393
+ placeholders.push("?");
394
+ values.push(created_at);
395
+ }
396
+
397
+ // Add updated_at if provided
398
+ if (updated_at) {
399
+ fields.push("updated_at");
400
+ placeholders.push("?");
401
+ values.push(updated_at);
402
+ }
403
+ const sql = `INSERT INTO Transactions (${fields.join(",")}) VALUES (${placeholders.join(",")})`;
404
+ tx.executeSql(sql, values, (txObj, resultSet) => resolve(resultSet), (txObj, error) => reject(error));
405
+ });
406
+ });
407
+ };
408
+ export const getAllTransactions = () => {
409
+ return new Promise((resolve, reject) => {
410
+ db.transaction(tx => {
411
+ tx.executeSql(`SELECT * FROM Transactions ORDER BY date DESC, id DESC`,
412
+ // latest first
413
+ [], (txObj, resultSet) => {
414
+ const transactions = [];
415
+ for (let i = 0; i < resultSet.rows.length; i++) {
416
+ transactions.push(resultSet.rows.item(i));
417
+ }
418
+ resolve(transactions);
419
+ }, (txObj, error) => reject(error));
73
420
  });
74
421
  });
75
422
  };
76
- export const addTransaction = (customer_id, amount, subamount, notes, date, local_path) => {
423
+ export const updateTransaction = (trxId, customer_id, amount, subamount, notes, date, local_path, items = '' // ✅ new optional field
424
+ ) => {
77
425
  return new Promise((resolve, reject) => {
78
426
  db.transaction(tx => {
79
- tx.executeSql("INSERT INTO Transactions (customer_id, amount, subamount, notes, date, local_path) VALUES (?, ?, ?, ?, ?, ?)", [customer_id, amount, subamount, notes, date, local_path], (txObj, resultSet) => resolve(resultSet), (txObj, error) => reject(error));
427
+ tx.executeSql(`UPDATE Transactions
428
+ SET customer_id = ?,
429
+ amount = ?,
430
+ subamount = ?,
431
+ notes = ?,
432
+ date = ?,
433
+ local_path = ?,
434
+ items = ?
435
+ WHERE id = ?`, [customer_id, amount, subamount, notes, date, local_path, items, trxId], (txObj, resultSet) => resolve(resultSet), (txObj, error) => reject(error));
80
436
  });
81
437
  });
82
438
  };
@@ -95,11 +451,27 @@ export const getClientDetails = id => {
95
451
  });
96
452
  });
97
453
  };
98
- export const getClientTransactions = client_id => {
454
+ export const getClientTransactions = (client_id, startDate, endDate) => {
99
455
  return new Promise((resolve, reject) => {
100
456
  db.transaction(tx => {
101
- // Step 1: Get all transactions for the client
102
- tx.executeSql("SELECT * FROM Transactions WHERE customer_id = ? ORDER BY created_at DESC", [client_id], (txObj, resultSet) => {
457
+ // Base SQL
458
+ let sql = `
459
+ SELECT *
460
+ FROM Transactions
461
+ WHERE customer_id = ?
462
+ AND (isDeleted IS NULL OR isDeleted = 0)
463
+ `;
464
+ const params = [client_id];
465
+
466
+ // ✅ Filter by date range if provided
467
+ if (startDate && endDate) {
468
+ sql += ` AND date(date) BETWEEN date(?) AND date(?)`;
469
+ params.push(startDate, endDate);
470
+ }
471
+ sql += ` ORDER BY date DESC`;
472
+
473
+ // Step 1: Get transactions
474
+ tx.executeSql(sql, params, (txObj, resultSet) => {
103
475
  const transactions = [];
104
476
  for (let i = 0; i < resultSet.rows.length; i++) {
105
477
  transactions.push({
@@ -108,7 +480,7 @@ export const getClientTransactions = client_id => {
108
480
  });
109
481
  }
110
482
  if (transactions.length === 0) {
111
- resolve([]); // no transactions → return empty array
483
+ resolve([]);
112
484
  return;
113
485
  }
114
486
 
@@ -139,6 +511,65 @@ export const getClientTransactions = client_id => {
139
511
  });
140
512
  });
141
513
  };
514
+
515
+ // export const getClientTransactions = (client_id) => {
516
+ // return new Promise((resolve, reject) => {
517
+ // db.transaction((tx) => {
518
+ // // Step 1: Get all transactions for the client
519
+ // tx.executeSql(
520
+ // "SELECT * FROM Transactions WHERE customer_id = ? ORDER BY created_at DESC",
521
+ // [client_id],
522
+ // (txObj, resultSet) => {
523
+ // const transactions = [];
524
+ // for (let i = 0; i < resultSet.rows.length; i++) {
525
+ // transactions.push({
526
+ // ...resultSet.rows.item(i),
527
+ // attachments: [] // prepare attachments array
528
+ // });
529
+ // }
530
+
531
+ // if (transactions.length === 0) {
532
+ // resolve([]); // no transactions → return empty array
533
+ // return;
534
+ // }
535
+
536
+ // // Step 2: Collect transaction IDs
537
+ // const trxIds = transactions.map((t) => t.id);
538
+
539
+ // // Step 3: Query all attachments for these trxIds
540
+ // const placeholders = trxIds.map(() => "?").join(",");
541
+ // tx.executeSql(
542
+ // `SELECT * FROM TransactionImages WHERE trxId IN (${placeholders})`,
543
+ // trxIds,
544
+ // (txObj2, resultSet2) => {
545
+ // const attachments = [];
546
+ // for (let i = 0; i < resultSet2.rows.length; i++) {
547
+ // attachments.push(resultSet2.rows.item(i));
548
+ // }
549
+
550
+ // // Step 4: Merge attachments into transactions
551
+ // const transactionMap = {};
552
+ // transactions.forEach((t) => {
553
+ // transactionMap[t.id] = t;
554
+ // });
555
+
556
+ // attachments.forEach((att) => {
557
+ // if (transactionMap[att.trxId]) {
558
+ // transactionMap[att.trxId].attachments.push(att);
559
+ // }
560
+ // });
561
+
562
+ // resolve(transactions);
563
+ // },
564
+ // (txObj2, error) => reject(error)
565
+ // );
566
+ // },
567
+ // (txObj, error) => reject(error)
568
+ // );
569
+ // });
570
+ // });
571
+ // };
572
+
142
573
  export const addTransactionImages = (trxId, local_path) => {
143
574
  return new Promise((resolve, reject) => {
144
575
  db.transaction(tx => {
@@ -146,4 +577,719 @@ export const addTransactionImages = (trxId, local_path) => {
146
577
  });
147
578
  });
148
579
  };
580
+ export const updateTransactionImage = (attachment_id, trxId, local_path) => {
581
+ return new Promise((resolve, reject) => {
582
+ // if uri is falsy or an empty string -> delete the row
583
+ if (!local_path || typeof local_path === 'string' && local_path.trim() === '') {
584
+ if (!attachment_id) {
585
+ // nothing to delete
586
+ console.log('updateTransactionImage: no attachment_id to delete');
587
+ return resolve({
588
+ rowsAffected: 0
589
+ });
590
+ }
591
+ // delete instead of update
592
+ return deleteTransactionImage(attachment_id).then(res => resolve(res)).catch(err => reject(err));
593
+ }
594
+
595
+ // if there's no attachment_id (new file), fall back to INSERT
596
+ if (!attachment_id) {
597
+ // call your existing addTransactionImages function
598
+ return addTransactionImages(trxId, local_path).then(res => {
599
+ console.log('Inserted new TransactionImage, insertId:', res.insertId);
600
+ resolve(res);
601
+ }).catch(err => {
602
+ console.log('Error inserting new TransactionImage:', err);
603
+ reject(err);
604
+ });
605
+ }
606
+
607
+ // Normal UPDATE branch
608
+ db.transaction(tx => {
609
+ tx.executeSql(`UPDATE TransactionImages
610
+ SET trxId = ?,
611
+ local_path = ?,
612
+ updated_at = datetime('now')
613
+ WHERE id = ?`, [trxId, local_path, attachment_id], (txObj, resultSet) => {
614
+ console.log('updateTransactionImage rowsAffected:', resultSet.rowsAffected);
615
+ resolve(resultSet);
616
+ }, (txObj, error) => {
617
+ console.log('SQLite error updating image:', error);
618
+ reject(error);
619
+ });
620
+ });
621
+ });
622
+ };
623
+ export const deleteTransactionImage = attachment_id => {
624
+ return new Promise((resolve, reject) => {
625
+ db.transaction(tx => {
626
+ tx.executeSql(`DELETE FROM TransactionImages WHERE id = ?`, [attachment_id], (txObj, resultSet) => {
627
+ console.log('deleteTransactionImage rowsAffected:', resultSet.rowsAffected);
628
+ resolve(resultSet);
629
+ }, (txObj, error) => {
630
+ console.log('SQLite error deleting image:', error);
631
+ reject(error);
632
+ });
633
+ });
634
+ });
635
+ };
636
+ export const deleteTransactionImagesByTrxId = trxId => {
637
+ return new Promise((resolve, reject) => {
638
+ db.transaction(tx => {
639
+ tx.executeSql(`DELETE FROM TransactionImages WHERE trxId = ?`, [trxId], (txObj, resultSet) => {
640
+ console.log('deleteTransactionImagesByTrxId rowsAffected:', resultSet.rowsAffected);
641
+ resolve(resultSet);
642
+ }, (txObj, error) => {
643
+ console.log('SQLite error deleting images by trxId:', error);
644
+ reject(error);
645
+ });
646
+ });
647
+ });
648
+ };
649
+ export const addBank = (bank_id, bank_name, bank_charges, transfer_time, icon, code, allowed_digits, bank_hint) => {
650
+ return new Promise((resolve, reject) => {
651
+ db.transaction(tx => {
652
+ tx.executeSql(`INSERT INTO Bank
653
+ (bank_id, bank_name, bank_charges, transfer_time, icon, code, allowed_digits, bank_hint)
654
+ VALUES (?, ?, ?, ?, ?, ?, ?, ?)`, [bank_id, bank_name, bank_charges, transfer_time, icon, code, allowed_digits, bank_hint], (txObj, resultSet) => resolve(resultSet),
655
+ // success
656
+ (txObj, error) => reject(error) // error
657
+ );
658
+ });
659
+ });
660
+ };
661
+ export const getAllBanks = () => {
662
+ return new Promise((resolve, reject) => {
663
+ db.transaction(tx => {
664
+ tx.executeSql("SELECT * FROM Bank",
665
+ // your table name
666
+ [], (txObj, resultSet) => {
667
+ let results = [];
668
+ for (let i = 0; i < resultSet.rows.length; i++) {
669
+ results.push(resultSet.rows.item(i));
670
+ }
671
+ resolve(results);
672
+ }, (txObj, error) => {
673
+ reject(error);
674
+ });
675
+ });
676
+ });
677
+ };
678
+ export const clearAllBanks = () => {
679
+ return new Promise((resolve, reject) => {
680
+ db.transaction(tx => {
681
+ tx.executeSql("DELETE FROM Bank",
682
+ // delete all rows
683
+ [], (txObj, resultSet) => {
684
+ resolve(resultSet); // success
685
+ }, (txObj, error) => {
686
+ reject(error); // error
687
+ });
688
+ });
689
+ });
690
+ };
691
+ export const bankExists = bank_id => {
692
+ return new Promise((resolve, reject) => {
693
+ db.transaction(tx => {
694
+ tx.executeSql("SELECT COUNT(*) as count FROM Bank WHERE bank_id = ?", [bank_id], (txObj, resultSet) => {
695
+ const count = resultSet.rows.item(0).count;
696
+ resolve(count > 0); // true if exists
697
+ }, (txObj, error) => reject(error));
698
+ });
699
+ });
700
+ };
701
+ export const insertBank = (name, phoneNum, type, notification, local_path, business_id, serverId = null,
702
+ // NEW: serverId
703
+ created_at = null, updated_at = null) => {
704
+ return new Promise((resolve, reject) => {
705
+ // Default JSON for status
706
+ const defaultStatus = JSON.stringify({
707
+ flat: "",
708
+ landmark: "",
709
+ pincode: "",
710
+ city: "",
711
+ state: ""
712
+ });
713
+
714
+ // Normalize inputs
715
+ const normalizedName = name ? String(name).trim() : "";
716
+ const normalizedPhone = phoneNum ? String(phoneNum).trim() : "";
717
+ db.transaction(tx => {
718
+ // Step 1: Check if a client with SAME name, SAME phone, AND SAME business exists
719
+ tx.executeSql(`SELECT * FROM Clients
720
+ WHERE name = ?
721
+ AND phone = ?
722
+ AND business_id = ?
723
+ AND (isDeleted IS NULL OR isDeleted = 0)`, [normalizedName, normalizedPhone, business_id], (txObj, resultSet) => {
724
+ if (resultSet.rows.length > 0) {
725
+ // Already exists → build a "fake" insertResult
726
+ const existing = resultSet.rows.item(0);
727
+ resolve({
728
+ insertId: existing.id,
729
+ rowsAffected: 0,
730
+ existing: true,
731
+ client: existing
732
+ });
733
+ } else {
734
+ // Step 2: Insert new record with optional created_at / updated_at / serverId
735
+ const fields = ["name", "phone", "type", "status", "notification", "local_path", "business_id", "isDeleted"];
736
+ const placeholders = ["?", "?", "?", "?", "?", "?", "?", 0];
737
+ const values = [normalizedName, normalizedPhone, type, defaultStatus, notification, local_path, business_id];
738
+ if (serverId !== null) {
739
+ fields.push("serverId");
740
+ placeholders.push("?");
741
+ values.push(serverId);
742
+ }
743
+ if (created_at) {
744
+ fields.push("created_at");
745
+ placeholders.push("?");
746
+ values.push(created_at);
747
+ }
748
+ if (updated_at) {
749
+ fields.push("updated_at");
750
+ placeholders.push("?");
751
+ values.push(updated_at);
752
+ }
753
+ const sql = `INSERT INTO Clients (${fields.join(",")}) VALUES (${placeholders.join(",")})`;
754
+ tx.executeSql(sql, values, (txObj, insertResult) => resolve(insertResult), (txObj, error) => reject(error));
755
+ }
756
+ }, (txObj, error) => reject(error));
757
+ });
758
+ });
759
+ };
760
+ export const setPayDate = (newPayDate, clientId, optionId) => {
761
+ return new Promise((resolve, reject) => {
762
+ db.transaction(tx => {
763
+ tx.executeSql("UPDATE Clients SET paydate = ?, fb_id = ? WHERE id = ?", [newPayDate, optionId, clientId], (txObj, resultSet) => {
764
+ console.log("Rows affected:", resultSet.rowsAffected);
765
+ resolve(resultSet);
766
+ }, (txObj, error) => {
767
+ console.log("Error updating paydate and fb_id:", error);
768
+ reject(error);
769
+ });
770
+ });
771
+ });
772
+ };
773
+ export const insertPhoneNum = (phoneNum, clientId) => {
774
+ return new Promise((resolve, reject) => {
775
+ db.transaction(tx => {
776
+ tx.executeSql("UPDATE Clients SET phone = ? WHERE id = ?", [phoneNum, clientId], (txObj, resultSet) => {
777
+ console.log("Rows affected:", resultSet.rowsAffected);
778
+ resolve(resultSet);
779
+ }, (txObj, error) => {
780
+ console.log("Error updating phone num:", error);
781
+ reject(error);
782
+ });
783
+ });
784
+ });
785
+ };
786
+ export const setProfilePic = (uri, clientId) => {
787
+ return new Promise((resolve, reject) => {
788
+ db.transaction(tx => {
789
+ tx.executeSql("UPDATE Clients SET local_path = ? WHERE id = ?", [uri, clientId], (txObj, resultSet) => {
790
+ console.log("Rows affected:", resultSet.rowsAffected);
791
+ resolve(resultSet);
792
+ }, (txObj, error) => {
793
+ console.log("Error updating profile pic and fb_id:", error);
794
+ reject(error);
795
+ });
796
+ });
797
+ });
798
+ };
799
+ export const setClientName = (name, clientId) => {
800
+ return new Promise((resolve, reject) => {
801
+ db.transaction(tx => {
802
+ tx.executeSql("UPDATE Clients SET name = ? WHERE id = ?", [name, clientId], (txObj, resultSet) => {
803
+ console.log("Name updated. Rows affected:", resultSet.rowsAffected);
804
+ resolve(resultSet);
805
+ }, (txObj, error) => {
806
+ console.log("Error updating name:", error);
807
+ reject(error);
808
+ });
809
+ });
810
+ });
811
+ };
812
+ export const setClientPhone = (phone, clientId) => {
813
+ return new Promise((resolve, reject) => {
814
+ db.transaction(tx => {
815
+ tx.executeSql("UPDATE Clients SET phone = ? WHERE id = ?", [phone, clientId], (txObj, resultSet) => {
816
+ console.log("Phone updated. Rows affected:", resultSet.rowsAffected);
817
+ resolve(resultSet);
818
+ }, (txObj, error) => {
819
+ console.log("Error updating phone:", error);
820
+ reject(error);
821
+ });
822
+ });
823
+ });
824
+ };
825
+ export const setClientCnic = (cnic, clientId) => {
826
+ return new Promise((resolve, reject) => {
827
+ db.transaction(tx => {
828
+ tx.executeSql("UPDATE Clients SET cnic = ? WHERE id = ?", [cnic, clientId], (txObj, resultSet) => {
829
+ console.log("CNIC updated. Rows affected:", resultSet.rowsAffected);
830
+ resolve(resultSet);
831
+ }, (txObj, error) => {
832
+ console.log("Error updating CNIC:", error);
833
+ reject(error);
834
+ });
835
+ });
836
+ });
837
+ };
838
+ export const setClientAddress = (addressObj, clientId) => {
839
+ return new Promise((resolve, reject) => {
840
+ const jsonAddress = JSON.stringify(addressObj);
841
+ db.transaction(tx => {
842
+ tx.executeSql('UPDATE Clients SET status = ? WHERE id = ?', [jsonAddress, clientId], (txObj, res) => resolve(res), (txObj, err) => reject(err));
843
+ });
844
+ });
845
+ };
846
+ export const switchClientToSupplier = clientId => {
847
+ return new Promise((resolve, reject) => {
848
+ db.transaction(tx => {
849
+ tx.executeSql("UPDATE Clients SET type = 1 WHERE id = ?", [clientId], (txObj, resultSet) => {
850
+ console.log("Rows affected (switch to supplier):", resultSet.rowsAffected);
851
+ resolve(resultSet);
852
+ }, (txObj, error) => {
853
+ console.log("Error switching client to supplier:", error);
854
+ reject(error);
855
+ });
856
+ });
857
+ });
858
+ };
859
+ export const getTransactionsByClientType = (type, startDate, endDate, businessId = null) => {
860
+ return new Promise((resolve, reject) => {
861
+ db.transaction(tx => {
862
+ // Base query
863
+ let sql = `
864
+ SELECT
865
+ t.*,
866
+ c.type AS client_type,
867
+ c.name AS client_name,
868
+ c.local_path AS client_local_path,
869
+ c.phone AS client_phone,
870
+ c.business_id AS client_business_id
871
+ FROM Transactions t
872
+ INNER JOIN Clients c ON t.customer_id = c.id
873
+ WHERE (t.isDeleted IS NULL OR t.isDeleted = 0) -- exclude soft deleted transactions
874
+ AND (c.isDeleted IS NULL OR c.isDeleted = 0) -- exclude soft deleted clients
875
+ `;
876
+
877
+ // Params array
878
+ const params = [];
879
+
880
+ // 🔹 Filter by client type if provided and not "all"
881
+ if (type && type.toLowerCase() !== 'all') {
882
+ sql += ` AND c.type = ?`;
883
+ params.push(type);
884
+ }
885
+
886
+ // 🔹 Filter by business ID if provided
887
+ if (businessId !== null && businessId !== undefined) {
888
+ sql += ` AND c.business_id = ?`;
889
+ params.push(businessId);
890
+ }
891
+
892
+ // 🔹 Filter by date range if both provided
893
+ if (startDate && endDate) {
894
+ sql += ` AND date(t.date) BETWEEN date(?) AND date(?)`;
895
+ params.push(startDate, endDate);
896
+ }
897
+
898
+ // 🔹 Order by most recent first
899
+ sql += ` ORDER BY t.date DESC;`;
900
+ tx.executeSql(sql, params, async (txObj, resultSet) => {
901
+ const transactions = [];
902
+ for (let i = 0; i < resultSet.rows.length; i++) {
903
+ transactions.push(resultSet.rows.item(i));
904
+ }
905
+
906
+ // ✅ If no transactions, resolve immediately
907
+ if (transactions.length === 0) return resolve([]);
908
+
909
+ // 🔹 Fetch transaction images for these transactions
910
+ const ids = transactions.map(t => t.id);
911
+ const placeholders = ids.map(() => '?').join(',');
912
+ tx.executeSql(`SELECT * FROM TransactionImages WHERE trxId IN (${placeholders})`, ids, (txObj2, imgResult) => {
913
+ const imagesMap = {};
914
+ for (let j = 0; j < imgResult.rows.length; j++) {
915
+ const row = imgResult.rows.item(j);
916
+ if (!imagesMap[row.trxId]) imagesMap[row.trxId] = [];
917
+ imagesMap[row.trxId].push(row);
918
+ }
919
+
920
+ // Attach images to each transaction
921
+ const withAttachments = transactions.map(t => ({
922
+ ...t,
923
+ attachments: imagesMap[t.id] || []
924
+ }));
925
+ resolve(withAttachments);
926
+ }, (txObj2, err2) => reject(err2));
927
+ }, (txObj, error) => {
928
+ console.log("Error getting transactions:", error);
929
+ reject(error);
930
+ });
931
+ });
932
+ });
933
+ };
934
+
935
+ // export const getTransactionsByClientType = (type, startDate, endDate) => {
936
+ // return new Promise((resolve, reject) => {
937
+ // db.transaction((tx) => {
938
+ // let sql = `
939
+ // SELECT
940
+ // t.*,
941
+ // c.type AS client_type,
942
+ // c.name AS client_name
943
+ // FROM Transactions t
944
+ // INNER JOIN Clients c ON t.customer_id = c.id
945
+ // WHERE c.type = ?
946
+ // AND (t.isDeleted IS NULL OR t.isDeleted = 0) -- exclude soft deleted transactions
947
+ // `;
948
+ // const params = [type];
949
+
950
+ // if (startDate && endDate) {
951
+ // sql += ` AND date(t.date) BETWEEN date(?) AND date(?)`;
952
+ // params.push(startDate, endDate);
953
+ // }
954
+
955
+ // sql += ` ORDER BY t.date DESC;`;
956
+
957
+ // tx.executeSql(
958
+ // sql,
959
+ // params,
960
+ // async (txObj, resultSet) => {
961
+ // const transactions = [];
962
+ // for (let i = 0; i < resultSet.rows.length; i++) {
963
+ // transactions.push(resultSet.rows.item(i));
964
+ // }
965
+
966
+ // // Fetch all images for these transactions
967
+ // const ids = transactions.map(t => t.id);
968
+ // if (ids.length === 0) return resolve([]);
969
+
970
+ // const placeholders = ids.map(() => '?').join(',');
971
+ // tx.executeSql(
972
+ // `SELECT * FROM TransactionImages WHERE trxId IN (${placeholders})`,
973
+ // ids,
974
+ // (txObj2, imgResult) => {
975
+ // const imagesMap = {};
976
+ // for (let j = 0; j < imgResult.rows.length; j++) {
977
+ // const row = imgResult.rows.item(j);
978
+ // if (!imagesMap[row.trxId]) imagesMap[row.trxId] = [];
979
+ // imagesMap[row.trxId].push(row);
980
+ // }
981
+
982
+ // // Attach images to their transactions
983
+ // const withAttachments = transactions.map(t => ({
984
+ // ...t,
985
+ // attachments: imagesMap[t.id] || []
986
+ // }));
987
+
988
+ // resolve(withAttachments);
989
+ // },
990
+ // (txObj2, err2) => reject(err2)
991
+ // );
992
+ // },
993
+ // (txObj, error) => {
994
+ // console.log("Error getting transactions:", error);
995
+ // reject(error);
996
+ // }
997
+ // );
998
+ // });
999
+ // });
1000
+ // };
1001
+
1002
+ // export const getTransactionsByClientType = (type, startDate, endDate) => {
1003
+ // return new Promise((resolve, reject) => {
1004
+ // db.transaction((tx) => {
1005
+ // let sql = `
1006
+ // SELECT
1007
+ // t.*,
1008
+ // c.type AS client_type,
1009
+ // c.name AS client_name
1010
+ // FROM Transactions t
1011
+ // INNER JOIN Clients c ON t.customer_id = c.id
1012
+ // WHERE c.type = ?
1013
+ // `;
1014
+ // const params = [type];
1015
+
1016
+ // if (startDate && endDate) {
1017
+ // sql += ` AND date(t.date) BETWEEN date(?) AND date(?)`;
1018
+ // params.push(startDate, endDate);
1019
+ // }
1020
+
1021
+ // sql += ` ORDER BY t.date DESC;`;
1022
+
1023
+ // tx.executeSql(
1024
+ // sql,
1025
+ // params,
1026
+ // async (txObj, resultSet) => {
1027
+ // const transactions = [];
1028
+ // for (let i = 0; i < resultSet.rows.length; i++) {
1029
+ // transactions.push(resultSet.rows.item(i));
1030
+ // }
1031
+
1032
+ // // Fetch all images for these transactions
1033
+ // const ids = transactions.map(t => t.id);
1034
+ // if (ids.length === 0) return resolve([]);
1035
+
1036
+ // const placeholders = ids.map(() => '?').join(',');
1037
+ // tx.executeSql(
1038
+ // `SELECT * FROM TransactionImages WHERE trxId IN (${placeholders})`,
1039
+ // ids,
1040
+ // (txObj2, imgResult) => {
1041
+ // const imagesMap = {};
1042
+ // for (let j = 0; j < imgResult.rows.length; j++) {
1043
+ // const row = imgResult.rows.item(j);
1044
+ // if (!imagesMap[row.trxId]) imagesMap[row.trxId] = [];
1045
+ // imagesMap[row.trxId].push(row);
1046
+ // }
1047
+
1048
+ // // Attach images to their transactions
1049
+ // const withAttachments = transactions.map(t => ({
1050
+ // ...t,
1051
+ // attachments: imagesMap[t.id] || []
1052
+ // }));
1053
+
1054
+ // resolve(withAttachments);
1055
+ // },
1056
+ // (txObj2, err2) => reject(err2)
1057
+ // );
1058
+ // },
1059
+ // (txObj, error) => {
1060
+ // console.log("Error getting transactions:", error);
1061
+ // reject(error);
1062
+ // }
1063
+ // );
1064
+ // });
1065
+ // });
1066
+ // };
1067
+
1068
+ export const changeTransactionType = transactionId => {
1069
+ return new Promise((resolve, reject) => {
1070
+ db.transaction(tx => {
1071
+ tx.executeSql(`
1072
+ UPDATE Transactions
1073
+ SET
1074
+ amount = subamount,
1075
+ subamount = amount
1076
+ WHERE id = ?;
1077
+ `, [transactionId], (txObj, resultSet) => {
1078
+ console.log("Rows affected (swap amount & subamount):", resultSet.rowsAffected);
1079
+ resolve(resultSet);
1080
+ }, (txObj, error) => {
1081
+ console.log("Error swapping amount & subamount:", error);
1082
+ reject(error);
1083
+ });
1084
+ });
1085
+ });
1086
+ };
1087
+ export const softDeleteTransaction = transactionId => {
1088
+ return new Promise((resolve, reject) => {
1089
+ db.transaction(tx => {
1090
+ tx.executeSql(`
1091
+ UPDATE Transactions
1092
+ SET isDeleted = 1
1093
+ WHERE id = ?;
1094
+ `, [transactionId], (txObj, resultSet) => {
1095
+ console.log("Rows affected (soft delete):", resultSet.rowsAffected);
1096
+ resolve(resultSet);
1097
+ }, (txObj, error) => {
1098
+ console.log("Error soft deleting transaction:", error);
1099
+ reject(error);
1100
+ });
1101
+ });
1102
+ });
1103
+ };
1104
+ export const changeClientType = (clientId, newType = 1) => {
1105
+ return new Promise((resolve, reject) => {
1106
+ db.transaction(tx => {
1107
+ tx.executeSql(`
1108
+ UPDATE Clients
1109
+ SET type = ?
1110
+ WHERE id = ?;
1111
+ `, [newType, clientId], (txObj, resultSet) => {
1112
+ console.log(`Client type changed to ${newType} for id ${clientId}`);
1113
+ resolve(resultSet);
1114
+ }, (txObj, error) => {
1115
+ console.log("Error changing client type:", error);
1116
+ reject(error);
1117
+ });
1118
+ });
1119
+ });
1120
+ };
1121
+ export const updateClientCreditLimit = (clientId, newCreditLimit) => {
1122
+ return new Promise((resolve, reject) => {
1123
+ db.transaction(tx => {
1124
+ tx.executeSql(`UPDATE Clients SET credit_limit = ? WHERE id = ?;`, [newCreditLimit, clientId], (txObj, resultSet) => {
1125
+ if (resultSet.rowsAffected > 0) {
1126
+ resolve(true); // Successfully updated
1127
+ } else {
1128
+ resolve(false); // No rows updated (maybe wrong clientId)
1129
+ }
1130
+ }, (txObj, error) => {
1131
+ console.error('Error updating credit_limit', error);
1132
+ reject(error);
1133
+ });
1134
+ });
1135
+ });
1136
+ };
1137
+ export const changeTransactionClient = (transactionId, newCustomerId) => {
1138
+ return new Promise((resolve, reject) => {
1139
+ db.transaction(tx => {
1140
+ tx.executeSql(`
1141
+ UPDATE Transactions
1142
+ SET customer_id = ?
1143
+ WHERE id = ?;
1144
+ `, [newCustomerId, transactionId], (txObj, resultSet) => {
1145
+ console.log(`Transaction ${transactionId} now assigned to customer_id ${newCustomerId}`);
1146
+ resolve(resultSet);
1147
+ }, (txObj, error) => {
1148
+ console.log("Error changing transaction customer_id:", error);
1149
+ reject(error);
1150
+ });
1151
+ });
1152
+ });
1153
+ };
1154
+ export const softDeleteClient = clientId => {
1155
+ return new Promise((resolve, reject) => {
1156
+ db.transaction(tx => {
1157
+ tx.executeSql(`
1158
+ UPDATE Clients
1159
+ SET isDeleted = 1
1160
+ WHERE id = ?;
1161
+ `, [clientId], (txObj, resultSet) => {
1162
+ console.log("Rows affected (soft delete):", resultSet.rowsAffected);
1163
+ resolve(resultSet);
1164
+ }, (txObj, error) => {
1165
+ console.log("Error soft deleting transaction:", error);
1166
+ reject(error);
1167
+ });
1168
+ });
1169
+ });
1170
+ };
1171
+ export const updateClientInstallmentDetails = (clientId, paymentDetails) => {
1172
+ return new Promise((resolve, reject) => {
1173
+ const jsonString = JSON.stringify(paymentDetails); // Convert JSON to string
1174
+
1175
+ db.transaction(tx => {
1176
+ tx.executeSql(`
1177
+ UPDATE Clients
1178
+ SET payment_mode = ?
1179
+ WHERE id = ?;
1180
+ `, [jsonString, clientId], (txObj, resultSet) => {
1181
+ console.log("Rows affected (update payment_details):", resultSet.rowsAffected);
1182
+ resolve(resultSet);
1183
+ }, (txObj, error) => {
1184
+ console.log("Error updating payment_details:", error);
1185
+ reject(error);
1186
+ });
1187
+ });
1188
+ });
1189
+ };
1190
+ export const updateBankProfile = (clientId, phone, notification) => {
1191
+ return new Promise((resolve, reject) => {
1192
+ db.transaction(tx => {
1193
+ tx.executeSql(`
1194
+ UPDATE Clients
1195
+ SET phone = ?, notification = ?
1196
+ WHERE id = ?;
1197
+ `, [phone, notification, clientId], (txObj, resultSet) => {
1198
+ console.log("Rows affected (update):", resultSet.rowsAffected);
1199
+ resolve(resultSet);
1200
+ }, (txObj, error) => {
1201
+ console.log("Error updating client:", error);
1202
+ reject(error);
1203
+ });
1204
+ });
1205
+ });
1206
+ };
1207
+ export const getActiveInstallments = () => {
1208
+ return new Promise((resolve, reject) => {
1209
+ db.transaction(tx => {
1210
+ tx.executeSql(`SELECT id, payment_mode FROM Clients WHERE (isDeleted IS NULL OR isDeleted = 0)`, [], (txObj, resultSet) => {
1211
+ let results = [];
1212
+ for (let i = 0; i < resultSet.rows.length; i++) {
1213
+ if (resultSet.rows.item(i).payment_mode) {
1214
+ let parsedInstallment = JSON.parse(resultSet.rows.item(i).payment_mode);
1215
+ let clientId = resultSet.rows.item(i).id;
1216
+ if (parsedInstallment?.active == "1") {
1217
+ results.push({
1218
+ clientId,
1219
+ ...parsedInstallment,
1220
+ start_date: parsedInstallment?.start_date,
1221
+ last_entry_date: parsedInstallment?.last_entry_date
1222
+ // start_date: parsedInstallment?.start_date && new Date(parsedInstallment.start_date),
1223
+ // last_entry_date: parsedInstallment?.last_entry_date && new Date(parsedInstallment.last_entry_date),
1224
+ });
1225
+ }
1226
+ }
1227
+ }
1228
+ resolve(results);
1229
+ }, (txObj, error) => {
1230
+ reject(error);
1231
+ });
1232
+ });
1233
+ });
1234
+ };
1235
+ export const ensureTransactionsTableColumns = () => {
1236
+ db.transaction(tx => {
1237
+ // ✅ 1. Check and add 'cash_type' in Transactions table
1238
+ tx.executeSql(`PRAGMA table_info(Transactions);`, [], (txObj, resultSet) => {
1239
+ const cols = [];
1240
+ for (let i = 0; i < resultSet.rows.length; i++) {
1241
+ cols.push(resultSet.rows.item(i).name);
1242
+ }
1243
+ if (!cols.includes('cash_type')) {
1244
+ tx.executeSql(`ALTER TABLE Transactions ADD COLUMN cash_type VARCHAR;`, [], () => console.log('✅ Added cash_type column to Transactions table'), (txObj, error) => console.error('⚠️ Failed to add cash_type column:', error));
1245
+ }
1246
+ }, (txObj, error) => console.error('⚠️ PRAGMA error (Transactions):', error));
1247
+
1248
+ // ✅ 2. Check and add 'fromExpense' in CashRegister table
1249
+ tx.executeSql(`PRAGMA table_info(CashRegister);`, [], (txObj, resultSet) => {
1250
+ const cols = [];
1251
+ for (let i = 0; i < resultSet.rows.length; i++) {
1252
+ cols.push(resultSet.rows.item(i).name);
1253
+ }
1254
+ if (!cols.includes('fromExpense')) {
1255
+ tx.executeSql(`ALTER TABLE CashRegister ADD COLUMN fromExpense TEXT;`, [], () => console.log('✅ Added fromExpense column to CashRegister table'), (txObj, error) => console.error('⚠️ Failed to add fromExpense column:', error));
1256
+ }
1257
+ }, (txObj, error) => console.error('⚠️ PRAGMA error (CashRegister):', error));
1258
+
1259
+ // ✅ 3. Check and add 'isCash' in ExpenseTransaction table
1260
+ tx.executeSql(`PRAGMA table_info(ExpenseTransaction);`, [], (txObj, resultSet) => {
1261
+ const cols = [];
1262
+ for (let i = 0; i < resultSet.rows.length; i++) {
1263
+ cols.push(resultSet.rows.item(i).name);
1264
+ }
1265
+ if (!cols.includes('isCash')) {
1266
+ tx.executeSql(`ALTER TABLE ExpenseTransaction ADD COLUMN isCash TEXT;`, [], () => console.log('✅ Added isCash column to ExpenseTransaction table'), (txObj, error) => console.error('⚠️ Failed to add isCash column:', error));
1267
+ }
1268
+ }, (txObj, error) => console.error('⚠️ PRAGMA error (ExpenseTransaction):', error));
1269
+ });
1270
+ };
1271
+ export const updateClientPaymentMode = (clientId, payment_mode) => {
1272
+ return new Promise((resolve, reject) => {
1273
+ db.transaction(tx => {
1274
+ tx.executeSql(`UPDATE Clients
1275
+ SET payment_mode = ?
1276
+ WHERE id = ?`, [payment_mode, clientId], (txObj, resultSet) => resolve(resultSet), (txObj, error) => reject(error));
1277
+ });
1278
+ });
1279
+ };
1280
+ export const hardDeleteClientsNotOfUser = async userId => {
1281
+ return new Promise((resolve, reject) => {
1282
+ db.transaction(tx => {
1283
+ tx.executeSql(`DELETE FROM Clients WHERE business_id NOT IN (
1284
+ SELECT id FROM Business WHERE user_id = ?
1285
+ )`, [userId], (txObj, resultSet) => {
1286
+ console.log('Hard deleted clients not of user:', resultSet);
1287
+ resolve(resultSet);
1288
+ }, (txObj, error) => {
1289
+ console.log('SQL Error (hard delete clients):', error);
1290
+ reject(error);
1291
+ });
1292
+ });
1293
+ });
1294
+ };
149
1295
  //# sourceMappingURL=clients.js.map