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
@@ -0,0 +1,2504 @@
1
+ import {
2
+ View,
3
+ Text,
4
+ StyleSheet,
5
+ TouchableOpacity,
6
+ FlatList,
7
+ Image,
8
+ SafeAreaView,
9
+ Dimensions,
10
+ PermissionsAndroid,
11
+ Platform,
12
+ ScrollView,
13
+ TextInput,
14
+ Alert,
15
+ ActivityIndicator,
16
+ Keyboard,
17
+ } from 'react-native';
18
+ import React, { useState, useEffect, useRef, useCallback } from 'react';
19
+ import LinearGradient from 'react-native-linear-gradient';
20
+ import Ionicons from 'react-native-vector-icons/Ionicons';
21
+ import {
22
+ addCommas,
23
+ COLORS,
24
+ FONT_BOLD,
25
+ FONT_MEDIUM,
26
+ FONT_NORMAL,
27
+ formatDateTime,
28
+ formatPhoneNumber,
29
+ formatShortDate,
30
+ fromJsDateToSql,
31
+ getAvatar,
32
+ HP,
33
+ ICON_SIZES,
34
+ Input_Field_SIZES,
35
+ isPdfFile,
36
+ mergeDateTime,
37
+ TEXT_SIZES,
38
+ WP,
39
+ } from '../themes/config';
40
+ import LottieView from 'lottie-react-native';
41
+ import { useSelector, useDispatch } from 'react-redux';
42
+ import {
43
+ addClient,
44
+ addTransaction,
45
+ addTransactionImages,
46
+ changeClientType,
47
+ getClientDetails,
48
+ getClientsByType,
49
+ getClientTransactions,
50
+ insertPhoneNum,
51
+ setClientAddress,
52
+ setClientCnic,
53
+ setClientName,
54
+ setClientPhone,
55
+ setPayDate,
56
+ setProfilePic,
57
+ softDeleteClient,
58
+ softDeleteTransaction,
59
+ switchClientToSupplier,
60
+ updateBankProfile,
61
+ updateClientCreditLimit,
62
+ updateClientInstallmentDetails,
63
+ } from '../database/clients';
64
+ import {
65
+ BottomView,
66
+ CountryPhoneInput,
67
+ FloatingInput,
68
+ Header,
69
+ PickerModal,
70
+ SearchBar,
71
+ Transaction,
72
+ User,
73
+ } from '../components';
74
+ import Modal from 'react-native-modal';
75
+ import {
76
+ CLIENT_DETAILS,
77
+ STATUS_BAR_COLOR,
78
+ } from '../redux/reducers/client/client_types';
79
+ import DateTimePicker, {
80
+ DateTimePickerAndroid,
81
+ } from '@react-native-community/datetimepicker';
82
+ import PartyModal from '../components/PartyModal';
83
+ import Sound, {
84
+ AudioEncoderAndroidType,
85
+ AudioSourceAndroidType,
86
+ AVEncoderAudioQualityIOSType,
87
+ AVEncodingOption,
88
+ RecordBackType,
89
+ PlayBackType,
90
+ createSound,
91
+ } from 'react-native-nitro-sound';
92
+ import { launchCamera, launchImageLibrary } from 'react-native-image-picker';
93
+ import { pick } from '@react-native-documents/picker';
94
+ import { addCashEntry, addCashImages } from '../database/cash';
95
+ import Contacts from 'react-native-contacts';
96
+ import {
97
+ addInvoiceImages,
98
+ createBill,
99
+ deleteInvoiceImagesByInvoiceId,
100
+ getInvoiceEntries,
101
+ updateBill,
102
+ } from '../database/bill';
103
+ import { addItemDetails, updateItemQty } from '../database/stock';
104
+
105
+ export default function Profile({ navigation, route }) {
106
+ const dispatch = useDispatch();
107
+ const animationRef = useRef(null);
108
+
109
+ const selectBusiness = useSelector((state) => state.client.selected_business);
110
+ const invoiceId = route?.params?.invoiceId || null;
111
+ const clients = useSelector((state) => state.client.home_customers);
112
+ const suppliers = useSelector((state) => state.client.home_suppliers);
113
+
114
+ const [date, setDate] = useState(new Date());
115
+ const [IsPicker, setIsPicker] = useState(false);
116
+ const [Amount, setAmount] = useState('');
117
+ const [Discount, setDiscount] = useState('');
118
+ const [Tax, setTax] = useState('');
119
+ const [IsSoundModal, setIsSoundModal] = useState(false);
120
+ const [RecordingTime, setRecordingTime] = useState('');
121
+ const [IsPlaying, setIsPlaying] = useState(false);
122
+ const [AudioFile, setAudioFile] = useState('');
123
+ const [PlayLoading, setPlayLoading] = useState(false);
124
+ const [Details, setDetails] = useState('');
125
+ const [attachments, setAttachments] = useState([]);
126
+ const [isModalVisible, setIsModalVisible] = useState(false);
127
+ const [PaymentMode, setPaymentMode] = useState(null);
128
+ const [BalanceDue, setBalanceDue] = useState(0);
129
+ const [ReceivedAmount, setReceivedAmount] = useState(0);
130
+ const [CalculatedAmount, setCalculatedAmount] = useState('');
131
+ const [BillId, setBillId] = useState(0);
132
+ const [SuccessModal, setSuccessModal] = useState(false);
133
+ const [ChangeModal, setChangeModal] = useState(false);
134
+ const [SelectedParty, setSelectedParty] = useState(null);
135
+ const [Clients, setClients] = useState([]);
136
+ const [ShowNewBtn, setShowNewBtn] = useState(false);
137
+ const [contacts, setContacts] = useState([]);
138
+ const [Name, setName] = useState('');
139
+ const [clientPhoneSet, setClientPhoneSet] = useState(new Set());
140
+ const [clientPhoneMap, setClientPhoneMap] = useState(new Map());
141
+ const [searchText, setSearchText] = useState('');
142
+ const [PhoneNum, setPhoneNum] = useState('');
143
+ const [keyboardPadding, setKeyboardPadding] = useState(0);
144
+ const [SelectedItems, setSelectedItems] = useState([]);
145
+ const [totalAmount, setTotalAmount] = useState(0);
146
+
147
+ // Demo customer list
148
+ const [customerList, setCustomerList] = useState([
149
+ {
150
+ id: '1',
151
+ name: 'Ali Traders',
152
+ time: 'Today, 2:30 PM',
153
+ amount: '₨ 12,000',
154
+ },
155
+ {
156
+ id: '2',
157
+ name: 'Babar Store',
158
+ time: 'Yesterday, 6:00 PM',
159
+ amount: '₨ 8,450',
160
+ },
161
+ { id: '3', name: 'Saleem Sons', time: '2 days ago', amount: '₨ 3,200' },
162
+ ]);
163
+
164
+ const onChangeDate = (event, selectedDate) => {
165
+ const currentDate = selectedDate;
166
+ setDate(currentDate);
167
+ };
168
+
169
+ const showDate = () => {
170
+ DateTimePickerAndroid.open({
171
+ value: date || new Date(),
172
+ onChange: onChangeDate,
173
+ mode: 'date',
174
+ is24Hour: false,
175
+ });
176
+ };
177
+
178
+ const togglePicker = () => {
179
+ setIsPicker(!IsPicker);
180
+ };
181
+
182
+ useEffect(() => {
183
+ dispatch({
184
+ type: STATUS_BAR_COLOR,
185
+ color: COLORS.redColor,
186
+ });
187
+ }, []);
188
+
189
+ const askAudioPermission = async () => {
190
+ if (Platform.OS === 'android') {
191
+ try {
192
+ const granted = await PermissionsAndroid.request(
193
+ PermissionsAndroid.PERMISSIONS.RECORD_AUDIO,
194
+ {
195
+ title: 'Audio Recording Permission',
196
+ message:
197
+ 'DigiKhata needs access to your microphone to record audio.',
198
+ buttonNeutral: 'Ask Me Later',
199
+ buttonNegative: 'Cancel',
200
+ buttonPositive: 'OK',
201
+ }
202
+ );
203
+
204
+ if (granted === PermissionsAndroid.RESULTS.GRANTED) {
205
+ console.log('Recording permission granted');
206
+ onStartRecord();
207
+ } else {
208
+ console.log('Recording permission denied');
209
+ return;
210
+ }
211
+ } catch (err) {
212
+ console.warn(err);
213
+ return;
214
+ }
215
+ } else {
216
+ onStartRecord();
217
+ }
218
+ };
219
+
220
+ const onStartRecord = async () => {
221
+ setIsSoundModal(true);
222
+ Sound.addRecordBackListener((e) => {
223
+ console.log('Recording progress:', e.currentPosition, e.currentMetering);
224
+ console.log(e.currentPosition);
225
+ console.log(Sound.mmssss(Math.floor(e.currentPosition)));
226
+ setRecordingTime(Sound.mmssss(Math.floor(e.currentPosition)));
227
+ });
228
+
229
+ const result = await Sound.startRecorder();
230
+ console.log('Recording started:', result);
231
+ };
232
+
233
+ const onStopRecord = async (flag) => {
234
+ try {
235
+ const result = await Sound.stopRecorder();
236
+ Sound.removeRecordBackListener();
237
+ console.log('Recording stopped:', result);
238
+
239
+ setAudioFile(flag ? '' : result);
240
+
241
+ setTimeout(() => {
242
+ setIsSoundModal(false);
243
+ }, 350);
244
+ } catch (err) {
245
+ console.error('Error stopping recorder:', err);
246
+ }
247
+ };
248
+
249
+ const onStartPlay = async (fileUrl) => {
250
+ setPlayLoading(true);
251
+ // Set up playback progress listener
252
+ Sound.addPlayBackListener((e) => {
253
+ console.log('Playback progress:', e.currentPosition, e.duration);
254
+ setIsPlaying(true);
255
+ animationRef.current?.play();
256
+ // setCurrentPosition(e.currentPosition);
257
+ // setTotalDuration(e.duration);
258
+ // setPlayTime(Sound.mmssss(Math.floor(e.currentPosition)));
259
+ // setDuration(Sound.mmssss(Math.floor(e.duration)));
260
+ });
261
+
262
+ // Set up playback end listener
263
+ Sound.addPlaybackEndListener((e) => {
264
+ console.log('Playback completed:', e);
265
+ // Handle playback completion
266
+ setIsPlaying(false);
267
+ animationRef.current?.pause();
268
+ // setCurrentPosition(0);
269
+ });
270
+
271
+ const result = await Sound.startPlayer(fileUrl);
272
+ setPlayLoading(false);
273
+ console.log('Playback started:', result);
274
+ };
275
+
276
+ const onPauseRecord = async () => {
277
+ Sound.stopPlayer();
278
+ Sound.removePlayBackListener();
279
+ Sound.removePlaybackEndListener();
280
+ };
281
+
282
+ const handleDeleteAudio = () => {
283
+ Alert.alert(
284
+ 'Delete Recording',
285
+ 'Do you want to delete?',
286
+ [
287
+ {
288
+ text: 'No',
289
+ style: 'cancel',
290
+ },
291
+ {
292
+ text: 'Yes',
293
+ onPress: async () => {
294
+ try {
295
+ await onPauseRecord();
296
+ setAudioFile('');
297
+ setIsPlaying(false);
298
+ } catch (err) {
299
+ console.error('Error stopping audio before clearing:', err);
300
+ }
301
+ },
302
+ style: 'destructive',
303
+ },
304
+ ],
305
+ { cancelable: true }
306
+ );
307
+ };
308
+
309
+ const addAttachment = (file) => {
310
+ if (attachments.length >= 3) {
311
+ alert('You can only attach up to 3 files.');
312
+ return;
313
+ }
314
+ setAttachments([...attachments, file]);
315
+ };
316
+
317
+ const handleGallery = async () => {
318
+ try {
319
+ const result = await launchImageLibrary({ mediaType: 'photo' });
320
+ if (result.assets && result.assets.length > 0) {
321
+ addAttachment({
322
+ type: 'image',
323
+ uri: result.assets[0].uri,
324
+ name: result.assets[0].fileName || 'gallery_image.jpg',
325
+ });
326
+ }
327
+ } catch (err) {
328
+ console.log('Gallery Error:', err);
329
+ }
330
+ setIsModalVisible(false);
331
+ };
332
+
333
+ const handleCamera = async () => {
334
+ try {
335
+ const granted = await PermissionsAndroid.request(
336
+ PermissionsAndroid.PERMISSIONS.CAMERA,
337
+ {
338
+ title: 'Camera Permission',
339
+ message: 'This app needs camera access to take photos',
340
+ buttonNeutral: 'Ask Me Later',
341
+ buttonNegative: 'Cancel',
342
+ buttonPositive: 'OK',
343
+ }
344
+ );
345
+
346
+ if (granted === PermissionsAndroid.RESULTS.GRANTED) {
347
+ const result = await launchCamera({ mediaType: 'photo' });
348
+ if (result.assets && result.assets.length > 0) {
349
+ addAttachment({
350
+ type: 'image',
351
+ uri: result.assets[0].uri,
352
+ name: result.assets[0].fileName || 'camera_image.jpg',
353
+ });
354
+ }
355
+ } else {
356
+ alert('Camera permission denied');
357
+ }
358
+ } catch (err) {
359
+ console.log('Camera Error:', err);
360
+ }
361
+ setIsModalVisible(false);
362
+ };
363
+
364
+ const handlePDF = async () => {
365
+ try {
366
+ const res = await pick({ type: ['application/pdf'] });
367
+ if (res && res.length > 0) {
368
+ addAttachment({
369
+ type: 'pdf',
370
+ uri: res[0].uri,
371
+ name: res[0].name || 'document.pdf',
372
+ });
373
+ }
374
+ } catch (err) {
375
+ if (err.message !== 'DOCUMENT_PICKER_CANCELED') {
376
+ console.log('PDF Error:', err);
377
+ }
378
+ }
379
+ setIsModalVisible(false);
380
+ };
381
+
382
+ const removeAttachment = (index) => {
383
+ setAttachments(attachments.filter((_, i) => i !== index));
384
+ };
385
+
386
+ useEffect(() => {
387
+ const amount = parseFloat(Amount) || 0;
388
+ const discount = parseFloat(Discount) || 0;
389
+ const tax = parseFloat(Tax) || 0;
390
+
391
+ // Calculate discount as a percentage
392
+ const discountedAmount = (amount * discount) / 100;
393
+
394
+ // Tax is a fixed value
395
+ const finalAmount = amount - discountedAmount + tax;
396
+
397
+ setCalculatedAmount(finalAmount.toFixed(2));
398
+ }, [Amount, Discount, Tax]);
399
+
400
+ const onCreateBill = async () => {
401
+ try {
402
+ const finalValue = Number(CalculatedAmount);
403
+
404
+ // ✅ Validate value (ignore CalculatorErr)
405
+ if (
406
+ !finalValue || // empty, null, undefined, 0
407
+ !isFinite(finalValue) || // NaN, Infinity
408
+ finalValue <= 0 || // must be positive
409
+ finalValue > 999999999 // too large
410
+ ) {
411
+ console.log('❌ Invalid or non-positive result, not saving');
412
+ return;
413
+ }
414
+
415
+ const invoices =
416
+ (await getInvoiceEntries(null, null, selectBusiness?.id)) || [];
417
+ const test_id = invoices.length + 1;
418
+
419
+ // ✅ Prepare debit/credit
420
+ const bill = Number(BillId || test_id);
421
+ const bId = Number(selectBusiness?.id);
422
+ const entryDate = fromJsDateToSql(date);
423
+ const amount = Number(Amount);
424
+ const subamount = Number(CalculatedAmount);
425
+ const note = Details;
426
+ const local_path = AudioFile;
427
+ const tax = Number(Tax);
428
+ const discount = Number(Discount);
429
+ const payment_mode = Number(PaymentMode);
430
+ const advance = Number(ReceivedAmount);
431
+ const customerId = SelectedParty ? Number(SelectedParty?.id) : null;
432
+
433
+ console.log({
434
+ bill,
435
+ bId,
436
+ entryDate,
437
+ amount,
438
+ subamount,
439
+ note,
440
+ local_path,
441
+ tax,
442
+ discount,
443
+ payment_mode,
444
+ advance,
445
+ });
446
+
447
+ // ✅ Save main transaction
448
+ const res = await createBill(
449
+ bill,
450
+ bId,
451
+ entryDate,
452
+ amount,
453
+ subamount,
454
+ note,
455
+ local_path,
456
+ tax,
457
+ discount,
458
+ payment_mode,
459
+ advance,
460
+ customerId,
461
+ SelectedItems?.length > 0 ? JSON.stringify(SelectedItems) : ''
462
+ );
463
+
464
+ console.log(res, '✅ Bill Add Success');
465
+ const invoiceId = res.insertId;
466
+
467
+ // ✅ Save attachments (if any)
468
+ if (attachments && attachments.length > 0) {
469
+ for (const file of attachments) {
470
+ try {
471
+ await addInvoiceImages(invoiceId, file.uri);
472
+ console.log(`📎 Bill Attachment added: ${file.name}`);
473
+ } catch (err) {
474
+ console.log('⚠️ Bill Attachment insert error:', err);
475
+ }
476
+ }
477
+ }
478
+
479
+ const trxId = res.insertId;
480
+
481
+ SelectedParty && (await addPartyTransaction(CalculatedAmount, trxId));
482
+
483
+ if (SelectedItems) {
484
+ const parsedItems = SelectedItems;
485
+
486
+ await Promise.all(
487
+ parsedItems.map(async (i) => {
488
+ await addStockEntry(
489
+ i?.id, // itemId
490
+ i?.addedQty, // stockOUT
491
+ Number(i?.addedQty) * Number(i?.addedRate), // amount
492
+ Number(i?.addedRate), // rateSale
493
+ trxId, // billNo
494
+ i?.qty, // oldQuantity
495
+ i?.addedQty, // addedQuantity
496
+ Details, // Details
497
+ AudioFile, // AudioFile
498
+ fromJsDateToSql(date), // date
499
+ selectBusiness // selectBusiness
500
+ );
501
+ })
502
+ );
503
+ }
504
+
505
+ // ✅ Add party transaction (if any)
506
+ // if (SelectedParty) {
507
+ // await addPartyTransaction(finalValue, trxId);
508
+ // }
509
+
510
+ // ✅ Reset UI state
511
+ setAmount('');
512
+ setDiscount('');
513
+ setTax('');
514
+ setDetails('');
515
+ setAudioFile('');
516
+ setAttachments([]);
517
+ setPaymentMode(null);
518
+ setBalanceDue(0);
519
+ setReceivedAmount(0);
520
+ setCalculatedAmount('');
521
+ setBillId(0);
522
+ setDate(new Date());
523
+
524
+ // ✅ Show success modal and navigate back
525
+ setSuccessModal(true);
526
+ setTimeout(() => {
527
+ setSuccessModal(false);
528
+ navigation.replace('PreviewBill', { invoiceId: trxId });
529
+ }, 2000);
530
+ } catch (err) {
531
+ console.log('💥 Bill Creation Error:', err);
532
+ }
533
+ };
534
+
535
+ const calculateFinalAmount = (amount, discount, tax) => {
536
+ const amt = parseFloat(amount) || 0;
537
+ const disc = parseFloat(discount) || 0;
538
+ const tx = parseFloat(tax) || 0;
539
+
540
+ // Apply discount (percentage) and tax (fixed amount)
541
+ const discountedAmount = (amt * disc) / 100;
542
+
543
+ const finalAmount = amt - discountedAmount + tx;
544
+
545
+ // Return as a number (rounded to 2 decimals)
546
+ return parseFloat(finalAmount.toFixed(2));
547
+ };
548
+
549
+ useEffect(() => {
550
+ const unsubscribe = navigation.addListener('focus', () => {
551
+ getInvoiceEntries(null, null, selectBusiness?.id).then((res) => {
552
+ let length = res.length;
553
+ if (!invoiceId) {
554
+ setBillId(String(length + 1));
555
+ }
556
+ });
557
+ });
558
+
559
+ return () => unsubscribe();
560
+ }, [navigation]);
561
+
562
+ useEffect(() => {
563
+ if (!invoiceId) return;
564
+
565
+ const fetchData = async () => {
566
+ const res = await getInvoiceEntries(null, null, selectBusiness?.id);
567
+ let filtered = res?.find((i) => i.id == invoiceId);
568
+
569
+ const arr =
570
+ filtered?.attachments?.map((i, index) => ({
571
+ name: `pdf-test-${index + 1}.pdf`,
572
+ type: isPdfFile(i?.local_path) ? 'pdf' : 'image',
573
+ uri: i?.local_path,
574
+ attachment_id: i?.invoiceId,
575
+ })) || [];
576
+
577
+ if (filtered?.cId) {
578
+ let details = await getClientDetails(filtered?.cId);
579
+ setSelectedParty(details);
580
+ }
581
+
582
+ setBillId(String(filtered?.bill));
583
+ setDate(new Date(filtered?.entryDate));
584
+ setAmount(filtered?.amount?.toString());
585
+ setTotalAmount(Number(filtered?.amount));
586
+ setDiscount(filtered?.discount?.toString());
587
+ setTax(filtered?.tax?.toString());
588
+ setAudioFile(filtered?.local_path);
589
+ setDetails(filtered?.details);
590
+ setAttachments(arr);
591
+ setPaymentMode(Number(filtered?.payment_mode));
592
+ setCalculatedAmount(filtered?.subamount?.toString());
593
+ setReceivedAmount(filtered?.advance?.toString());
594
+ setBalanceDue(
595
+ (Number(filtered?.subamount) - Number(filtered?.advance)).toFixed(2)
596
+ );
597
+ setSelectedItems(filtered?.status ? JSON.parse(filtered?.status) : []);
598
+ };
599
+
600
+ fetchData();
601
+ }, [invoiceId]);
602
+
603
+ const onUpdateBill = async () => {
604
+ try {
605
+ const finalValue = Number(CalculatedAmount);
606
+
607
+ // ✅ Validate value
608
+ if (
609
+ !finalValue ||
610
+ !isFinite(finalValue) ||
611
+ finalValue <= 0 ||
612
+ finalValue > 999999999
613
+ ) {
614
+ console.log('❌ Invalid or non-positive result, not updating');
615
+ return;
616
+ }
617
+
618
+ const invoices =
619
+ (await getInvoiceEntries(null, null, selectBusiness?.id)) || [];
620
+ const test_id = invoices.length + 1;
621
+
622
+ const bill = Number(BillId || test_id);
623
+ const bId = Number(selectBusiness?.id);
624
+ const entryDate = fromJsDateToSql(date);
625
+ const amount = Number(Amount);
626
+ const subamount = Number(CalculatedAmount);
627
+ const note = Details;
628
+ const local_path = AudioFile;
629
+ const tax = Number(Tax);
630
+ const discount = Number(Discount);
631
+ const payment_mode = Number(PaymentMode);
632
+ const advance = Number(ReceivedAmount);
633
+ const customerId = SelectedParty ? Number(SelectedParty?.id) : null;
634
+
635
+ console.log({
636
+ bill,
637
+ bId,
638
+ entryDate,
639
+ amount,
640
+ subamount,
641
+ note,
642
+ local_path,
643
+ tax,
644
+ discount,
645
+ payment_mode,
646
+ advance,
647
+ });
648
+
649
+ if (!SelectedParty) {
650
+ const response = await getInvoiceEntries('', '', selectBusiness?.id);
651
+ let filteredInvoice = response?.find((i) => i.id == invoiceId);
652
+
653
+ let allClientTransactions = await getClientTransactions(
654
+ filteredInvoice?.cId
655
+ );
656
+ let linkedTransaction = allClientTransactions?.find((t) => {
657
+ let splitted = t?.cash_type?.split('_')[1];
658
+ const billId = Number(splitted.replace(/\D/g, ''));
659
+
660
+ return Number(billId) === Number(invoiceId);
661
+ });
662
+
663
+ console.log(linkedTransaction, 'linkedTransaction');
664
+ // return
665
+ if (linkedTransaction) {
666
+ await softDeleteTransaction(linkedTransaction?.id);
667
+ console.log('Transaction Deleted');
668
+ }
669
+ }
670
+
671
+ // ✅ Update the main bill
672
+ const res = await updateBill(
673
+ String(invoiceId),
674
+ bill, // existing bill id
675
+ bId,
676
+ customerId,
677
+ entryDate,
678
+ amount,
679
+ subamount,
680
+ note,
681
+ local_path,
682
+ tax,
683
+ discount,
684
+ payment_mode,
685
+ advance,
686
+ SelectedItems?.length > 0 ? JSON.stringify(SelectedItems) : ''
687
+ );
688
+
689
+ console.log(res, '✅ Bill Update Success'); // same id (since we’re updating)
690
+
691
+ // ✅ Handle attachments
692
+ try {
693
+ // First delete old attachments
694
+ await deleteInvoiceImagesByInvoiceId(invoiceId);
695
+ console.log(`🗑️ Deleted old attachments for invoiceId: ${invoiceId}`);
696
+
697
+ // Then re-add new attachments (if any)
698
+ if (attachments?.length > 0) {
699
+ for (const file of attachments) {
700
+ if (file?.uri) {
701
+ try {
702
+ await addInvoiceImages(invoiceId, file.uri);
703
+ console.log(`📎 Added attachment: ${file.name || file.uri}`);
704
+ } catch (err) {
705
+ console.log('⚠️ Attachment insert error:', err);
706
+ }
707
+ }
708
+ }
709
+ } else {
710
+ console.log('ℹ️ No new attachments added');
711
+ }
712
+ } catch (err) {
713
+ console.log('💥 Attachment update error:', err);
714
+ }
715
+
716
+ // ✅ Reset UI and show success
717
+ setAmount('');
718
+ setDiscount('');
719
+ setTax('');
720
+ setDetails('');
721
+ setAudioFile('');
722
+ setAttachments([]);
723
+ setPaymentMode(null);
724
+ setBalanceDue(0);
725
+ setReceivedAmount(0);
726
+ setCalculatedAmount('');
727
+ setBillId(0);
728
+ setDate(new Date());
729
+
730
+ setSuccessModal(true);
731
+ setTimeout(() => {
732
+ setSuccessModal(false);
733
+ navigation.goBack();
734
+ }, 2000);
735
+ } catch (err) {
736
+ console.log('💥 Bill Update Error:', err);
737
+ }
738
+ };
739
+
740
+ const getAllClientTypes = async () => {
741
+ try {
742
+ const [customers, suppliers, banks] = await Promise.all([
743
+ getClientsByType(0, null, null, selectBusiness?.id),
744
+ getClientsByType(1, null, null, selectBusiness?.id),
745
+ getClientsByType(2, null, null, selectBusiness?.id),
746
+ ]);
747
+
748
+ const allClients = [...customers, ...suppliers, ...banks];
749
+
750
+ // sort
751
+ const sortedClients = allClients.sort((a, b) => a.type - b.type);
752
+ setClients(sortedClients);
753
+
754
+ // Map phone -> full client info
755
+ const phoneMap = new Map();
756
+ allClients.forEach((c) => {
757
+ const formatted = formatPhoneNumber(c.phone || '')?.toLowerCase();
758
+ if (formatted) {
759
+ phoneMap.set(formatted, {
760
+ id: c.id,
761
+ type: c.type,
762
+ name: c.name,
763
+ phone: c.phone,
764
+ });
765
+ }
766
+ });
767
+ setClientPhoneMap(phoneMap);
768
+ } catch (error) {
769
+ console.error(error);
770
+ }
771
+ };
772
+
773
+ const getAllContacts = async () => {
774
+ if (Platform.OS === 'android') {
775
+ try {
776
+ const granted = await PermissionsAndroid.request(
777
+ PermissionsAndroid.PERMISSIONS.READ_CONTACTS,
778
+ {
779
+ title: 'Contacts',
780
+ message: 'This app would like to view your contacts.',
781
+ buttonPositive: 'Please accept bare mortal',
782
+ }
783
+ );
784
+
785
+ if (granted === PermissionsAndroid.RESULTS.GRANTED) {
786
+ console.log('Contacts permission granted');
787
+ Contacts.getAll().then((contacts) => {
788
+ setContacts(contacts);
789
+ });
790
+ } else {
791
+ console.log('Contacts permission denied');
792
+ return;
793
+ }
794
+ } catch (err) {
795
+ console.warn(err);
796
+ return;
797
+ }
798
+ }
799
+ setIsModalVisible(false);
800
+ };
801
+
802
+ const filteredContacts = contacts.filter((item) => {
803
+ const name = item?.displayName?.toLowerCase() || '';
804
+ const rawNumber = item?.phoneNumbers[0]?.number || '';
805
+ const formattedNumber = formatPhoneNumber(rawNumber)?.toLowerCase() || '';
806
+
807
+ // 🔹 use your searchText state (from TextInput)
808
+ const searchLower = searchText.toLowerCase();
809
+
810
+ // (optional) client type
811
+ const clientType = clientPhoneMap.get(formattedNumber);
812
+
813
+ return name.includes(searchLower) || formattedNumber.includes(searchLower);
814
+ });
815
+
816
+ const filteredClients = Clients.filter((c) => {
817
+ const name = c.name?.toLowerCase() || '';
818
+ const phone = c.phone?.toLowerCase() || '';
819
+ const searchLower = searchText.toLowerCase();
820
+
821
+ return name.includes(searchLower) || phone.includes(searchLower);
822
+ });
823
+
824
+ const onPartyPress = async () => {
825
+ await getAllContacts();
826
+ await getAllClientTypes();
827
+ setChangeModal(true);
828
+ };
829
+
830
+ const onContinue = async (name, phoneNUmer) => {
831
+ // normalize phone
832
+ const normalizedPhone = phoneNUmer ? String(phoneNUmer).trim() : '';
833
+ let data = [...clients, ...suppliers];
834
+
835
+ try {
836
+ let clientId;
837
+ let homeDetails = null;
838
+
839
+ // If phone exists → check if already in clients array
840
+ const isExist =
841
+ normalizedPhone !== ''
842
+ ? data?.find((item) => {
843
+ const itemPhone = item?.phone ? String(item.phone).trim() : '';
844
+ return itemPhone === normalizedPhone && itemPhone !== '';
845
+ })
846
+ : undefined; // no phone → force new client
847
+
848
+ if (isExist) {
849
+ // Existing client found
850
+ clientId = isExist.id;
851
+ homeDetails = isExist;
852
+ } else {
853
+ console.log('else');
854
+ // No existing client or no phone given → always create new
855
+ const res = await addClient(
856
+ name,
857
+ normalizedPhone,
858
+ 0,
859
+ selectBusiness?.id
860
+ );
861
+ setName('');
862
+ setPhoneNum('');
863
+ clientId = res?.insertId;
864
+ }
865
+
866
+ const resp = await getClientDetails(clientId);
867
+ dispatch({ type: CLIENT_DETAILS, payload: resp });
868
+
869
+ setSelectedParty(resp);
870
+ setChangeModal(false);
871
+
872
+ // navigation.replace('CustomerEntries', homeDetails ? { homeDetails } : {});
873
+ } catch (err) {
874
+ console.log('Error:', err);
875
+ }
876
+ };
877
+
878
+ useEffect(() => {
879
+ const unsubscribe = navigation.addListener('focus', () => {
880
+ if (!invoiceId) {
881
+ getInvoiceEntries(null, null, selectBusiness?.id).then((res) => {
882
+ let length = res.length;
883
+ setBillId(String(length + 1));
884
+ });
885
+ }
886
+ });
887
+
888
+ return () => unsubscribe();
889
+ }, [navigation]);
890
+
891
+ useEffect(() => {
892
+ const showSubscription = Keyboard.addListener('keyboardDidShow', (e) => {
893
+ const height = e?.endCoordinates?.height || 0;
894
+ console.log('Keyboard Shown, height:', height);
895
+ setKeyboardPadding(height + 20); // Add a small safe margin
896
+ });
897
+
898
+ const hideSubscription = Keyboard.addListener('keyboardDidHide', () => {
899
+ console.log('Keyboard Hidden');
900
+ setKeyboardPadding(0);
901
+ });
902
+
903
+ return () => {
904
+ showSubscription.remove();
905
+ hideSubscription.remove();
906
+ };
907
+ }, []);
908
+
909
+ const addPartyTransaction = async (finalValue, oldId) => {
910
+ try {
911
+ const res = await addTransaction(
912
+ SelectedParty.id,
913
+ String(finalValue),
914
+ '0',
915
+ Details,
916
+ fromJsDateToSql(date),
917
+ AudioFile,
918
+ `Bill_billId${String(oldId)}`
919
+ );
920
+
921
+ console.log(res, 'Transaction Success');
922
+ const trxId = res.insertId; // ✅ new transaction ID
923
+
924
+ if (attachments && attachments.length > 0) {
925
+ for (const file of attachments) {
926
+ try {
927
+ await addTransactionImages(trxId, file.uri);
928
+ console.log(`Attachment added: ${file.name}`);
929
+ } catch (err) {
930
+ console.log('Attachment insert error:', err);
931
+ }
932
+ }
933
+ }
934
+ } catch (err) {
935
+ console.log(err, 'Transaction Error');
936
+ }
937
+ };
938
+
939
+ const calculateQuantity = (existingQty, newQty, type) => {
940
+ const current = Number(existingQty) || 0;
941
+ const input = Number(newQty) || 0;
942
+
943
+ if (type === 'IN') {
944
+ return current + input; // Add stock
945
+ } else if (type === 'OUT') {
946
+ return current - input; // Reduce stock
947
+ } else {
948
+ return current; // No change if type is invalid
949
+ }
950
+ };
951
+
952
+ const addStockEntry = async (
953
+ itemId,
954
+ stockOUT,
955
+ amount,
956
+ rateSale,
957
+ billNo,
958
+ oldQuantity,
959
+ addedQuantity,
960
+ Details,
961
+ AudioFile,
962
+ date,
963
+ selectBusiness
964
+ ) => {
965
+ try {
966
+ debugger;
967
+ const res = await addItemDetails(
968
+ itemId,
969
+ '0', // stockIN (since this is stockOUT)
970
+ stockOUT,
971
+ amount,
972
+ rateSale,
973
+ `${Details}_bill_${String(billNo)}`,
974
+ AudioFile,
975
+ fromJsDateToSql(date),
976
+ selectBusiness?.id,
977
+ String(billNo)
978
+ );
979
+
980
+ console.log('✅ Transaction Success:', res);
981
+
982
+ const updatedQty = calculateQuantity(oldQuantity, addedQuantity, 'OUT');
983
+ await updateItemQty(itemId, updatedQty);
984
+
985
+ const trxId = res?.insertId;
986
+ console.log('🆔 New Transaction ID:', trxId);
987
+
988
+ return trxId; // optional return if you want to use it later
989
+ } catch (error) {
990
+ console.error('❌ Error adding entry:', error);
991
+ }
992
+ };
993
+
994
+ return (
995
+ <>
996
+ <View style={Styles._mainContainer}>
997
+ <Header
998
+ navigation={navigation}
999
+ title={'Create New Bill'}
1000
+ firstColor={COLORS.redColor}
1001
+ secondColor={COLORS.redColor}
1002
+ />
1003
+ <LinearGradient
1004
+ style={[Styles._headerMain, { height: 30 }]}
1005
+ start={{ x: 0, y: 0 }}
1006
+ end={{ x: 1, y: 0 }}
1007
+ colors={[COLORS.redColor, COLORS.redColor]}
1008
+ />
1009
+ <ScrollView
1010
+ style={{
1011
+ width: WP(100),
1012
+ position: 'absolute',
1013
+ top: 45,
1014
+ height: HP(95),
1015
+ }}
1016
+ contentContainerStyle={{ paddingBottom: 600 }}
1017
+ >
1018
+ <View
1019
+ style={[
1020
+ Styles._contentMain,
1021
+ { marginTop: 15, paddingHorizontal: 10, gap: 10 },
1022
+ ]}
1023
+ >
1024
+ <View
1025
+ style={{
1026
+ flexDirection: 'row',
1027
+ alignItems: 'center',
1028
+ width: '100%',
1029
+ justifyContent: 'space-between',
1030
+ marginTop: 12,
1031
+ }}
1032
+ >
1033
+ <FloatingInput
1034
+ label="Bill Number"
1035
+ // iconName="receipt-outline"
1036
+ keyboardType="number-pad"
1037
+ iconPosition="right"
1038
+ value={BillId}
1039
+ onChangeText={(text) => setBillId(text)}
1040
+ allowedChars={/[^0-9]/g}
1041
+ maxLength={10}
1042
+ containerStyle={{ width: '47.5%' }}
1043
+ />
1044
+
1045
+ <FloatingInput
1046
+ label="Date"
1047
+ iconName="calendar-outline"
1048
+ iconPosition="left"
1049
+ editable={false}
1050
+ onPress={showDate}
1051
+ value={date ? date?.toDateString() : 'Date'}
1052
+ // onChangeText={(text) => setForm({ ...form, amount: text })}
1053
+ containerStyle={{ width: '47.5%' }}
1054
+ // iconColor={COLORS.greenColor}
1055
+ inputStyle={{ fontSize: 10 }}
1056
+ />
1057
+ </View>
1058
+
1059
+ <TouchableOpacity
1060
+ activeOpacity={0.8}
1061
+ style={Styles._textInputParty}
1062
+ onPress={async () => await onPartyPress()}
1063
+ >
1064
+ {SelectedParty ? (
1065
+ <Text
1066
+ style={[
1067
+ Styles._inputText,
1068
+ { color: COLORS.redColor, fontFamily: FONT_MEDIUM },
1069
+ ]}
1070
+ >
1071
+ {SelectedParty?.name}
1072
+ </Text>
1073
+ ) : (
1074
+ <Text
1075
+ style={[
1076
+ Styles._inputText,
1077
+ { color: COLORS.redColor, fontFamily: FONT_MEDIUM },
1078
+ ]}
1079
+ >
1080
+ Add Party
1081
+ </Text>
1082
+ )}
1083
+
1084
+ {SelectedParty ? (
1085
+ <TouchableOpacity
1086
+ activeOpacity={0.8}
1087
+ onPress={() => setSelectedParty(null)}
1088
+ >
1089
+ <Ionicons
1090
+ name={'close-circle'}
1091
+ color={COLORS.redColor}
1092
+ size={25}
1093
+ />
1094
+ </TouchableOpacity>
1095
+ ) : (
1096
+ <Ionicons
1097
+ name={'chevron-forward'}
1098
+ color={COLORS.redColor}
1099
+ size={20}
1100
+ />
1101
+ )}
1102
+ </TouchableOpacity>
1103
+
1104
+ <View
1105
+ style={[
1106
+ Styles._textInputParty,
1107
+ { height: 'auto', flexDirection: 'column' },
1108
+ ]}
1109
+ >
1110
+ <TouchableOpacity
1111
+ activeOpacity={0.8}
1112
+ style={{
1113
+ flexDirection: 'row',
1114
+ justifyContent: 'space-between',
1115
+ width: '100%',
1116
+ height: 60,
1117
+ alignItems: 'center',
1118
+ }}
1119
+ // style={Styles._textInputParty}
1120
+ onPress={() => {
1121
+ navigation.navigate('AddItems', {
1122
+ selectedItems: SelectedItems,
1123
+ totalAmount: totalAmount,
1124
+ onSelect: (newSelectedItems, newTotalAmount) => {
1125
+ setSelectedItems(newSelectedItems);
1126
+ setTotalAmount(newTotalAmount);
1127
+ setAmount(String(newTotalAmount));
1128
+ },
1129
+ });
1130
+ }}
1131
+ >
1132
+ <Text
1133
+ style={[
1134
+ Styles._inputText,
1135
+ { color: COLORS.redColor, fontFamily: FONT_MEDIUM },
1136
+ ]}
1137
+ >
1138
+ Add Items
1139
+ </Text>
1140
+ <Ionicons
1141
+ name={'chevron-forward'}
1142
+ color={COLORS.redColor}
1143
+ size={20}
1144
+ />
1145
+ </TouchableOpacity>
1146
+ {SelectedItems?.length > 0 && (
1147
+ <View style={{ width: '100%' }}>
1148
+ <View style={Styles._itemHeaderMain}>
1149
+ <View style={{ width: '30%' }}>
1150
+ <Text
1151
+ style={{
1152
+ color: COLORS.gray,
1153
+ fontFamily: FONT_NORMAL,
1154
+ fontSize: 12,
1155
+ }}
1156
+ >
1157
+ ITEM
1158
+ </Text>
1159
+ </View>
1160
+
1161
+ <View style={{ width: '20%', alignItems: 'flex-end' }}>
1162
+ <Text
1163
+ style={{
1164
+ color: COLORS.gray,
1165
+ fontFamily: FONT_NORMAL,
1166
+ fontSize: 12,
1167
+ }}
1168
+ >
1169
+ QTY
1170
+ </Text>
1171
+ </View>
1172
+
1173
+ <View style={{ width: '20%', alignItems: 'flex-end' }}>
1174
+ <Text
1175
+ style={{
1176
+ color: COLORS.gray,
1177
+ fontFamily: FONT_NORMAL,
1178
+ fontSize: 12,
1179
+ }}
1180
+ >
1181
+ RATE
1182
+ </Text>
1183
+ </View>
1184
+
1185
+ <View style={{ width: '20%', alignItems: 'flex-end' }}>
1186
+ <Text
1187
+ style={{
1188
+ color: COLORS.gray,
1189
+ fontFamily: FONT_NORMAL,
1190
+ fontSize: 12,
1191
+ }}
1192
+ >
1193
+ AMOUNT
1194
+ </Text>
1195
+ </View>
1196
+ </View>
1197
+ {SelectedItems?.map((i) => (
1198
+ <View style={Styles._itemHeaderMain}>
1199
+ <View style={{ width: '30%' }}>
1200
+ <Text
1201
+ style={{
1202
+ color: COLORS.blackColor,
1203
+ fontFamily: FONT_NORMAL,
1204
+ fontSize: 12,
1205
+ }}
1206
+ >
1207
+ {i?.name}
1208
+ </Text>
1209
+ </View>
1210
+
1211
+ <View style={{ width: '20%', alignItems: 'flex-end' }}>
1212
+ <Text
1213
+ style={{
1214
+ color: COLORS.blackColor,
1215
+ fontFamily: FONT_NORMAL,
1216
+ fontSize: 12,
1217
+ }}
1218
+ >
1219
+ {addCommas(Number(i?.addedQty))}
1220
+ </Text>
1221
+ </View>
1222
+
1223
+ <View style={{ width: '20%', alignItems: 'flex-end' }}>
1224
+ <Text
1225
+ style={{
1226
+ color: COLORS.blackColor,
1227
+ fontFamily: FONT_NORMAL,
1228
+ fontSize: 12,
1229
+ }}
1230
+ >
1231
+ {addCommas(Number(i?.addedRate))}
1232
+ </Text>
1233
+ </View>
1234
+
1235
+ <View style={{ width: '20%', alignItems: 'flex-end' }}>
1236
+ <Text
1237
+ style={{
1238
+ color: COLORS.blackColor,
1239
+ fontFamily: FONT_NORMAL,
1240
+ fontSize: 12,
1241
+ }}
1242
+ >
1243
+ {addCommas(
1244
+ Number(i?.addedQty) * Number(i?.addedRate)
1245
+ )}
1246
+ </Text>
1247
+ </View>
1248
+ </View>
1249
+ ))}
1250
+ </View>
1251
+ )}
1252
+ </View>
1253
+
1254
+
1255
+ <View
1256
+ style={{
1257
+ flexDirection: 'row',
1258
+ alignItems: 'center',
1259
+ width: '100%',
1260
+ justifyContent: 'space-between',
1261
+ marginTop: 12,
1262
+ }}
1263
+ >
1264
+ <FloatingInput
1265
+ label="Disc. %"
1266
+ // iconName="pricetags-outline"
1267
+ keyboardType="number-pad"
1268
+ iconPosition="right"
1269
+ value={Discount}
1270
+ onChangeText={(text) => {
1271
+ // Remove any non-numeric characters
1272
+ let numericText = text
1273
+ .replace(/[^0-9.]/g, '')
1274
+ .replace(/(\..*)\./g, '$1');
1275
+
1276
+ // Convert to number and cap at 99
1277
+ if (parseInt(numericText) > 99) {
1278
+ numericText = '99';
1279
+ }
1280
+
1281
+ setDiscount(numericText);
1282
+ }}
1283
+ allowedChars={/[^0-9.]/g}
1284
+ maxLength={10}
1285
+ containerStyle={{ width: '47.5%' }}
1286
+ />
1287
+
1288
+ <FloatingInput
1289
+ label="Tax"
1290
+ // iconName="pricetags-outline"
1291
+ keyboardType="number-pad"
1292
+ iconPosition="right"
1293
+ value={Tax}
1294
+ onChangeText={(text) => {
1295
+ let numericText = text
1296
+ .replace(/[^0-9.]/g, '')
1297
+ .replace(/^(\d*\.\d*).*$/, '$1');
1298
+ setTax(numericText);
1299
+ }}
1300
+ allowedChars={/[^0-9.]/g}
1301
+ maxLength={10}
1302
+ containerStyle={{ width: '47.5%' }}
1303
+ />
1304
+ </View>
1305
+
1306
+ <View
1307
+ style={{
1308
+ flexDirection: 'row',
1309
+ alignItems: 'center',
1310
+ width: '100%',
1311
+ justifyContent: 'space-between',
1312
+ }}
1313
+ >
1314
+ <TouchableOpacity
1315
+ style={[Styles.InvoiceAmountText]}
1316
+ activeOpacity={0.8}
1317
+ onPress={() => setDuration('monthly')}
1318
+ >
1319
+ <Text style={Styles.InvoiceAmountText}>Invoice Amount</Text>
1320
+ </TouchableOpacity>
1321
+
1322
+ <FloatingInput
1323
+ label="Enter Amount"
1324
+ // iconName="cash-outline"
1325
+ iconPosition="right"
1326
+ value={Amount}
1327
+ editable={!totalAmount > 0}
1328
+ onChangeText={(text) => {
1329
+ setPaymentMode('');
1330
+ let numericText = text
1331
+ .replace(/[^0-9.]/g, '')
1332
+ .replace(/(\..*)\./g, '$1');
1333
+ setAmount(numericText);
1334
+ }}
1335
+ // allowedChars={/[^A-Za-z0-9\s]/g}
1336
+ maxLength={8}
1337
+ containerStyle={{ width: '47.5%' }}
1338
+ inputStyle={{ fontSize: 14, fontFamily: FONT_BOLD }}
1339
+ keyboardType="number-pad"
1340
+ />
1341
+ </View>
1342
+
1343
+ <TouchableOpacity
1344
+ activeOpacity={0.8}
1345
+ style={Styles._textInputParty}
1346
+ onPress={() => {
1347
+ !AudioFile && askAudioPermission();
1348
+ }}
1349
+ >
1350
+ {AudioFile ? (
1351
+ <>
1352
+ {PlayLoading ? (
1353
+ <ActivityIndicator
1354
+ color={COLORS.redColor}
1355
+ size={'small'}
1356
+ animating
1357
+ />
1358
+ ) : (
1359
+ <TouchableOpacity
1360
+ activeOpacity={0.8}
1361
+ onPress={() => {
1362
+ if (IsPlaying) {
1363
+ Sound.stopPlayer();
1364
+ Sound.removePlayBackListener();
1365
+ Sound.removePlaybackEndListener();
1366
+ setIsPlaying(false);
1367
+ animationRef.current?.pause();
1368
+ } else {
1369
+ onStartPlay(AudioFile);
1370
+ }
1371
+ }}
1372
+ >
1373
+ <Ionicons
1374
+ color={COLORS.redColor}
1375
+ size={22}
1376
+ name={IsPlaying ? 'pause' : 'play'}
1377
+ />
1378
+ </TouchableOpacity>
1379
+ )}
1380
+
1381
+ <LottieView
1382
+ source={require('../assets/animations/voice_visualization.json')}
1383
+ autoPlay={false}
1384
+ loop
1385
+ style={{ width: '65%', height: 42 }}
1386
+ ref={animationRef}
1387
+ />
1388
+
1389
+ <TouchableOpacity
1390
+ activeOpacity={0.8}
1391
+ onPress={handleDeleteAudio}
1392
+ >
1393
+ <Ionicons
1394
+ color={COLORS.redColor}
1395
+ size={22}
1396
+ name={'close'}
1397
+ />
1398
+ </TouchableOpacity>
1399
+ </>
1400
+ ) : (
1401
+ <>
1402
+ <Text
1403
+ style={{
1404
+ color: COLORS.redColor,
1405
+ fontSize: 13,
1406
+ fontFamily: FONT_MEDIUM,
1407
+ }}
1408
+ >
1409
+ Attach Voice Note
1410
+ </Text>
1411
+ <Ionicons
1412
+ name={'mic-outline'}
1413
+ color={COLORS.redColor}
1414
+ size={22}
1415
+ />
1416
+ </>
1417
+ )}
1418
+ </TouchableOpacity>
1419
+
1420
+ <FloatingInput
1421
+ label="Enter details."
1422
+ // iconName="list-outline"
1423
+ iconPosition="right"
1424
+ value={Details}
1425
+ onChangeText={(text) => setDetails(text)}
1426
+ allowedChars={/[^A-Za-z0-9\s]/g}
1427
+ maxLength={300}
1428
+ containerStyle={{ width: '100%' }}
1429
+ />
1430
+ {/* <Text style={Styles._inputText}>Enter details...</Text> */}
1431
+
1432
+ <TouchableOpacity
1433
+ activeOpacity={0.8}
1434
+ style={Styles._textInputAttathcment}
1435
+ onPress={() => setIsModalVisible(true)}
1436
+ >
1437
+ <Ionicons name={'attach'} color={COLORS.redColor} size={22} />
1438
+
1439
+ <Text style={Styles._inputText}>
1440
+ Attachment Photo & PDF Files
1441
+ </Text>
1442
+ </TouchableOpacity>
1443
+
1444
+ {attachments && attachments.length > 0 && (
1445
+ <View style={Styles._textInputAttathcment}>
1446
+ {attachments.map((file, index) => (
1447
+ <View
1448
+ key={index}
1449
+ style={{ marginLeft: 8, alignItems: 'center' }}
1450
+ >
1451
+ {file.type === 'image' ? (
1452
+ <Image
1453
+ source={{ uri: file.uri }}
1454
+ style={{ width: 40, height: 40, borderRadius: 5 }}
1455
+ />
1456
+ ) : (
1457
+ <Ionicons
1458
+ name="document-text-outline"
1459
+ size={30}
1460
+ color={COLORS.redColor}
1461
+ />
1462
+ )}
1463
+ {/* delete cross */}
1464
+ <TouchableOpacity
1465
+ onPress={() => removeAttachment(index)}
1466
+ style={{
1467
+ position: 'absolute',
1468
+ top: -5,
1469
+ right: -5,
1470
+ backgroundColor: 'white',
1471
+ borderRadius: 10,
1472
+ padding: 2,
1473
+ }}
1474
+ >
1475
+ <Ionicons
1476
+ name="close-circle"
1477
+ size={18}
1478
+ color={COLORS.redColor}
1479
+ />
1480
+ </TouchableOpacity>
1481
+ </View>
1482
+ ))}
1483
+ </View>
1484
+ )}
1485
+ </View>
1486
+ </ScrollView>
1487
+ </View>
1488
+
1489
+ {/* Sound Modal */}
1490
+ <Modal
1491
+ isVisible={IsSoundModal}
1492
+ // onBackdropPress={() => setIsSoundModal(false)}
1493
+ // onBackButtonPress={() => setIsSoundModal(false)}
1494
+ >
1495
+ <View style={Styles._voiceModalMain}>
1496
+ <Text
1497
+ style={{
1498
+ color: COLORS.blackColor,
1499
+ fontFamily: FONT_MEDIUM,
1500
+ fontSize: 18,
1501
+ }}
1502
+ >
1503
+ DigiKhata
1504
+ </Text>
1505
+
1506
+ <LottieView
1507
+ style={{ width: 130, height: 130 }}
1508
+ source={require('../assets/animations/recording.json')}
1509
+ autoPlay
1510
+ loop
1511
+ />
1512
+
1513
+ <Text
1514
+ style={{
1515
+ color: COLORS.blackColor,
1516
+ fontFamily: FONT_NORMAL,
1517
+ fontSize: 13,
1518
+ opacity: 0.6,
1519
+ }}
1520
+ >
1521
+ Recording
1522
+ </Text>
1523
+
1524
+ <View
1525
+ style={{
1526
+ flexDirection: 'row',
1527
+ width: '50%',
1528
+ justifyContent: 'space-between',
1529
+ alignItems: 'center',
1530
+ }}
1531
+ >
1532
+ <TouchableOpacity
1533
+ style={Styles._voiceBtn}
1534
+ activeOpacity={0.8}
1535
+ onPress={() => {
1536
+ onStopRecord(true);
1537
+ }}
1538
+ >
1539
+ <Ionicons
1540
+ name={'trash-outline'}
1541
+ color={COLORS.blackColor}
1542
+ size={22}
1543
+ />
1544
+ </TouchableOpacity>
1545
+
1546
+ <Text>{RecordingTime}</Text>
1547
+
1548
+ <TouchableOpacity
1549
+ style={Styles._voiceBtn}
1550
+ activeOpacity={0.8}
1551
+ onPress={() => {
1552
+ onStopRecord(false);
1553
+ }}
1554
+ >
1555
+ <Ionicons name={'stop'} color={COLORS.blackColor} size={22} />
1556
+ </TouchableOpacity>
1557
+ </View>
1558
+ </View>
1559
+ </Modal>
1560
+
1561
+ {/* Modal */}
1562
+ <Modal
1563
+ isVisible={isModalVisible}
1564
+ onBackdropPress={() => setIsModalVisible(false)}
1565
+ onBackButtonPress={() => setIsModalVisible(false)}
1566
+ >
1567
+ <View
1568
+ style={{ backgroundColor: 'white', padding: 20, borderRadius: 12 }}
1569
+ >
1570
+ <Text
1571
+ style={{ fontSize: 16, fontFamily: FONT_MEDIUM, marginBottom: 12 }}
1572
+ >
1573
+ Choose Option
1574
+ </Text>
1575
+
1576
+ <TouchableOpacity style={Styles._modalBtn2} onPress={handleGallery}>
1577
+ <Ionicons name="image-outline" size={20} color="red" />
1578
+ <Text style={Styles._modalText}>Gallery</Text>
1579
+ </TouchableOpacity>
1580
+
1581
+ <TouchableOpacity style={Styles._modalBtn2} onPress={handleCamera}>
1582
+ <Ionicons name="camera-outline" size={20} color="red" />
1583
+ <Text style={Styles._modalText}>Camera</Text>
1584
+ </TouchableOpacity>
1585
+
1586
+ <TouchableOpacity style={Styles._modalBtn2} onPress={handlePDF}>
1587
+ <Ionicons name="document-outline" size={20} color="red" />
1588
+ <Text style={Styles._modalText}>PDF</Text>
1589
+ </TouchableOpacity>
1590
+ </View>
1591
+ </Modal>
1592
+
1593
+ {/* Success Modal */}
1594
+ <Modal
1595
+ isVisible={SuccessModal}
1596
+ coverScreen
1597
+ style={{ margin: 0, padding: 0 }}
1598
+ animationInTiming={100}
1599
+ animationOutTiming={100}
1600
+ >
1601
+ <View
1602
+ style={{
1603
+ width: WP(100),
1604
+ height: HP(100),
1605
+ backgroundColor: COLORS.whiteColor,
1606
+ justifyContent: 'center',
1607
+ alignItems: 'center',
1608
+ }}
1609
+ >
1610
+ <LottieView
1611
+ source={require('../assets/animations/success.json')}
1612
+ style={{ width: 120, height: 120 }}
1613
+ autoPlay
1614
+ loop={false}
1615
+ />
1616
+
1617
+ <Text
1618
+ style={{ color: '#00C985', fontFamily: FONT_MEDIUM, fontSize: 15 }}
1619
+ >
1620
+ Transaction Saved
1621
+ </Text>
1622
+ </View>
1623
+ </Modal>
1624
+
1625
+ <Modal
1626
+ isVisible={ChangeModal}
1627
+ onBackButtonPress={() => {
1628
+ setShowNewBtn(false);
1629
+ setChangeModal(false);
1630
+ }}
1631
+ onBackdropPress={() => {
1632
+ setShowNewBtn(false);
1633
+ setChangeModal(false);
1634
+ }}
1635
+ avoidKeyboard={false}
1636
+ >
1637
+ <View style={Styles._changeModalMain}>
1638
+ <View style={Styles._changeModalHeader}>
1639
+ <Text style={Styles._changeModalHeaderTxt}>Select Party</Text>
1640
+ </View>
1641
+ <View style={Styles._modalSearchMain}>
1642
+ <TextInput
1643
+ style={Styles._modalSearch}
1644
+ cursorColor={COLORS.redColor}
1645
+ placeholder={
1646
+ ShowNewBtn
1647
+ ? filteredContacts?.length && filteredContacts.length != 0
1648
+ ? 'Search Contacts'
1649
+ : 'Type Customer Name'
1650
+ : 'Search Clients'
1651
+ }
1652
+ value={searchText}
1653
+ maxLength={25}
1654
+ onChangeText={setSearchText}
1655
+ placeholderTextColor={COLORS.gray}
1656
+ />
1657
+ </View>
1658
+
1659
+ <View style={Styles._modalSearchMain}>
1660
+ {!ShowNewBtn ? (
1661
+ <TouchableOpacity
1662
+ style={Styles._addContactBtn}
1663
+ activeOpacity={0.8}
1664
+ onPress={() => setShowNewBtn(true)}
1665
+ >
1666
+ <View style={Styles._avatarMain}>
1667
+ <Ionicons
1668
+ name="person-add-outline"
1669
+ color={COLORS.redColor}
1670
+ size={22}
1671
+ />
1672
+ </View>
1673
+
1674
+ <View style={{ width: '70%' }}>
1675
+ <Text
1676
+ style={{
1677
+ color: COLORS.primaryColor,
1678
+ fontFamily: FONT_NORMAL,
1679
+ fontSize: 12,
1680
+ }}
1681
+ >
1682
+ Add New Customer
1683
+ </Text>
1684
+ </View>
1685
+
1686
+ <Ionicons
1687
+ name="chevron-forward"
1688
+ color={COLORS.primaryColor}
1689
+ size={22}
1690
+ />
1691
+ </TouchableOpacity>
1692
+ ) : (
1693
+ <View style={Styles._phoneInputMain}>
1694
+ <CountryPhoneInput
1695
+ contentContainerStyle={{ width: '100%' }}
1696
+ onChange={(text) => {
1697
+ setPhoneNum(text?.fullNumber);
1698
+ }}
1699
+ />
1700
+
1701
+ <TouchableOpacity
1702
+ activeOpacity={0.8}
1703
+ onPress={() => {
1704
+ if (searchText.trim()) {
1705
+ onContinue(searchText, PhoneNum);
1706
+ }
1707
+ }}
1708
+ style={[
1709
+ Styles._modalBtn,
1710
+ {
1711
+ backgroundColor: searchText?.trim()
1712
+ ? COLORS.primaryColor
1713
+ : COLORS.gray,
1714
+ width: '100%',
1715
+ justifyContent: 'center',
1716
+ paddingVertical: 15,
1717
+ },
1718
+ ]}
1719
+ >
1720
+ <Text
1721
+ style={{
1722
+ color: COLORS.whiteColor,
1723
+ fontFamily: FONT_NORMAL,
1724
+ fontSize: 12,
1725
+ }}
1726
+ >
1727
+ CONTINUE
1728
+ </Text>
1729
+ </TouchableOpacity>
1730
+ </View>
1731
+ )}
1732
+ </View>
1733
+ {!ShowNewBtn ? (
1734
+ <ScrollView
1735
+ contentContainerStyle={{
1736
+ alignItems: 'center',
1737
+ }}
1738
+ >
1739
+ {filteredClients?.length === 0 ? (
1740
+ <View
1741
+ style={{
1742
+ height: 300,
1743
+ justifyContent: 'center',
1744
+ alignItems: 'center',
1745
+ }}
1746
+ >
1747
+ <Text
1748
+ style={{
1749
+ textAlign: 'center',
1750
+ color: COLORS.blackColor,
1751
+ fontFamily: FONT_MEDIUM,
1752
+ fontSize: 13,
1753
+ }}
1754
+ >
1755
+ No Records Found
1756
+ </Text>
1757
+ </View>
1758
+ ) : (
1759
+ filteredClients.map((item, index) => {
1760
+ let amount = item?.total_subamount - item?.total_amount;
1761
+
1762
+ let type = 'none';
1763
+ if (amount > 0) {
1764
+ type = 'receivable';
1765
+ } else if (amount < 0) {
1766
+ type = 'payable';
1767
+ }
1768
+
1769
+ amount = Math.abs(amount);
1770
+
1771
+ return (
1772
+ <User
1773
+ key={index}
1774
+ name={item?.name}
1775
+ addedAt={formatDateTime(
1776
+ item?.latest_transaction_date || item?.created_at
1777
+ )}
1778
+ amount={amount}
1779
+ type={type}
1780
+ avatarColor={item?.type == 0 ? 'red' : 'green'}
1781
+ clientType={item?.type}
1782
+ icon={item?.local_path}
1783
+ mainContainer={{ width: '100%' }}
1784
+ onPress={() => {
1785
+ setShowNewBtn(false);
1786
+ setChangeModal(false);
1787
+ setSelectedParty(item);
1788
+ }}
1789
+ />
1790
+ );
1791
+ })
1792
+ )}
1793
+ </ScrollView>
1794
+ ) : (
1795
+ <FlatList
1796
+ data={filteredContacts} // 🔹 now using filtered contacts
1797
+ keyExtractor={(item, index) => index.toString()}
1798
+ contentContainerStyle={{ paddingBottom: HP(20) }}
1799
+ renderItem={({ item }) => {
1800
+ const rawNumber = item?.phoneNumbers[0]?.number;
1801
+ const formattedNumber =
1802
+ formatPhoneNumber(rawNumber)?.toLowerCase();
1803
+
1804
+ const clientInfo = clientPhoneMap.get(formattedNumber);
1805
+
1806
+ const clientId = clientInfo?.id;
1807
+ const clientType = clientInfo?.type;
1808
+
1809
+ let typeLabel = '';
1810
+ if (clientType === 0) typeLabel = 'Customer';
1811
+ else if (clientType === 1) typeLabel = 'Supplier';
1812
+ const highlight = clientType === 0 || clientType === 1;
1813
+
1814
+ return (
1815
+ <TouchableOpacity
1816
+ style={[Styles._contactsCardMain]}
1817
+ activeOpacity={0.8}
1818
+ onPress={async () => {
1819
+ onContinue(
1820
+ item?.displayName,
1821
+ item?.phoneNumbers[0]?.number
1822
+ );
1823
+ }}
1824
+ >
1825
+ <View style={Styles._avatarMain}>
1826
+ <Text style={Styles._avatarText}>
1827
+ {getAvatar(item?.displayName)}
1828
+ </Text>
1829
+ </View>
1830
+ <View style={{ width: '55%' }}>
1831
+ <Text
1832
+ style={{
1833
+ color: COLORS.blackColor,
1834
+ fontFamily: FONT_NORMAL,
1835
+ fontSize: 13,
1836
+ }}
1837
+ >
1838
+ {item?.displayName}
1839
+ </Text>
1840
+ <Text
1841
+ style={{
1842
+ color: COLORS.blackColor,
1843
+ fontFamily: FONT_NORMAL,
1844
+ fontSize: 12,
1845
+ opacity: 0.6,
1846
+ }}
1847
+ >
1848
+ {formattedNumber}
1849
+ </Text>
1850
+ </View>
1851
+
1852
+ <View
1853
+ style={{
1854
+ width: '27%',
1855
+ height: '100%',
1856
+ justifyContent: 'center',
1857
+ alignItems: 'flex-end',
1858
+ }}
1859
+ >
1860
+ <Text
1861
+ style={{
1862
+ color: COLORS.darkGrey,
1863
+ fontFamily: FONT_NORMAL,
1864
+ fontSize: 11,
1865
+ }}
1866
+ >
1867
+ {typeLabel}
1868
+ </Text>
1869
+ </View>
1870
+ </TouchableOpacity>
1871
+ );
1872
+ }}
1873
+ />
1874
+ )}
1875
+ </View>
1876
+ </Modal>
1877
+
1878
+ <BottomView
1879
+ style={{
1880
+ justifyContent: 'center',
1881
+ height: 'auto',
1882
+ backgroundColor: COLORS.whiteColor,
1883
+ paddingVertical: 10,
1884
+ flexDirection: 'column',
1885
+ gap: 10,
1886
+ bottom: keyboardPadding,
1887
+ }}
1888
+ >
1889
+ {Amount?.toString() != '' && (
1890
+ <View style={Styles._paymentOptionsMain}>
1891
+ <View style={Styles._radioMain}>
1892
+ {/* Unpaid */}
1893
+ <TouchableOpacity
1894
+ activeOpacity={0.8}
1895
+ style={Styles._radioBtn}
1896
+ onPress={() => {
1897
+ setPaymentMode(0);
1898
+ setBalanceDue(Number(CalculatedAmount));
1899
+ }}
1900
+ >
1901
+ <Ionicons
1902
+ name={
1903
+ PaymentMode === 0 ? 'radio-button-on' : 'radio-button-off'
1904
+ }
1905
+ color={
1906
+ PaymentMode === 0 ? COLORS.primaryColor : COLORS.darkGrey
1907
+ }
1908
+ size={25}
1909
+ />
1910
+ <Text style={Styles._radioText}>Unpaid</Text>
1911
+ </TouchableOpacity>
1912
+
1913
+ {/* Cash */}
1914
+ <TouchableOpacity
1915
+ activeOpacity={0.8}
1916
+ style={Styles._radioBtn}
1917
+ onPress={() => {
1918
+ setPaymentMode(1);
1919
+ setBalanceDue(0);
1920
+ setReceivedAmount(String(CalculatedAmount));
1921
+ }}
1922
+ >
1923
+ <Ionicons
1924
+ name={
1925
+ PaymentMode === 1 ? 'radio-button-on' : 'radio-button-off'
1926
+ }
1927
+ color={
1928
+ PaymentMode === 1 ? COLORS.primaryColor : COLORS.darkGrey
1929
+ }
1930
+ size={25}
1931
+ />
1932
+ <Text style={Styles._radioText}>Cash</Text>
1933
+ </TouchableOpacity>
1934
+
1935
+ {/* Online */}
1936
+ <TouchableOpacity
1937
+ activeOpacity={0.8}
1938
+ style={Styles._radioBtn}
1939
+ onPress={() => {
1940
+ setPaymentMode(2);
1941
+ setBalanceDue(0);
1942
+ setReceivedAmount(String(CalculatedAmount));
1943
+ }}
1944
+ >
1945
+ <Ionicons
1946
+ name={
1947
+ PaymentMode === 2 ? 'radio-button-on' : 'radio-button-off'
1948
+ }
1949
+ color={
1950
+ PaymentMode === 2 ? COLORS.primaryColor : COLORS.darkGrey
1951
+ }
1952
+ size={25}
1953
+ />
1954
+ <Text style={Styles._radioText}>Online</Text>
1955
+ </TouchableOpacity>
1956
+ </View>
1957
+
1958
+ <View
1959
+ style={[
1960
+ Styles._radioMain,
1961
+ {
1962
+ height: 'auto',
1963
+ paddingVertical: 10,
1964
+ justifyContent: 'flex-end',
1965
+ },
1966
+ ]}
1967
+ >
1968
+ {(PaymentMode === 1 || PaymentMode === 2) && (
1969
+ <View
1970
+ style={[
1971
+ Styles._textInpustMain,
1972
+ { width: '45%', justifyContent: 'center' },
1973
+ ]}
1974
+ >
1975
+ {/* <View style={Styles._capsuleMain}>
1976
+ <Text style={Styles._capsuleText}>Received</Text>
1977
+ </View>
1978
+
1979
+ <TextInput
1980
+ placeholder="0"
1981
+ style={[Styles._textInput, { width: '100%' }]}
1982
+ cursorColor={COLORS.primaryColor}
1983
+ placeholderTextColor={COLORS.grey}
1984
+ keyboardType="number-pad"
1985
+ value={ReceivedAmount}
1986
+ onChangeText={(text) => {
1987
+ // Remove all non-numeric and non-decimal characters
1988
+ let numericText = text
1989
+ .replace(/[^0-9.]/g, '')
1990
+ .replace(/(\..*)\./g, '$1');
1991
+
1992
+ // Update states
1993
+ setReceivedAmount(numericText);
1994
+ setBalanceDue(
1995
+ (
1996
+ Number(CalculatedAmount) - Number(numericText)
1997
+ ).toFixed(2)
1998
+ );
1999
+ }}
2000
+ /> */}
2001
+
2002
+ <FloatingInput
2003
+ label="Received"
2004
+ editable={false}
2005
+ placeholder="Received"
2006
+ // iconName="business-outline"
2007
+ keyboardType="number-pad"
2008
+ iconPosition="right"
2009
+ value={ReceivedAmount}
2010
+ onChangeText={(text) => {
2011
+ // Remove all non-numeric and non-decimal characters
2012
+ let numericText = text
2013
+ .replace(/[^0-9.]/g, '')
2014
+ .replace(/(\..*)\./g, '$1');
2015
+
2016
+ // Update states
2017
+ setReceivedAmount(numericText);
2018
+ setBalanceDue(
2019
+ (
2020
+ Number(CalculatedAmount) - Number(numericText)
2021
+ ).toFixed(2)
2022
+ );
2023
+ }}
2024
+ />
2025
+ </View>
2026
+ )}
2027
+ </View>
2028
+
2029
+ <View
2030
+ style={[
2031
+ Styles._radioMain,
2032
+ {
2033
+ borderBottomColor: COLORS.lightGray,
2034
+ borderBottomWidth: 1,
2035
+ borderTopColor: COLORS.lightGray,
2036
+ borderTopWidth: 1,
2037
+ },
2038
+ ]}
2039
+ >
2040
+ <Text style={Styles._radioText}>Balance Due</Text>
2041
+ <Text style={[Styles._radioText, { color: COLORS.blackColor }]}>
2042
+ Rs {BalanceDue}
2043
+ </Text>
2044
+ </View>
2045
+ </View>
2046
+ )}
2047
+
2048
+ <BottomView style={[Styles.bottomBar]}>
2049
+ <TouchableOpacity
2050
+ activeOpacity={0.8}
2051
+ style={[
2052
+ Styles.totalButton,
2053
+ {
2054
+ width: '100%',
2055
+ opacity:
2056
+ Number(Amount) > 0 &&
2057
+ PaymentMode != null &&
2058
+ PaymentMode !== ''
2059
+ ? 1
2060
+ : 0.6,
2061
+ },
2062
+ ]}
2063
+ onPress={() => {
2064
+ // ✅ Only allow if conditions are met
2065
+ if (
2066
+ Number(Amount) > 0 &&
2067
+ PaymentMode != null &&
2068
+ PaymentMode !== ''
2069
+ ) {
2070
+ invoiceId ? onUpdateBill() : onCreateBill();
2071
+ } else {
2072
+ console.log('⚠️ Invalid input: Amount or Payment mode missing');
2073
+ }
2074
+ }}
2075
+ >
2076
+ <Text style={Styles.totalText}>
2077
+ {invoiceId ? 'UPDATE' : 'SAVE'}
2078
+ </Text>
2079
+ </TouchableOpacity>
2080
+ </BottomView>
2081
+ </BottomView>
2082
+ </>
2083
+ );
2084
+ }
2085
+
2086
+ const Styles = StyleSheet.create({
2087
+ _mainContainer: {
2088
+ flex: 1,
2089
+ backgroundColor: COLORS.backgroundColor,
2090
+ },
2091
+ _headerMain: {
2092
+ width: WP(100),
2093
+ height: 60,
2094
+ flexDirection: 'row',
2095
+ alignItems: 'center',
2096
+ justifyContent: 'flex-start',
2097
+ gap: 15,
2098
+ },
2099
+ _headerTitle: {
2100
+ color: COLORS.whiteColor,
2101
+ fontFamily: FONT_NORMAL,
2102
+ fontSize: 15,
2103
+ },
2104
+ _contentMain: {
2105
+ width: WP(94),
2106
+ // height: "90%",
2107
+ backgroundColor: COLORS.whiteColor,
2108
+ // position: "absolute",
2109
+ // top: 55,
2110
+ shadowColor: '#000',
2111
+ shadowOffset: {
2112
+ width: 0,
2113
+ height: 2,
2114
+ },
2115
+ shadowOpacity: 0.2,
2116
+ shadowRadius: 3.84,
2117
+ elevation: 5,
2118
+ borderRadius: TEXT_SIZES.BORDER_RADIUS,
2119
+ alignItems: 'center',
2120
+ justifyContent: 'space-between',
2121
+ paddingVertical: 12,
2122
+ overflow: 'hidden',
2123
+ alignSelf: 'center',
2124
+ // paddingTop: 30
2125
+ },
2126
+ _picMain: {
2127
+ width: 120,
2128
+ height: 120,
2129
+ borderRadius: 60,
2130
+ backgroundColor: '#f2f2f2',
2131
+ justifyContent: 'center',
2132
+ alignItems: 'center',
2133
+ position: 'relative',
2134
+ },
2135
+ _pic: {
2136
+ width: 60,
2137
+ height: 60,
2138
+ },
2139
+ _selectMain: {
2140
+ position: 'absolute',
2141
+ bottom: 0,
2142
+ right: 0,
2143
+ backgroundColor: '#F44336',
2144
+ width: 45,
2145
+ height: 45,
2146
+ borderRadius: 50,
2147
+ justifyContent: 'center',
2148
+ alignItems: 'center',
2149
+ borderWidth: 3,
2150
+ borderColor: '#fff',
2151
+ },
2152
+ _input: {
2153
+ width: '95%',
2154
+ height: 60,
2155
+ // backgroundColor:"red",
2156
+ flexDirection: 'row',
2157
+ justifyContent: 'space-between',
2158
+ alignItems: 'center',
2159
+ borderColor: COLORS.gray,
2160
+ borderWidth: 1,
2161
+ borderRadius: TEXT_SIZES.BORDER_RADIUS,
2162
+ paddingHorizontal: 15,
2163
+ },
2164
+ _inputIconMain: {
2165
+ width: 38,
2166
+ height: 38,
2167
+ backgroundColor: COLORS.lightGrey,
2168
+ borderRadius: 100,
2169
+ justifyContent: 'center',
2170
+ alignItems: 'center',
2171
+ },
2172
+ _inputText: {
2173
+ color: COLORS.blackColor,
2174
+ fontFamily: FONT_NORMAL,
2175
+ fontSize: 13,
2176
+ },
2177
+ _inputsMain: {
2178
+ marginTop: 60,
2179
+ gap: 15,
2180
+ },
2181
+ _switchToSupplier: {
2182
+ width: WP(94),
2183
+ height: 60,
2184
+ // height: "90%",
2185
+ backgroundColor: COLORS.whiteColor,
2186
+ // position: "absolute",
2187
+ // top: 55,
2188
+ shadowColor: '#000',
2189
+ shadowOffset: {
2190
+ width: 0,
2191
+ height: 2,
2192
+ },
2193
+ shadowOpacity: 0.2,
2194
+ shadowRadius: 3.84,
2195
+ borderColor: COLORS.borderColor,
2196
+ borderWidth: 1,
2197
+ elevation: 5,
2198
+ borderRadius: TEXT_SIZES.BORDER_RADIUS,
2199
+ alignItems: 'center',
2200
+ justifyContent: 'space-between',
2201
+ alignSelf: 'center',
2202
+ marginTop: 15,
2203
+ flexDirection: 'row',
2204
+ paddingHorizontal: 10,
2205
+ },
2206
+ _smallText: {
2207
+ color: COLORS.blackColor,
2208
+ fontSize: 12,
2209
+ fontFamily: FONT_NORMAL,
2210
+ },
2211
+ _durationMain: {
2212
+ height: 60,
2213
+ width: '40%',
2214
+ // backgroundColor:"red",
2215
+ borderRadius: TEXT_SIZES.BORDER_RADIUS,
2216
+ borderColor: COLORS.gray,
2217
+ borderWidth: 1,
2218
+ justifyContent: 'center',
2219
+ alignItems: 'flex-start',
2220
+ paddingLeft: 10,
2221
+ },
2222
+ _textInputMain: {
2223
+ width: '100%',
2224
+ height: 60,
2225
+ borderRadius: TEXT_SIZES.BORDER_RADIUS,
2226
+ borderColor: COLORS.gray,
2227
+ borderWidth: 1,
2228
+ flexDirection: 'row',
2229
+ justifyContent: 'flex-start',
2230
+ alignItems: 'center',
2231
+ paddingHorizontal: 12,
2232
+ gap: 15,
2233
+ },
2234
+ _textInputParty: {
2235
+ width: '100%',
2236
+ height: 60,
2237
+ borderRadius: TEXT_SIZES.BORDER_RADIUS,
2238
+ borderColor: COLORS.gray,
2239
+ borderWidth: 1,
2240
+ flexDirection: 'row',
2241
+ justifyContent: 'space-between',
2242
+ alignItems: 'center',
2243
+ paddingHorizontal: 12,
2244
+ gap: 15,
2245
+ },
2246
+ _textInputAttathcment: {
2247
+ width: '100%',
2248
+ height: 60,
2249
+ borderRadius: TEXT_SIZES.BORDER_RADIUS,
2250
+ borderColor: COLORS.gray,
2251
+ borderWidth: 1,
2252
+ flexDirection: 'row',
2253
+ justifyContent: 'flex-start',
2254
+ alignItems: 'center',
2255
+ paddingHorizontal: 12,
2256
+ gap: 15,
2257
+ },
2258
+ _textInput: {
2259
+ height: '100%',
2260
+ color: COLORS.blackColor,
2261
+ fontSize: 13,
2262
+ fontFamily: FONT_NORMAL,
2263
+ width: '85%',
2264
+ },
2265
+ _capsuleMain: {
2266
+ backgroundColor: COLORS.whiteColor,
2267
+ position: 'absolute',
2268
+ // right:0,
2269
+ width: '60%',
2270
+ alignSelf: 'center',
2271
+ top: -10,
2272
+ borderRadius: TEXT_SIZES.BORDER_RADIUS,
2273
+ borderColor: COLORS.gray,
2274
+ borderWidth: 1,
2275
+ paddingHorizontal: 10,
2276
+ alignItems: 'center',
2277
+ },
2278
+ _capsuleText: {
2279
+ color: COLORS.gray,
2280
+ fontFamily: FONT_NORMAL,
2281
+ fontSize: 10,
2282
+ },
2283
+ _editModalMain: {
2284
+ width: WP(90),
2285
+ // height: HP(25),r
2286
+ backgroundColor: COLORS.whiteColor,
2287
+ alignSelf: 'center',
2288
+ borderRadius: TEXT_SIZES.BORDER_RADIUS,
2289
+ justifyContent: 'space-between',
2290
+ alignItems: 'center',
2291
+ paddingVertical: 12,
2292
+ gap: 30,
2293
+ },
2294
+ _modalInput: {
2295
+ width: '95%',
2296
+ height: 48,
2297
+ borderRadius: TEXT_SIZES.BORDER_RADIUS,
2298
+ borderColor: COLORS.gray,
2299
+ borderWidth: 1,
2300
+ paddingLeft: 10,
2301
+ },
2302
+ _modalBtn: {
2303
+ // width: '45%',
2304
+ height: 50,
2305
+ borderRadius: TEXT_SIZES.BORDER_RADIUS,
2306
+ backgroundColor: COLORS.primaryColor,
2307
+ justifyContent: 'center',
2308
+ alignItems: 'center',
2309
+ bottom: 0,
2310
+ },
2311
+ _modalBtnText: {
2312
+ color: COLORS.whiteColor,
2313
+ fontFamily: FONT_NORMAL,
2314
+ fontSize: 14,
2315
+ },
2316
+ _bottomBtn: {
2317
+ width: '100%',
2318
+ height: '90%',
2319
+ backgroundColor: COLORS.primaryColor,
2320
+ justifyContent: 'center',
2321
+ alignItems: 'center',
2322
+ flexDirection: 'row',
2323
+ borderRadius: TEXT_SIZES.BORDER_RADIUS,
2324
+ borderColor: 'red',
2325
+ borderWidth: 1,
2326
+ paddingHorizontal: 20,
2327
+ gap: 10,
2328
+ },
2329
+ _bankName: {
2330
+ color: COLORS.blackColor,
2331
+ fontFamily: FONT_NORMAL,
2332
+ fontSize: 13,
2333
+ marginTop: 15,
2334
+ },
2335
+ InvoiceAmountText: {
2336
+ fontFamily: FONT_NORMAL,
2337
+ fontSize: 13,
2338
+ },
2339
+ _paymentOptionsMain: {
2340
+ width: '100%',
2341
+ // height: 100,
2342
+ // backgroundColor: "red"
2343
+ },
2344
+ _radioMain: {
2345
+ width: '100%',
2346
+ height: 50,
2347
+ // backgroundColor: COLORS.greenColor,
2348
+ flexDirection: 'row',
2349
+ justifyContent: 'space-between',
2350
+ alignItems: 'center',
2351
+ },
2352
+ _radioBtn: {
2353
+ width: '30%',
2354
+ height: '100%',
2355
+ flexDirection: 'row',
2356
+ // justifyContent: "space-between",
2357
+ alignItems: 'center',
2358
+ // backgroundColor: "pink",
2359
+ gap: 10,
2360
+ // paddingHorizontal: 17
2361
+ },
2362
+ _radioText: {
2363
+ fontFamily: FONT_MEDIUM,
2364
+ fontSize: 13,
2365
+ color: COLORS.darkGrey,
2366
+ },
2367
+ _voiceModalMain: {
2368
+ width: WP(90),
2369
+ height: HP(30),
2370
+ backgroundColor: COLORS.whiteColor,
2371
+ justifyContent: 'center',
2372
+ alignItems: 'center',
2373
+ borderRadius: 15,
2374
+ },
2375
+ _voiceBtn: {
2376
+ width: 35,
2377
+ height: 35,
2378
+ borderColor: COLORS.blackColor,
2379
+ borderWidth: 1,
2380
+ borderRadius: 100,
2381
+ justifyContent: 'center',
2382
+ alignItems: 'center',
2383
+ },
2384
+ _modalText: {
2385
+ marginLeft: 10,
2386
+ fontSize: 14,
2387
+ fontFamily: FONT_NORMAL,
2388
+ color: COLORS.blackColor,
2389
+ },
2390
+ _modalBtn2: {
2391
+ flexDirection: 'row',
2392
+ alignItems: 'center',
2393
+ paddingVertical: 12,
2394
+ borderBottomColor: '#eee',
2395
+ borderBottomWidth: 1,
2396
+ },
2397
+ _changeModalMain: {
2398
+ width: WP(90),
2399
+ maxHeight: HP(75),
2400
+ backgroundColor: COLORS.whiteColor,
2401
+ },
2402
+ _changeModalHeader: {
2403
+ width: '100%',
2404
+ height: HP(6),
2405
+ backgroundColor: COLORS.primaryColor,
2406
+ justifyContent: 'center',
2407
+ alignItems: 'center',
2408
+ },
2409
+ _changeModalHeaderTxt: {
2410
+ color: COLORS.whiteColor,
2411
+ fontFamily: FONT_MEDIUM,
2412
+ fontSize: 14,
2413
+ },
2414
+ _modalSearchMain: {
2415
+ width: '100%',
2416
+ justifyContent: 'center',
2417
+ alignItems: 'center',
2418
+ marginVertical: 7.5,
2419
+ },
2420
+ _modalSearch: {
2421
+ width: '92%',
2422
+ height: 50,
2423
+ borderWidth: 1,
2424
+ borderColor: COLORS.gray,
2425
+ borderRadius: TEXT_SIZES.BORDER_RADIUS,
2426
+ paddingLeft: 10,
2427
+ fontFamily: FONT_NORMAL,
2428
+ fontSize: 13,
2429
+ color: COLORS.blackColor,
2430
+ },
2431
+ _avatarText: {
2432
+ fontFamily: FONT_NORMAL,
2433
+ fontSize: 16,
2434
+ color: COLORS.primaryColor,
2435
+ },
2436
+ _addContactBtn: {
2437
+ width: '92%',
2438
+ height: 50,
2439
+ // backgroundColor: "red",
2440
+ flexDirection: 'row',
2441
+ justifyContent: 'space-between',
2442
+ alignItems: 'center',
2443
+ },
2444
+ _contactsCardMain: {
2445
+ width: '92%',
2446
+ height: 50,
2447
+ // backgroundColor: "red",
2448
+ marginVertical: 10,
2449
+ flexDirection: 'row',
2450
+ justifyContent: 'space-between',
2451
+ alignItems: 'center',
2452
+ alignSelf: 'center',
2453
+ },
2454
+ _phoneInputMain: {
2455
+ width: '92%',
2456
+ // height:60,
2457
+ // backgroundColor:"red",
2458
+ alignItems: 'center',
2459
+ gap: 15,
2460
+ },
2461
+
2462
+ bottomBar: {
2463
+ position: 'absolute',
2464
+ left: 0,
2465
+ right: 0,
2466
+ backgroundColor: '#fff',
2467
+ borderTopLeftRadius: TEXT_SIZES.BORDER_RADIUS,
2468
+ borderTopRightRadius: TEXT_SIZES.BORDER_RADIUS,
2469
+ alignItems: 'center',
2470
+ justifyContent: 'center',
2471
+ paddingVertical: 10,
2472
+ elevation: 10,
2473
+ },
2474
+
2475
+ totalButton: {
2476
+ borderWidth: 1,
2477
+ marginBottom: 10,
2478
+ borderColor: COLORS.primaryColor,
2479
+ backgroundColor: COLORS.redColor,
2480
+ borderRadius:100,
2481
+ width: '100%',
2482
+ height: 50,
2483
+ alignItems: 'center',
2484
+ justifyContent: 'center',
2485
+ },
2486
+ totalText: {
2487
+ color: COLORS.whiteColor,
2488
+ fontFamily: FONT_NORMAL,
2489
+ fontSize: 13,
2490
+ },
2491
+ _itemHeaderMain: {
2492
+ width: '100%',
2493
+ height: 40,
2494
+ borderTopColor: COLORS.gray,
2495
+ borderBottomColor: COLORS.gray,
2496
+ borderTopWidth: 0.5,
2497
+ borderBottomWidth: 0.5,
2498
+ // backgroundColor: "red",
2499
+ flexDirection: 'row',
2500
+ justifyContent: 'space-between',
2501
+ alignItems: 'center',
2502
+ // paddingVertical:5
2503
+ },
2504
+ });