From 864b90e6295d58b5135a9857749c5ad61ccabd8f Mon Sep 17 00:00:00 2001 From: Yan Date: Thu, 15 Mar 2018 10:28:22 +0630 Subject: [PATCH 01/61] found receipts in public --- public/receipts/receipt_bill_20180219-75.pdf | 483 ++++++++++++++++++ .../receipt_bill_qwer-20180307-77.pdf | 455 +++++++++++++++++ .../receipt_bill_qwer-20180307-78.pdf | 455 +++++++++++++++++ .../receipt_bill_qwer-20180307-79.pdf | 455 +++++++++++++++++ .../receipt_bill_qwer-20180307-80.pdf | 455 +++++++++++++++++ .../receipt_bill_qwer-20180307-81.pdf | 455 +++++++++++++++++ .../receipt_bill_qwer-20180307-82.pdf | 455 +++++++++++++++++ .../receipt_bill_qwer-20180307-83.pdf | 455 +++++++++++++++++ 8 files changed, 3668 insertions(+) create mode 100644 public/receipts/receipt_bill_20180219-75.pdf create mode 100644 public/receipts/receipt_bill_qwer-20180307-77.pdf create mode 100644 public/receipts/receipt_bill_qwer-20180307-78.pdf create mode 100644 public/receipts/receipt_bill_qwer-20180307-79.pdf create mode 100644 public/receipts/receipt_bill_qwer-20180307-80.pdf create mode 100644 public/receipts/receipt_bill_qwer-20180307-81.pdf create mode 100644 public/receipts/receipt_bill_qwer-20180307-82.pdf create mode 100644 public/receipts/receipt_bill_qwer-20180307-83.pdf diff --git a/public/receipts/receipt_bill_20180219-75.pdf b/public/receipts/receipt_bill_20180219-75.pdf new file mode 100644 index 00000000..95238846 --- /dev/null +++ b/public/receipts/receipt_bill_20180219-75.pdf @@ -0,0 +1,483 @@ +%PDF-1.3 +%ÿÿÿÿ +1 0 obj +<< /Creator +/Producer +>> +endobj +2 0 obj +<< /Type /Catalog +/Pages 3 0 R +>> +endobj +3 0 obj +<< /Type /Pages +/Count 1 +/Kids [5 0 R] +>> +endobj +4 0 obj +<< /Length 4242 +>> +stream +q + +BT +48.975 1417.82 Td +/F1.0 10 Tf +[<4f53414b41204f4853484f2854> 120 <616d77> 10 <6529>] TJ +ET + + +BT +10.268 1402.696 Td +/F1.0 8 Tf +[<4e6f> 40 <2e203235362c204b> 50 <79> 20 <61696b6b6173616e20526f61642c2054> 120 <616d77> 10 <652054> 120 <6f> 15 <776e73686970> 35 <2c2059> 140 <616e676f6e>] TJ +ET + + +BT +71.904 1388.448 Td +/F1.0 8 Tf +[<54> 120 <656c3a2030392d323538363736363131>] TJ +ET + +0.0 1379.944 m +210.0 1379.944 l +S +0.0 1379.944 m +210.0 1379.944 l +S + +BT +0.0 1367.2 Td +/F1.0 8 Tf +[<52656365697074204e6f3a2032303138303231392d3735>] TJ +ET + + +BT +0.0 1347.2 Td +/F1.0 8 Tf +[<54> 120 <6162> 20 <6c65202d207432>] TJ +ET + + +BT +100.0 1347.2 Td +/F1.0 8 Tf +[<573a2043617368696572>] TJ +ET + + +BT +160.216 1347.2 Td +/F1.0 8 Tf +[<433a2043617368696572>] TJ +ET + + +BT +0.0 1327.2 Td +/F1.0 8 Tf +[<44617465203a2031392d30322d323031382831303a323920414d2d31303a333620414d29>] TJ +ET + +0.0 1312.944 m +210.0 1312.944 l +S + +BT +0.0 1302.2 Td +/F1.0 8 Tf +[<4974656d73>] TJ +ET + + +BT +106.656 1302.2 Td +/F1.0 8 Tf +[<5072> -15 <696365>] TJ +ET + + +BT +138.276 1302.2 Td +/F1.0 8 Tf +[<517479>] TJ +ET + + +BT +187.176 1302.2 Td +/F1.0 8 Tf +[<54> 120 <6f74616c>] TJ +ET + +0.0 1292.944 m +210.0 1292.944 l +S + +BT +0.0 1282.2 Td +/F1.0 8 Tf +[<56> 80 <6f646b61202d>] TJ +ET + + +BT +93.864 1282.2 Td +/F1.0 8 Tf +[<31302c3030302e30>] TJ +ET + + +BT +138.94 1282.2 Td +/F1.0 8 Tf +[<312e30>] TJ +ET + + +BT +172.864 1282.2 Td +/F1.0 8 Tf +[<31302c3030302e30>] TJ +ET + + +BT +0.0 1267.952 Td +/F1.0 8 Tf +[<746573745f6974656d31202d>] TJ +ET + + +BT +0.0 1258.704 Td +/F1.0 8 Tf +[<74657374315f736d616c6c>] TJ +ET + + +BT +98.312 1267.952 Td +/F1.0 8 Tf +[<312c3030302e30>] TJ +ET + + +BT +138.94 1267.952 Td +/F1.0 8 Tf +[<312e30>] TJ +ET + + +BT +177.312 1267.952 Td +/F1.0 8 Tf +[<312c3030302e30>] TJ +ET + +0.0 1250.2 m +210.0 1250.2 l +S + +BT +0.0 1239.456 Td +/F1.0 8 Tf +[<5375622054> 120 <6f74616c>] TJ +ET + + +BT +170.864 1239.456 Td +/F1.0 8 Tf +[<31312c3030302e30>] TJ +ET + + +BT +0.0 1225.208 Td +/F1.0 8 Tf +[<4f76> 25 <6572> 10 <616c6c20446973636f756e743a>] TJ +ET + + +BT +181.104 1225.208 Td +/F1.0 8 Tf +[<2820302e302029>] TJ +ET + + +BT +0.0 1210.96 Td +/F1.0 8 Tf +[<536572> -30 <76696365204368617267657320282031302529>] TJ +ET + + +BT +175.312 1210.96 Td +/F1.0 8 Tf +[<312c3130302e30>] TJ +ET + + +BT +0.0 1196.712 Td +/F1.0 8 Tf +[<436f6d6d65726369616c2054> 120 <6178202820352529>] TJ +ET + + +BT +181.984 1196.712 Td +/F1.0 8 Tf +[<3535302e30>] TJ +ET + + +BT +0.0 1181.028 Td +/F2.0 10 Tf +[<4772616e642054> 80 <6f74616c>] TJ +ET + + +BT +163.08 1181.028 Td +/F2.0 10 Tf +[<31322c3635302e30>] TJ +ET + +0.0 1171.308 m +210.0 1171.308 l +S + +BT +0.0 1160.564 Td +/F1.0 8 Tf +[<436173682050> 40 <61> 30 <796d656e74>] TJ +ET + + +BT +170.864 1160.564 Td +/F1.0 8 Tf +[<31322c3635302e30>] TJ +ET + + +BT +0.0 1146.316 Td +/F1.0 8 Tf +[<4368616e676520416d6f756e74>] TJ +ET + + +BT +190.88 1146.316 Td +/F1.0 8 Tf +[<302e30>] TJ +ET + + +BT +0.0 1127.068 Td +/F1.0 8 Tf +[<437573746f6d6572204e616d65>] TJ +ET + + +BT +169.064 1127.068 Td +/F1.0 8 Tf +[<57> 50 <414c4b2d494e>] TJ +ET + +0.0 1118.564 m +210.0 1118.564 l +S + +BT +0.0 1107.82 Td +/F1.0 8 Tf +[<54> 120 <6f74616c2046> 30 <6f6f6420446973636f756e7473>] TJ +ET + + +BT +185.552 1107.82 Td +/F1.0 8 Tf +[<28302e3029>] TJ +ET + + +BT +0.0 1098.572 Td +/F1.0 8 Tf +[<54> 120 <6f74616c204265> 30 <76> 25 <6572> 10 <61676520446973636f756e7473>] TJ +ET + + +BT +185.552 1098.572 Td +/F1.0 8 Tf +[<28302e3029>] TJ +ET + + +BT +0.0 1089.324 Td +/F1.0 8 Tf +[<54> 120 <6f74616c2050726f6475637420446973636f756e7473>] TJ +ET + + +BT +185.552 1089.324 Td +/F1.0 8 Tf +[<28302e3029>] TJ +ET + +0.0 1080.82 m +210.0 1080.82 l +S + +BT +0.0 1070.076 Td +/F1.0 8 Tf +[<46> 30 <6f6f64>] TJ +ET + + +BT +175.312 1070.076 Td +/F1.0 8 Tf +[<312c3030302e30>] TJ +ET + + +BT +0.0 1060.828 Td +/F1.0 8 Tf +[<4265> 30 <76> 25 <6572> 10 <616765>] TJ +ET + + +BT +170.864 1060.828 Td +/F1.0 8 Tf +[<31302c3030302e30>] TJ +ET + + +BT +0.0 1051.58 Td +/F1.0 8 Tf +[<50726f64756374>] TJ +ET + + +BT +190.88 1051.58 Td +/F1.0 8 Tf +[<302e30>] TJ +ET + +0.0 1043.076 m +210.0 1043.076 l +S + +BT +0.0 1031.614 Td +/F1.0 9 Tf +[<53706c69742042696c6c2066> 30 <6f72203020706572736f6e73>] TJ +ET + + +BT +0.0 1017.332 Td +/F1.0 8 Tf +[<416d6f756e7420447565202870657220706572736f6e29>] TJ +ET + + +BT +193.104 1017.332 Td +/F1.0 8 Tf +[<496e66>] TJ +ET + +0.0 1008.828 m +210.0 1008.828 l +S + +BT +0.0 996.648 Td +/F2.0 10 Tf +[<50> 30 <616964>] TJ +ET + + +BT +102.0 998.084 Td +/F1.0 8 Tf +[<5468616e6b2059> 140 <6f7521205365652079> 20 <6f7520416761696e>] TJ +ET + +Q + +endstream +endobj +5 0 obj +<< /Type /Page +/Parent 3 0 R +/MediaBox [0 0 210 1450] +/CropBox [0 0 210 1450] +/BleedBox [0 0 210 1450] +/TrimBox [0 0 210 1450] +/ArtBox [0 0 210 1450] +/Contents 4 0 R +/Resources << /ProcSet [/PDF /Text /ImageB /ImageC /ImageI] +/Font << /F1.0 6 0 R +/F2.0 7 0 R +>> +>> +>> +endobj +6 0 obj +<< /Type /Font +/Subtype /Type1 +/BaseFont /Helvetica +/Encoding /WinAnsiEncoding +>> +endobj +7 0 obj +<< /Type /Font +/Subtype /Type1 +/BaseFont /Helvetica-Bold +/Encoding /WinAnsiEncoding +>> +endobj +xref +0 8 +0000000000 65535 f +0000000015 00000 n +0000000109 00000 n +0000000158 00000 n +0000000215 00000 n +0000004509 00000 n +0000004792 00000 n +0000004889 00000 n +trailer +<< /Size 8 +/Root 2 0 R +/Info 1 0 R +>> +startxref +4991 +%%EOF diff --git a/public/receipts/receipt_bill_qwer-20180307-77.pdf b/public/receipts/receipt_bill_qwer-20180307-77.pdf new file mode 100644 index 00000000..13df612b --- /dev/null +++ b/public/receipts/receipt_bill_qwer-20180307-77.pdf @@ -0,0 +1,455 @@ +%PDF-1.3 +%ÿÿÿÿ +1 0 obj +<< /Creator +/Producer +>> +endobj +2 0 obj +<< /Type /Catalog +/Pages 3 0 R +>> +endobj +3 0 obj +<< /Type /Pages +/Count 1 +/Kids [5 0 R] +>> +endobj +4 0 obj +<< /Length 4003 +>> +stream +q + +BT +48.975 1417.82 Td +/F1.0 10 Tf +[<4f53414b41204f4853484f2854> 120 <616d77> 10 <6529>] TJ +ET + + +BT +10.268 1402.696 Td +/F1.0 8 Tf +[<4e6f> 40 <2e203235362c204b> 50 <79> 20 <61696b6b6173616e20526f61642c2054> 120 <616d77> 10 <652054> 120 <6f> 15 <776e73686970> 35 <2c2059> 140 <616e676f6e>] TJ +ET + + +BT +71.904 1388.448 Td +/F1.0 8 Tf +[<54> 120 <656c3a2030392d323538363736363131>] TJ +ET + +0.0 1379.944 m +210.0 1379.944 l +S +0.0 1379.944 m +210.0 1379.944 l +S + +BT +0.0 1367.2 Td +/F1.0 8 Tf +[<52656365697074204e6f3a207177> 10 <65722d32303138303330372d3737>] TJ +ET + + +BT +0.0 1347.2 Td +/F1.0 8 Tf +[<54> 120 <6162> 20 <6c65202d207431>] TJ +ET + + +BT +100.0 1347.2 Td +/F1.0 8 Tf +[<573a2043617368696572>] TJ +ET + + +BT +160.216 1347.2 Td +/F1.0 8 Tf +[<433a2043617368696572>] TJ +ET + + +BT +0.0 1327.2 Td +/F1.0 8 Tf +[<44617465203a2030372d30332d323031382830353a333320504d2d30353a353020504d29>] TJ +ET + +0.0 1312.944 m +210.0 1312.944 l +S + +BT +0.0 1302.2 Td +/F1.0 8 Tf +[<4974656d73>] TJ +ET + + +BT +106.656 1302.2 Td +/F1.0 8 Tf +[<5072> -15 <696365>] TJ +ET + + +BT +138.276 1302.2 Td +/F1.0 8 Tf +[<517479>] TJ +ET + + +BT +187.176 1302.2 Td +/F1.0 8 Tf +[<54> 120 <6f74616c>] TJ +ET + +0.0 1292.944 m +210.0 1292.944 l +S + +BT +0.0 1282.2 Td +/F1.0 8 Tf +[<746573745f6974656d31202d>] TJ +ET + + +BT +0.0 1272.952 Td +/F1.0 8 Tf +[<74657374315f736d616c6c>] TJ +ET + + +BT +98.312 1282.2 Td +/F1.0 8 Tf +[<312c3030302e30>] TJ +ET + + +BT +138.94 1282.2 Td +/F1.0 8 Tf +[<312e30>] TJ +ET + + +BT +177.312 1282.2 Td +/F1.0 8 Tf +[<312c3030302e30>] TJ +ET + +0.0 1264.448 m +210.0 1264.448 l +S + +BT +0.0 1253.704 Td +/F1.0 8 Tf +[<5375622054> 120 <6f74616c>] TJ +ET + + +BT +175.312 1253.704 Td +/F1.0 8 Tf +[<312c3030302e30>] TJ +ET + + +BT +0.0 1239.456 Td +/F1.0 8 Tf +[<4f76> 25 <6572> 10 <616c6c20446973636f756e743a>] TJ +ET + + +BT +181.104 1239.456 Td +/F1.0 8 Tf +[<2820302e302029>] TJ +ET + + +BT +0.0 1225.208 Td +/F1.0 8 Tf +[<536572> -30 <76696365204368617267657320282031302529>] TJ +ET + + +BT +181.984 1225.208 Td +/F1.0 8 Tf +[<3130302e30>] TJ +ET + + +BT +0.0 1210.96 Td +/F1.0 8 Tf +[<436f6d6d65726369616c2054> 120 <6178202820352529>] TJ +ET + + +BT +186.432 1210.96 Td +/F1.0 8 Tf +[<35302e30>] TJ +ET + + +BT +0.0 1195.276 Td +/F2.0 10 Tf +[<4772616e642054> 80 <6f74616c>] TJ +ET + + +BT +168.64 1195.276 Td +/F2.0 10 Tf +[<312c3135302e30>] TJ +ET + +0.0 1185.556 m +210.0 1185.556 l +S + +BT +0.0 1174.812 Td +/F1.0 8 Tf +[<436173682050> 40 <61> 30 <796d656e74>] TJ +ET + + +BT +175.312 1174.812 Td +/F1.0 8 Tf +[<312c3135302e30>] TJ +ET + + +BT +0.0 1160.564 Td +/F1.0 8 Tf +[<4368616e676520416d6f756e74>] TJ +ET + + +BT +190.88 1160.564 Td +/F1.0 8 Tf +[<302e30>] TJ +ET + + +BT +0.0 1141.316 Td +/F1.0 8 Tf +[<437573746f6d6572204e616d65>] TJ +ET + + +BT +169.064 1141.316 Td +/F1.0 8 Tf +[<57> 50 <414c4b2d494e>] TJ +ET + +0.0 1132.812 m +210.0 1132.812 l +S + +BT +0.0 1122.068 Td +/F1.0 8 Tf +[<54> 120 <6f74616c2046> 30 <6f6f6420446973636f756e7473>] TJ +ET + + +BT +185.552 1122.068 Td +/F1.0 8 Tf +[<28302e3029>] TJ +ET + + +BT +0.0 1112.82 Td +/F1.0 8 Tf +[<54> 120 <6f74616c204265> 30 <76> 25 <6572> 10 <61676520446973636f756e7473>] TJ +ET + + +BT +185.552 1112.82 Td +/F1.0 8 Tf +[<28302e3029>] TJ +ET + + +BT +0.0 1103.572 Td +/F1.0 8 Tf +[<54> 120 <6f74616c2050726f6475637420446973636f756e7473>] TJ +ET + + +BT +185.552 1103.572 Td +/F1.0 8 Tf +[<28302e3029>] TJ +ET + +0.0 1095.068 m +210.0 1095.068 l +S + +BT +0.0 1084.324 Td +/F1.0 8 Tf +[<46> 30 <6f6f64>] TJ +ET + + +BT +175.312 1084.324 Td +/F1.0 8 Tf +[<312c3030302e30>] TJ +ET + + +BT +0.0 1075.076 Td +/F1.0 8 Tf +[<4265> 30 <76> 25 <6572> 10 <616765>] TJ +ET + + +BT +190.88 1075.076 Td +/F1.0 8 Tf +[<302e30>] TJ +ET + + +BT +0.0 1065.828 Td +/F1.0 8 Tf +[<50726f64756374>] TJ +ET + + +BT +190.88 1065.828 Td +/F1.0 8 Tf +[<302e30>] TJ +ET + +0.0 1057.324 m +210.0 1057.324 l +S + +BT +0.0 1045.862 Td +/F1.0 9 Tf +[<53706c69742042696c6c2066> 30 <6f72203020706572736f6e73>] TJ +ET + + +BT +0.0 1031.58 Td +/F1.0 8 Tf +[<416d6f756e7420447565202870657220706572736f6e29>] TJ +ET + + +BT +193.104 1031.58 Td +/F1.0 8 Tf +[<496e66>] TJ +ET + +0.0 1023.076 m +210.0 1023.076 l +S + +BT +0.0 1010.896 Td +/F2.0 10 Tf +[<50> 30 <616964>] TJ +ET + + +BT +102.0 1012.332 Td +/F1.0 8 Tf +[<5468616e6b2059> 140 <6f7521205365652079> 20 <6f7520416761696e>] TJ +ET + +Q + +endstream +endobj +5 0 obj +<< /Type /Page +/Parent 3 0 R +/MediaBox [0 0 210 1450] +/CropBox [0 0 210 1450] +/BleedBox [0 0 210 1450] +/TrimBox [0 0 210 1450] +/ArtBox [0 0 210 1450] +/Contents 4 0 R +/Resources << /ProcSet [/PDF /Text /ImageB /ImageC /ImageI] +/Font << /F1.0 6 0 R +/F2.0 7 0 R +>> +>> +>> +endobj +6 0 obj +<< /Type /Font +/Subtype /Type1 +/BaseFont /Helvetica +/Encoding /WinAnsiEncoding +>> +endobj +7 0 obj +<< /Type /Font +/Subtype /Type1 +/BaseFont /Helvetica-Bold +/Encoding /WinAnsiEncoding +>> +endobj +xref +0 8 +0000000000 65535 f +0000000015 00000 n +0000000109 00000 n +0000000158 00000 n +0000000215 00000 n +0000004270 00000 n +0000004553 00000 n +0000004650 00000 n +trailer +<< /Size 8 +/Root 2 0 R +/Info 1 0 R +>> +startxref +4752 +%%EOF diff --git a/public/receipts/receipt_bill_qwer-20180307-78.pdf b/public/receipts/receipt_bill_qwer-20180307-78.pdf new file mode 100644 index 00000000..0167d798 --- /dev/null +++ b/public/receipts/receipt_bill_qwer-20180307-78.pdf @@ -0,0 +1,455 @@ +%PDF-1.3 +%ÿÿÿÿ +1 0 obj +<< /Creator +/Producer +>> +endobj +2 0 obj +<< /Type /Catalog +/Pages 3 0 R +>> +endobj +3 0 obj +<< /Type /Pages +/Count 1 +/Kids [5 0 R] +>> +endobj +4 0 obj +<< /Length 4003 +>> +stream +q + +BT +48.975 1417.82 Td +/F1.0 10 Tf +[<4f53414b41204f4853484f2854> 120 <616d77> 10 <6529>] TJ +ET + + +BT +10.268 1402.696 Td +/F1.0 8 Tf +[<4e6f> 40 <2e203235362c204b> 50 <79> 20 <61696b6b6173616e20526f61642c2054> 120 <616d77> 10 <652054> 120 <6f> 15 <776e73686970> 35 <2c2059> 140 <616e676f6e>] TJ +ET + + +BT +71.904 1388.448 Td +/F1.0 8 Tf +[<54> 120 <656c3a2030392d323538363736363131>] TJ +ET + +0.0 1379.944 m +210.0 1379.944 l +S +0.0 1379.944 m +210.0 1379.944 l +S + +BT +0.0 1367.2 Td +/F1.0 8 Tf +[<52656365697074204e6f3a207177> 10 <65722d32303138303330372d3738>] TJ +ET + + +BT +0.0 1347.2 Td +/F1.0 8 Tf +[<54> 120 <6162> 20 <6c65202d207431>] TJ +ET + + +BT +100.0 1347.2 Td +/F1.0 8 Tf +[<573a2043617368696572>] TJ +ET + + +BT +160.216 1347.2 Td +/F1.0 8 Tf +[<433a2043617368696572>] TJ +ET + + +BT +0.0 1327.2 Td +/F1.0 8 Tf +[<44617465203a2030372d30332d323031382830363a303320504d2d30363a303420504d29>] TJ +ET + +0.0 1312.944 m +210.0 1312.944 l +S + +BT +0.0 1302.2 Td +/F1.0 8 Tf +[<4974656d73>] TJ +ET + + +BT +106.656 1302.2 Td +/F1.0 8 Tf +[<5072> -15 <696365>] TJ +ET + + +BT +138.276 1302.2 Td +/F1.0 8 Tf +[<517479>] TJ +ET + + +BT +187.176 1302.2 Td +/F1.0 8 Tf +[<54> 120 <6f74616c>] TJ +ET + +0.0 1292.944 m +210.0 1292.944 l +S + +BT +0.0 1282.2 Td +/F1.0 8 Tf +[<746573745f6974656d31202d>] TJ +ET + + +BT +0.0 1272.952 Td +/F1.0 8 Tf +[<74657374315f736d616c6c>] TJ +ET + + +BT +98.312 1282.2 Td +/F1.0 8 Tf +[<312c3030302e30>] TJ +ET + + +BT +138.94 1282.2 Td +/F1.0 8 Tf +[<312e30>] TJ +ET + + +BT +177.312 1282.2 Td +/F1.0 8 Tf +[<312c3030302e30>] TJ +ET + +0.0 1264.448 m +210.0 1264.448 l +S + +BT +0.0 1253.704 Td +/F1.0 8 Tf +[<5375622054> 120 <6f74616c>] TJ +ET + + +BT +175.312 1253.704 Td +/F1.0 8 Tf +[<312c3030302e30>] TJ +ET + + +BT +0.0 1239.456 Td +/F1.0 8 Tf +[<4f76> 25 <6572> 10 <616c6c20446973636f756e743a>] TJ +ET + + +BT +181.104 1239.456 Td +/F1.0 8 Tf +[<2820302e302029>] TJ +ET + + +BT +0.0 1225.208 Td +/F1.0 8 Tf +[<536572> -30 <76696365204368617267657320282031302529>] TJ +ET + + +BT +181.984 1225.208 Td +/F1.0 8 Tf +[<3130302e30>] TJ +ET + + +BT +0.0 1210.96 Td +/F1.0 8 Tf +[<436f6d6d65726369616c2054> 120 <6178202820352529>] TJ +ET + + +BT +186.432 1210.96 Td +/F1.0 8 Tf +[<35302e30>] TJ +ET + + +BT +0.0 1195.276 Td +/F2.0 10 Tf +[<4772616e642054> 80 <6f74616c>] TJ +ET + + +BT +168.64 1195.276 Td +/F2.0 10 Tf +[<312c3135302e30>] TJ +ET + +0.0 1185.556 m +210.0 1185.556 l +S + +BT +0.0 1174.812 Td +/F1.0 8 Tf +[<436173682050> 40 <61> 30 <796d656e74>] TJ +ET + + +BT +175.312 1174.812 Td +/F1.0 8 Tf +[<312c3135302e30>] TJ +ET + + +BT +0.0 1160.564 Td +/F1.0 8 Tf +[<4368616e676520416d6f756e74>] TJ +ET + + +BT +190.88 1160.564 Td +/F1.0 8 Tf +[<302e30>] TJ +ET + + +BT +0.0 1141.316 Td +/F1.0 8 Tf +[<437573746f6d6572204e616d65>] TJ +ET + + +BT +169.064 1141.316 Td +/F1.0 8 Tf +[<57> 50 <414c4b2d494e>] TJ +ET + +0.0 1132.812 m +210.0 1132.812 l +S + +BT +0.0 1122.068 Td +/F1.0 8 Tf +[<54> 120 <6f74616c2046> 30 <6f6f6420446973636f756e7473>] TJ +ET + + +BT +185.552 1122.068 Td +/F1.0 8 Tf +[<28302e3029>] TJ +ET + + +BT +0.0 1112.82 Td +/F1.0 8 Tf +[<54> 120 <6f74616c204265> 30 <76> 25 <6572> 10 <61676520446973636f756e7473>] TJ +ET + + +BT +185.552 1112.82 Td +/F1.0 8 Tf +[<28302e3029>] TJ +ET + + +BT +0.0 1103.572 Td +/F1.0 8 Tf +[<54> 120 <6f74616c2050726f6475637420446973636f756e7473>] TJ +ET + + +BT +185.552 1103.572 Td +/F1.0 8 Tf +[<28302e3029>] TJ +ET + +0.0 1095.068 m +210.0 1095.068 l +S + +BT +0.0 1084.324 Td +/F1.0 8 Tf +[<46> 30 <6f6f64>] TJ +ET + + +BT +175.312 1084.324 Td +/F1.0 8 Tf +[<312c3030302e30>] TJ +ET + + +BT +0.0 1075.076 Td +/F1.0 8 Tf +[<4265> 30 <76> 25 <6572> 10 <616765>] TJ +ET + + +BT +190.88 1075.076 Td +/F1.0 8 Tf +[<302e30>] TJ +ET + + +BT +0.0 1065.828 Td +/F1.0 8 Tf +[<50726f64756374>] TJ +ET + + +BT +190.88 1065.828 Td +/F1.0 8 Tf +[<302e30>] TJ +ET + +0.0 1057.324 m +210.0 1057.324 l +S + +BT +0.0 1045.862 Td +/F1.0 9 Tf +[<53706c69742042696c6c2066> 30 <6f72203020706572736f6e73>] TJ +ET + + +BT +0.0 1031.58 Td +/F1.0 8 Tf +[<416d6f756e7420447565202870657220706572736f6e29>] TJ +ET + + +BT +193.104 1031.58 Td +/F1.0 8 Tf +[<496e66>] TJ +ET + +0.0 1023.076 m +210.0 1023.076 l +S + +BT +0.0 1010.896 Td +/F2.0 10 Tf +[<50> 30 <616964>] TJ +ET + + +BT +102.0 1012.332 Td +/F1.0 8 Tf +[<5468616e6b2059> 140 <6f7521205365652079> 20 <6f7520416761696e>] TJ +ET + +Q + +endstream +endobj +5 0 obj +<< /Type /Page +/Parent 3 0 R +/MediaBox [0 0 210 1450] +/CropBox [0 0 210 1450] +/BleedBox [0 0 210 1450] +/TrimBox [0 0 210 1450] +/ArtBox [0 0 210 1450] +/Contents 4 0 R +/Resources << /ProcSet [/PDF /Text /ImageB /ImageC /ImageI] +/Font << /F1.0 6 0 R +/F2.0 7 0 R +>> +>> +>> +endobj +6 0 obj +<< /Type /Font +/Subtype /Type1 +/BaseFont /Helvetica +/Encoding /WinAnsiEncoding +>> +endobj +7 0 obj +<< /Type /Font +/Subtype /Type1 +/BaseFont /Helvetica-Bold +/Encoding /WinAnsiEncoding +>> +endobj +xref +0 8 +0000000000 65535 f +0000000015 00000 n +0000000109 00000 n +0000000158 00000 n +0000000215 00000 n +0000004270 00000 n +0000004553 00000 n +0000004650 00000 n +trailer +<< /Size 8 +/Root 2 0 R +/Info 1 0 R +>> +startxref +4752 +%%EOF diff --git a/public/receipts/receipt_bill_qwer-20180307-79.pdf b/public/receipts/receipt_bill_qwer-20180307-79.pdf new file mode 100644 index 00000000..8720c5b6 --- /dev/null +++ b/public/receipts/receipt_bill_qwer-20180307-79.pdf @@ -0,0 +1,455 @@ +%PDF-1.3 +%ÿÿÿÿ +1 0 obj +<< /Creator +/Producer +>> +endobj +2 0 obj +<< /Type /Catalog +/Pages 3 0 R +>> +endobj +3 0 obj +<< /Type /Pages +/Count 1 +/Kids [5 0 R] +>> +endobj +4 0 obj +<< /Length 4003 +>> +stream +q + +BT +48.975 1417.82 Td +/F1.0 10 Tf +[<4f53414b41204f4853484f2854> 120 <616d77> 10 <6529>] TJ +ET + + +BT +10.268 1402.696 Td +/F1.0 8 Tf +[<4e6f> 40 <2e203235362c204b> 50 <79> 20 <61696b6b6173616e20526f61642c2054> 120 <616d77> 10 <652054> 120 <6f> 15 <776e73686970> 35 <2c2059> 140 <616e676f6e>] TJ +ET + + +BT +71.904 1388.448 Td +/F1.0 8 Tf +[<54> 120 <656c3a2030392d323538363736363131>] TJ +ET + +0.0 1379.944 m +210.0 1379.944 l +S +0.0 1379.944 m +210.0 1379.944 l +S + +BT +0.0 1367.2 Td +/F1.0 8 Tf +[<52656365697074204e6f3a207177> 10 <65722d32303138303330372d3739>] TJ +ET + + +BT +0.0 1347.2 Td +/F1.0 8 Tf +[<54> 120 <6162> 20 <6c65202d207432>] TJ +ET + + +BT +100.0 1347.2 Td +/F1.0 8 Tf +[<573a2043617368696572>] TJ +ET + + +BT +160.216 1347.2 Td +/F1.0 8 Tf +[<433a2043617368696572>] TJ +ET + + +BT +0.0 1327.2 Td +/F1.0 8 Tf +[<44617465203a2030372d30332d323031382830363a303620504d2d30363a303620504d29>] TJ +ET + +0.0 1312.944 m +210.0 1312.944 l +S + +BT +0.0 1302.2 Td +/F1.0 8 Tf +[<4974656d73>] TJ +ET + + +BT +106.656 1302.2 Td +/F1.0 8 Tf +[<5072> -15 <696365>] TJ +ET + + +BT +138.276 1302.2 Td +/F1.0 8 Tf +[<517479>] TJ +ET + + +BT +187.176 1302.2 Td +/F1.0 8 Tf +[<54> 120 <6f74616c>] TJ +ET + +0.0 1292.944 m +210.0 1292.944 l +S + +BT +0.0 1282.2 Td +/F1.0 8 Tf +[<746573745f6974656d31202d>] TJ +ET + + +BT +0.0 1272.952 Td +/F1.0 8 Tf +[<74657374315f736d616c6c>] TJ +ET + + +BT +98.312 1282.2 Td +/F1.0 8 Tf +[<312c3030302e30>] TJ +ET + + +BT +138.94 1282.2 Td +/F1.0 8 Tf +[<312e30>] TJ +ET + + +BT +177.312 1282.2 Td +/F1.0 8 Tf +[<312c3030302e30>] TJ +ET + +0.0 1264.448 m +210.0 1264.448 l +S + +BT +0.0 1253.704 Td +/F1.0 8 Tf +[<5375622054> 120 <6f74616c>] TJ +ET + + +BT +175.312 1253.704 Td +/F1.0 8 Tf +[<312c3030302e30>] TJ +ET + + +BT +0.0 1239.456 Td +/F1.0 8 Tf +[<4f76> 25 <6572> 10 <616c6c20446973636f756e743a>] TJ +ET + + +BT +181.104 1239.456 Td +/F1.0 8 Tf +[<2820302e302029>] TJ +ET + + +BT +0.0 1225.208 Td +/F1.0 8 Tf +[<536572> -30 <76696365204368617267657320282031302529>] TJ +ET + + +BT +181.984 1225.208 Td +/F1.0 8 Tf +[<3130302e30>] TJ +ET + + +BT +0.0 1210.96 Td +/F1.0 8 Tf +[<436f6d6d65726369616c2054> 120 <6178202820352529>] TJ +ET + + +BT +186.432 1210.96 Td +/F1.0 8 Tf +[<35302e30>] TJ +ET + + +BT +0.0 1195.276 Td +/F2.0 10 Tf +[<4772616e642054> 80 <6f74616c>] TJ +ET + + +BT +168.64 1195.276 Td +/F2.0 10 Tf +[<312c3135302e30>] TJ +ET + +0.0 1185.556 m +210.0 1185.556 l +S + +BT +0.0 1174.812 Td +/F1.0 8 Tf +[<436173682050> 40 <61> 30 <796d656e74>] TJ +ET + + +BT +175.312 1174.812 Td +/F1.0 8 Tf +[<312c3135302e30>] TJ +ET + + +BT +0.0 1160.564 Td +/F1.0 8 Tf +[<4368616e676520416d6f756e74>] TJ +ET + + +BT +190.88 1160.564 Td +/F1.0 8 Tf +[<302e30>] TJ +ET + + +BT +0.0 1141.316 Td +/F1.0 8 Tf +[<437573746f6d6572204e616d65>] TJ +ET + + +BT +169.064 1141.316 Td +/F1.0 8 Tf +[<57> 50 <414c4b2d494e>] TJ +ET + +0.0 1132.812 m +210.0 1132.812 l +S + +BT +0.0 1122.068 Td +/F1.0 8 Tf +[<54> 120 <6f74616c2046> 30 <6f6f6420446973636f756e7473>] TJ +ET + + +BT +185.552 1122.068 Td +/F1.0 8 Tf +[<28302e3029>] TJ +ET + + +BT +0.0 1112.82 Td +/F1.0 8 Tf +[<54> 120 <6f74616c204265> 30 <76> 25 <6572> 10 <61676520446973636f756e7473>] TJ +ET + + +BT +185.552 1112.82 Td +/F1.0 8 Tf +[<28302e3029>] TJ +ET + + +BT +0.0 1103.572 Td +/F1.0 8 Tf +[<54> 120 <6f74616c2050726f6475637420446973636f756e7473>] TJ +ET + + +BT +185.552 1103.572 Td +/F1.0 8 Tf +[<28302e3029>] TJ +ET + +0.0 1095.068 m +210.0 1095.068 l +S + +BT +0.0 1084.324 Td +/F1.0 8 Tf +[<46> 30 <6f6f64>] TJ +ET + + +BT +175.312 1084.324 Td +/F1.0 8 Tf +[<312c3030302e30>] TJ +ET + + +BT +0.0 1075.076 Td +/F1.0 8 Tf +[<4265> 30 <76> 25 <6572> 10 <616765>] TJ +ET + + +BT +190.88 1075.076 Td +/F1.0 8 Tf +[<302e30>] TJ +ET + + +BT +0.0 1065.828 Td +/F1.0 8 Tf +[<50726f64756374>] TJ +ET + + +BT +190.88 1065.828 Td +/F1.0 8 Tf +[<302e30>] TJ +ET + +0.0 1057.324 m +210.0 1057.324 l +S + +BT +0.0 1045.862 Td +/F1.0 9 Tf +[<53706c69742042696c6c2066> 30 <6f72203020706572736f6e73>] TJ +ET + + +BT +0.0 1031.58 Td +/F1.0 8 Tf +[<416d6f756e7420447565202870657220706572736f6e29>] TJ +ET + + +BT +193.104 1031.58 Td +/F1.0 8 Tf +[<496e66>] TJ +ET + +0.0 1023.076 m +210.0 1023.076 l +S + +BT +0.0 1010.896 Td +/F2.0 10 Tf +[<50> 30 <616964>] TJ +ET + + +BT +102.0 1012.332 Td +/F1.0 8 Tf +[<5468616e6b2059> 140 <6f7521205365652079> 20 <6f7520416761696e>] TJ +ET + +Q + +endstream +endobj +5 0 obj +<< /Type /Page +/Parent 3 0 R +/MediaBox [0 0 210 1450] +/CropBox [0 0 210 1450] +/BleedBox [0 0 210 1450] +/TrimBox [0 0 210 1450] +/ArtBox [0 0 210 1450] +/Contents 4 0 R +/Resources << /ProcSet [/PDF /Text /ImageB /ImageC /ImageI] +/Font << /F1.0 6 0 R +/F2.0 7 0 R +>> +>> +>> +endobj +6 0 obj +<< /Type /Font +/Subtype /Type1 +/BaseFont /Helvetica +/Encoding /WinAnsiEncoding +>> +endobj +7 0 obj +<< /Type /Font +/Subtype /Type1 +/BaseFont /Helvetica-Bold +/Encoding /WinAnsiEncoding +>> +endobj +xref +0 8 +0000000000 65535 f +0000000015 00000 n +0000000109 00000 n +0000000158 00000 n +0000000215 00000 n +0000004270 00000 n +0000004553 00000 n +0000004650 00000 n +trailer +<< /Size 8 +/Root 2 0 R +/Info 1 0 R +>> +startxref +4752 +%%EOF diff --git a/public/receipts/receipt_bill_qwer-20180307-80.pdf b/public/receipts/receipt_bill_qwer-20180307-80.pdf new file mode 100644 index 00000000..e1ecd3dd --- /dev/null +++ b/public/receipts/receipt_bill_qwer-20180307-80.pdf @@ -0,0 +1,455 @@ +%PDF-1.3 +%ÿÿÿÿ +1 0 obj +<< /Creator +/Producer +>> +endobj +2 0 obj +<< /Type /Catalog +/Pages 3 0 R +>> +endobj +3 0 obj +<< /Type /Pages +/Count 1 +/Kids [5 0 R] +>> +endobj +4 0 obj +<< /Length 4003 +>> +stream +q + +BT +48.975 1417.82 Td +/F1.0 10 Tf +[<4f53414b41204f4853484f2854> 120 <616d77> 10 <6529>] TJ +ET + + +BT +10.268 1402.696 Td +/F1.0 8 Tf +[<4e6f> 40 <2e203235362c204b> 50 <79> 20 <61696b6b6173616e20526f61642c2054> 120 <616d77> 10 <652054> 120 <6f> 15 <776e73686970> 35 <2c2059> 140 <616e676f6e>] TJ +ET + + +BT +71.904 1388.448 Td +/F1.0 8 Tf +[<54> 120 <656c3a2030392d323538363736363131>] TJ +ET + +0.0 1379.944 m +210.0 1379.944 l +S +0.0 1379.944 m +210.0 1379.944 l +S + +BT +0.0 1367.2 Td +/F1.0 8 Tf +[<52656365697074204e6f3a207177> 10 <65722d32303138303330372d3830>] TJ +ET + + +BT +0.0 1347.2 Td +/F1.0 8 Tf +[<54> 120 <6162> 20 <6c65202d207432>] TJ +ET + + +BT +100.0 1347.2 Td +/F1.0 8 Tf +[<573a2043617368696572>] TJ +ET + + +BT +160.216 1347.2 Td +/F1.0 8 Tf +[<433a2043617368696572>] TJ +ET + + +BT +0.0 1327.2 Td +/F1.0 8 Tf +[<44617465203a2030372d30332d323031382830363a303720504d2d30363a303720504d29>] TJ +ET + +0.0 1312.944 m +210.0 1312.944 l +S + +BT +0.0 1302.2 Td +/F1.0 8 Tf +[<4974656d73>] TJ +ET + + +BT +106.656 1302.2 Td +/F1.0 8 Tf +[<5072> -15 <696365>] TJ +ET + + +BT +138.276 1302.2 Td +/F1.0 8 Tf +[<517479>] TJ +ET + + +BT +187.176 1302.2 Td +/F1.0 8 Tf +[<54> 120 <6f74616c>] TJ +ET + +0.0 1292.944 m +210.0 1292.944 l +S + +BT +0.0 1282.2 Td +/F1.0 8 Tf +[<746573745f6974656d31202d>] TJ +ET + + +BT +0.0 1272.952 Td +/F1.0 8 Tf +[<74657374315f736d616c6c>] TJ +ET + + +BT +98.312 1282.2 Td +/F1.0 8 Tf +[<312c3030302e30>] TJ +ET + + +BT +138.94 1282.2 Td +/F1.0 8 Tf +[<312e30>] TJ +ET + + +BT +177.312 1282.2 Td +/F1.0 8 Tf +[<312c3030302e30>] TJ +ET + +0.0 1264.448 m +210.0 1264.448 l +S + +BT +0.0 1253.704 Td +/F1.0 8 Tf +[<5375622054> 120 <6f74616c>] TJ +ET + + +BT +175.312 1253.704 Td +/F1.0 8 Tf +[<312c3030302e30>] TJ +ET + + +BT +0.0 1239.456 Td +/F1.0 8 Tf +[<4f76> 25 <6572> 10 <616c6c20446973636f756e743a>] TJ +ET + + +BT +181.104 1239.456 Td +/F1.0 8 Tf +[<2820302e302029>] TJ +ET + + +BT +0.0 1225.208 Td +/F1.0 8 Tf +[<536572> -30 <76696365204368617267657320282031302529>] TJ +ET + + +BT +181.984 1225.208 Td +/F1.0 8 Tf +[<3130302e30>] TJ +ET + + +BT +0.0 1210.96 Td +/F1.0 8 Tf +[<436f6d6d65726369616c2054> 120 <6178202820352529>] TJ +ET + + +BT +186.432 1210.96 Td +/F1.0 8 Tf +[<35302e30>] TJ +ET + + +BT +0.0 1195.276 Td +/F2.0 10 Tf +[<4772616e642054> 80 <6f74616c>] TJ +ET + + +BT +168.64 1195.276 Td +/F2.0 10 Tf +[<312c3135302e30>] TJ +ET + +0.0 1185.556 m +210.0 1185.556 l +S + +BT +0.0 1174.812 Td +/F1.0 8 Tf +[<436173682050> 40 <61> 30 <796d656e74>] TJ +ET + + +BT +175.312 1174.812 Td +/F1.0 8 Tf +[<312c3135302e30>] TJ +ET + + +BT +0.0 1160.564 Td +/F1.0 8 Tf +[<4368616e676520416d6f756e74>] TJ +ET + + +BT +190.88 1160.564 Td +/F1.0 8 Tf +[<302e30>] TJ +ET + + +BT +0.0 1141.316 Td +/F1.0 8 Tf +[<437573746f6d6572204e616d65>] TJ +ET + + +BT +169.064 1141.316 Td +/F1.0 8 Tf +[<57> 50 <414c4b2d494e>] TJ +ET + +0.0 1132.812 m +210.0 1132.812 l +S + +BT +0.0 1122.068 Td +/F1.0 8 Tf +[<54> 120 <6f74616c2046> 30 <6f6f6420446973636f756e7473>] TJ +ET + + +BT +185.552 1122.068 Td +/F1.0 8 Tf +[<28302e3029>] TJ +ET + + +BT +0.0 1112.82 Td +/F1.0 8 Tf +[<54> 120 <6f74616c204265> 30 <76> 25 <6572> 10 <61676520446973636f756e7473>] TJ +ET + + +BT +185.552 1112.82 Td +/F1.0 8 Tf +[<28302e3029>] TJ +ET + + +BT +0.0 1103.572 Td +/F1.0 8 Tf +[<54> 120 <6f74616c2050726f6475637420446973636f756e7473>] TJ +ET + + +BT +185.552 1103.572 Td +/F1.0 8 Tf +[<28302e3029>] TJ +ET + +0.0 1095.068 m +210.0 1095.068 l +S + +BT +0.0 1084.324 Td +/F1.0 8 Tf +[<46> 30 <6f6f64>] TJ +ET + + +BT +175.312 1084.324 Td +/F1.0 8 Tf +[<312c3030302e30>] TJ +ET + + +BT +0.0 1075.076 Td +/F1.0 8 Tf +[<4265> 30 <76> 25 <6572> 10 <616765>] TJ +ET + + +BT +190.88 1075.076 Td +/F1.0 8 Tf +[<302e30>] TJ +ET + + +BT +0.0 1065.828 Td +/F1.0 8 Tf +[<50726f64756374>] TJ +ET + + +BT +190.88 1065.828 Td +/F1.0 8 Tf +[<302e30>] TJ +ET + +0.0 1057.324 m +210.0 1057.324 l +S + +BT +0.0 1045.862 Td +/F1.0 9 Tf +[<53706c69742042696c6c2066> 30 <6f72203020706572736f6e73>] TJ +ET + + +BT +0.0 1031.58 Td +/F1.0 8 Tf +[<416d6f756e7420447565202870657220706572736f6e29>] TJ +ET + + +BT +193.104 1031.58 Td +/F1.0 8 Tf +[<496e66>] TJ +ET + +0.0 1023.076 m +210.0 1023.076 l +S + +BT +0.0 1010.896 Td +/F2.0 10 Tf +[<50> 30 <616964>] TJ +ET + + +BT +102.0 1012.332 Td +/F1.0 8 Tf +[<5468616e6b2059> 140 <6f7521205365652079> 20 <6f7520416761696e>] TJ +ET + +Q + +endstream +endobj +5 0 obj +<< /Type /Page +/Parent 3 0 R +/MediaBox [0 0 210 1450] +/CropBox [0 0 210 1450] +/BleedBox [0 0 210 1450] +/TrimBox [0 0 210 1450] +/ArtBox [0 0 210 1450] +/Contents 4 0 R +/Resources << /ProcSet [/PDF /Text /ImageB /ImageC /ImageI] +/Font << /F1.0 6 0 R +/F2.0 7 0 R +>> +>> +>> +endobj +6 0 obj +<< /Type /Font +/Subtype /Type1 +/BaseFont /Helvetica +/Encoding /WinAnsiEncoding +>> +endobj +7 0 obj +<< /Type /Font +/Subtype /Type1 +/BaseFont /Helvetica-Bold +/Encoding /WinAnsiEncoding +>> +endobj +xref +0 8 +0000000000 65535 f +0000000015 00000 n +0000000109 00000 n +0000000158 00000 n +0000000215 00000 n +0000004270 00000 n +0000004553 00000 n +0000004650 00000 n +trailer +<< /Size 8 +/Root 2 0 R +/Info 1 0 R +>> +startxref +4752 +%%EOF diff --git a/public/receipts/receipt_bill_qwer-20180307-81.pdf b/public/receipts/receipt_bill_qwer-20180307-81.pdf new file mode 100644 index 00000000..c2c35188 --- /dev/null +++ b/public/receipts/receipt_bill_qwer-20180307-81.pdf @@ -0,0 +1,455 @@ +%PDF-1.3 +%ÿÿÿÿ +1 0 obj +<< /Creator +/Producer +>> +endobj +2 0 obj +<< /Type /Catalog +/Pages 3 0 R +>> +endobj +3 0 obj +<< /Type /Pages +/Count 1 +/Kids [5 0 R] +>> +endobj +4 0 obj +<< /Length 4005 +>> +stream +q + +BT +48.975 1417.82 Td +/F1.0 10 Tf +[<4f53414b41204f4853484f2854> 120 <616d77> 10 <6529>] TJ +ET + + +BT +10.268 1402.696 Td +/F1.0 8 Tf +[<4e6f> 40 <2e203235362c204b> 50 <79> 20 <61696b6b6173616e20526f61642c2054> 120 <616d77> 10 <652054> 120 <6f> 15 <776e73686970> 35 <2c2059> 140 <616e676f6e>] TJ +ET + + +BT +71.904 1388.448 Td +/F1.0 8 Tf +[<54> 120 <656c3a2030392d323538363736363131>] TJ +ET + +0.0 1379.944 m +210.0 1379.944 l +S +0.0 1379.944 m +210.0 1379.944 l +S + +BT +0.0 1367.2 Td +/F1.0 8 Tf +[<52656365697074204e6f3a207177> 10 <65722d32303138303330372d3831>] TJ +ET + + +BT +0.0 1347.2 Td +/F1.0 8 Tf +[<54> 120 <6162> 20 <6c65202d207432>] TJ +ET + + +BT +100.0 1347.2 Td +/F1.0 8 Tf +[<573a2043617368696572>] TJ +ET + + +BT +160.216 1347.2 Td +/F1.0 8 Tf +[<433a2043617368696572>] TJ +ET + + +BT +0.0 1327.2 Td +/F1.0 8 Tf +[<44617465203a2030372d30332d323031382830363a303920504d2d30363a303920504d29>] TJ +ET + +0.0 1312.944 m +210.0 1312.944 l +S + +BT +0.0 1302.2 Td +/F1.0 8 Tf +[<4974656d73>] TJ +ET + + +BT +106.656 1302.2 Td +/F1.0 8 Tf +[<5072> -15 <696365>] TJ +ET + + +BT +138.276 1302.2 Td +/F1.0 8 Tf +[<517479>] TJ +ET + + +BT +187.176 1302.2 Td +/F1.0 8 Tf +[<54> 120 <6f74616c>] TJ +ET + +0.0 1292.944 m +210.0 1292.944 l +S + +BT +0.0 1282.2 Td +/F1.0 8 Tf +[<746573745f6974656d32202d>] TJ +ET + + +BT +0.0 1272.952 Td +/F1.0 8 Tf +[<74657374315f736d616c32>] TJ +ET + + +BT +98.312 1282.2 Td +/F1.0 8 Tf +[<322c3032302e30>] TJ +ET + + +BT +138.94 1282.2 Td +/F1.0 8 Tf +[<312e30>] TJ +ET + + +BT +177.312 1282.2 Td +/F1.0 8 Tf +[<322c3032302e30>] TJ +ET + +0.0 1264.448 m +210.0 1264.448 l +S + +BT +0.0 1253.704 Td +/F1.0 8 Tf +[<5375622054> 120 <6f74616c>] TJ +ET + + +BT +175.312 1253.704 Td +/F1.0 8 Tf +[<322c3032302e30>] TJ +ET + + +BT +0.0 1239.456 Td +/F1.0 8 Tf +[<4f76> 25 <6572> 10 <616c6c20446973636f756e743a>] TJ +ET + + +BT +181.104 1239.456 Td +/F1.0 8 Tf +[<2820302e302029>] TJ +ET + + +BT +0.0 1225.208 Td +/F1.0 8 Tf +[<536572> -30 <76696365204368617267657320282031302529>] TJ +ET + + +BT +181.984 1225.208 Td +/F1.0 8 Tf +[<3230322e30>] TJ +ET + + +BT +0.0 1210.96 Td +/F1.0 8 Tf +[<436f6d6d65726369616c2054> 120 <6178202820352529>] TJ +ET + + +BT +181.984 1210.96 Td +/F1.0 8 Tf +[<3130312e30>] TJ +ET + + +BT +0.0 1195.276 Td +/F2.0 10 Tf +[<4772616e642054> 80 <6f74616c>] TJ +ET + + +BT +168.64 1195.276 Td +/F2.0 10 Tf +[<322c3332332e30>] TJ +ET + +0.0 1185.556 m +210.0 1185.556 l +S + +BT +0.0 1174.812 Td +/F1.0 8 Tf +[<436173682050> 40 <61> 30 <796d656e74>] TJ +ET + + +BT +175.312 1174.812 Td +/F1.0 8 Tf +[<322c3332332e30>] TJ +ET + + +BT +0.0 1160.564 Td +/F1.0 8 Tf +[<4368616e676520416d6f756e74>] TJ +ET + + +BT +190.88 1160.564 Td +/F1.0 8 Tf +[<302e30>] TJ +ET + + +BT +0.0 1141.316 Td +/F1.0 8 Tf +[<437573746f6d6572204e616d65>] TJ +ET + + +BT +169.064 1141.316 Td +/F1.0 8 Tf +[<57> 50 <414c4b2d494e>] TJ +ET + +0.0 1132.812 m +210.0 1132.812 l +S + +BT +0.0 1122.068 Td +/F1.0 8 Tf +[<54> 120 <6f74616c2046> 30 <6f6f6420446973636f756e7473>] TJ +ET + + +BT +185.552 1122.068 Td +/F1.0 8 Tf +[<28302e3029>] TJ +ET + + +BT +0.0 1112.82 Td +/F1.0 8 Tf +[<54> 120 <6f74616c204265> 30 <76> 25 <6572> 10 <61676520446973636f756e7473>] TJ +ET + + +BT +185.552 1112.82 Td +/F1.0 8 Tf +[<28302e3029>] TJ +ET + + +BT +0.0 1103.572 Td +/F1.0 8 Tf +[<54> 120 <6f74616c2050726f6475637420446973636f756e7473>] TJ +ET + + +BT +185.552 1103.572 Td +/F1.0 8 Tf +[<28302e3029>] TJ +ET + +0.0 1095.068 m +210.0 1095.068 l +S + +BT +0.0 1084.324 Td +/F1.0 8 Tf +[<46> 30 <6f6f64>] TJ +ET + + +BT +175.312 1084.324 Td +/F1.0 8 Tf +[<322c3032302e30>] TJ +ET + + +BT +0.0 1075.076 Td +/F1.0 8 Tf +[<4265> 30 <76> 25 <6572> 10 <616765>] TJ +ET + + +BT +190.88 1075.076 Td +/F1.0 8 Tf +[<302e30>] TJ +ET + + +BT +0.0 1065.828 Td +/F1.0 8 Tf +[<50726f64756374>] TJ +ET + + +BT +190.88 1065.828 Td +/F1.0 8 Tf +[<302e30>] TJ +ET + +0.0 1057.324 m +210.0 1057.324 l +S + +BT +0.0 1045.862 Td +/F1.0 9 Tf +[<53706c69742042696c6c2066> 30 <6f72203020706572736f6e73>] TJ +ET + + +BT +0.0 1031.58 Td +/F1.0 8 Tf +[<416d6f756e7420447565202870657220706572736f6e29>] TJ +ET + + +BT +193.104 1031.58 Td +/F1.0 8 Tf +[<496e66>] TJ +ET + +0.0 1023.076 m +210.0 1023.076 l +S + +BT +0.0 1010.896 Td +/F2.0 10 Tf +[<50> 30 <616964>] TJ +ET + + +BT +102.0 1012.332 Td +/F1.0 8 Tf +[<5468616e6b2059> 140 <6f7521205365652079> 20 <6f7520416761696e>] TJ +ET + +Q + +endstream +endobj +5 0 obj +<< /Type /Page +/Parent 3 0 R +/MediaBox [0 0 210 1450] +/CropBox [0 0 210 1450] +/BleedBox [0 0 210 1450] +/TrimBox [0 0 210 1450] +/ArtBox [0 0 210 1450] +/Contents 4 0 R +/Resources << /ProcSet [/PDF /Text /ImageB /ImageC /ImageI] +/Font << /F1.0 6 0 R +/F2.0 7 0 R +>> +>> +>> +endobj +6 0 obj +<< /Type /Font +/Subtype /Type1 +/BaseFont /Helvetica +/Encoding /WinAnsiEncoding +>> +endobj +7 0 obj +<< /Type /Font +/Subtype /Type1 +/BaseFont /Helvetica-Bold +/Encoding /WinAnsiEncoding +>> +endobj +xref +0 8 +0000000000 65535 f +0000000015 00000 n +0000000109 00000 n +0000000158 00000 n +0000000215 00000 n +0000004272 00000 n +0000004555 00000 n +0000004652 00000 n +trailer +<< /Size 8 +/Root 2 0 R +/Info 1 0 R +>> +startxref +4754 +%%EOF diff --git a/public/receipts/receipt_bill_qwer-20180307-82.pdf b/public/receipts/receipt_bill_qwer-20180307-82.pdf new file mode 100644 index 00000000..088b1130 --- /dev/null +++ b/public/receipts/receipt_bill_qwer-20180307-82.pdf @@ -0,0 +1,455 @@ +%PDF-1.3 +%ÿÿÿÿ +1 0 obj +<< /Creator +/Producer +>> +endobj +2 0 obj +<< /Type /Catalog +/Pages 3 0 R +>> +endobj +3 0 obj +<< /Type /Pages +/Count 1 +/Kids [5 0 R] +>> +endobj +4 0 obj +<< /Length 4012 +>> +stream +q + +BT +48.975 1417.82 Td +/F1.0 10 Tf +[<4f53414b41204f4853484f2854> 120 <616d77> 10 <6529>] TJ +ET + + +BT +10.268 1402.696 Td +/F1.0 8 Tf +[<4e6f> 40 <2e203235362c204b> 50 <79> 20 <61696b6b6173616e20526f61642c2054> 120 <616d77> 10 <652054> 120 <6f> 15 <776e73686970> 35 <2c2059> 140 <616e676f6e>] TJ +ET + + +BT +71.904 1388.448 Td +/F1.0 8 Tf +[<54> 120 <656c3a2030392d323538363736363131>] TJ +ET + +0.0 1379.944 m +210.0 1379.944 l +S +0.0 1379.944 m +210.0 1379.944 l +S + +BT +0.0 1367.2 Td +/F1.0 8 Tf +[<52656365697074204e6f3a207177> 10 <65722d32303138303330372d3832>] TJ +ET + + +BT +0.0 1347.2 Td +/F1.0 8 Tf +[<54> 120 <6162> 20 <6c65202d207431>] TJ +ET + + +BT +100.0 1347.2 Td +/F1.0 8 Tf +[<573a2043617368696572>] TJ +ET + + +BT +160.216 1347.2 Td +/F1.0 8 Tf +[<433a2043617368696572>] TJ +ET + + +BT +0.0 1327.2 Td +/F1.0 8 Tf +[<44617465203a2030372d30332d323031382830363a313320504d2d30363a313320504d29>] TJ +ET + +0.0 1312.944 m +210.0 1312.944 l +S + +BT +0.0 1302.2 Td +/F1.0 8 Tf +[<4974656d73>] TJ +ET + + +BT +106.656 1302.2 Td +/F1.0 8 Tf +[<5072> -15 <696365>] TJ +ET + + +BT +138.276 1302.2 Td +/F1.0 8 Tf +[<517479>] TJ +ET + + +BT +187.176 1302.2 Td +/F1.0 8 Tf +[<54> 120 <6f74616c>] TJ +ET + +0.0 1292.944 m +210.0 1292.944 l +S + +BT +0.0 1282.2 Td +/F1.0 8 Tf +[<746573745f6974656d31202d>] TJ +ET + + +BT +0.0 1272.952 Td +/F1.0 8 Tf +[<74657374315f736d616c6c>] TJ +ET + + +BT +98.312 1282.2 Td +/F1.0 8 Tf +[<312c3030302e30>] TJ +ET + + +BT +138.94 1282.2 Td +/F1.0 8 Tf +[<312e30>] TJ +ET + + +BT +177.312 1282.2 Td +/F1.0 8 Tf +[<312c3030302e30>] TJ +ET + +0.0 1264.448 m +210.0 1264.448 l +S + +BT +0.0 1253.704 Td +/F1.0 8 Tf +[<5375622054> 120 <6f74616c>] TJ +ET + + +BT +175.312 1253.704 Td +/F1.0 8 Tf +[<312c3030302e30>] TJ +ET + + +BT +0.0 1239.456 Td +/F1.0 8 Tf +[<4f76> 25 <6572> 10 <616c6c20446973636f756e743a>] TJ +ET + + +BT +181.104 1239.456 Td +/F1.0 8 Tf +[<2820302e302029>] TJ +ET + + +BT +0.0 1225.208 Td +/F1.0 8 Tf +[<536572> -30 <76696365204368617267657320282031302529>] TJ +ET + + +BT +181.984 1225.208 Td +/F1.0 8 Tf +[<3130302e30>] TJ +ET + + +BT +0.0 1210.96 Td +/F1.0 8 Tf +[<436f6d6d65726369616c2054> 120 <6178202820352529>] TJ +ET + + +BT +186.432 1210.96 Td +/F1.0 8 Tf +[<35302e30>] TJ +ET + + +BT +0.0 1195.276 Td +/F2.0 10 Tf +[<4772616e642054> 80 <6f74616c>] TJ +ET + + +BT +168.64 1195.276 Td +/F2.0 10 Tf +[<312c3135302e30>] TJ +ET + +0.0 1185.556 m +210.0 1185.556 l +S + +BT +0.0 1174.812 Td +/F1.0 8 Tf +[<436173682050> 40 <61> 30 <796d656e74>] TJ +ET + + +BT +175.312 1174.812 Td +/F1.0 8 Tf +[<322c3330302e30>] TJ +ET + + +BT +0.0 1160.564 Td +/F1.0 8 Tf +[<4368616e676520416d6f756e74>] TJ +ET + + +BT +175.312 1160.564 Td +/F1.0 8 Tf +[<312c3135302e30>] TJ +ET + + +BT +0.0 1141.316 Td +/F1.0 8 Tf +[<437573746f6d6572204e616d65>] TJ +ET + + +BT +169.064 1141.316 Td +/F1.0 8 Tf +[<57> 50 <414c4b2d494e>] TJ +ET + +0.0 1132.812 m +210.0 1132.812 l +S + +BT +0.0 1122.068 Td +/F1.0 8 Tf +[<54> 120 <6f74616c2046> 30 <6f6f6420446973636f756e7473>] TJ +ET + + +BT +185.552 1122.068 Td +/F1.0 8 Tf +[<28302e3029>] TJ +ET + + +BT +0.0 1112.82 Td +/F1.0 8 Tf +[<54> 120 <6f74616c204265> 30 <76> 25 <6572> 10 <61676520446973636f756e7473>] TJ +ET + + +BT +185.552 1112.82 Td +/F1.0 8 Tf +[<28302e3029>] TJ +ET + + +BT +0.0 1103.572 Td +/F1.0 8 Tf +[<54> 120 <6f74616c2050726f6475637420446973636f756e7473>] TJ +ET + + +BT +185.552 1103.572 Td +/F1.0 8 Tf +[<28302e3029>] TJ +ET + +0.0 1095.068 m +210.0 1095.068 l +S + +BT +0.0 1084.324 Td +/F1.0 8 Tf +[<46> 30 <6f6f64>] TJ +ET + + +BT +175.312 1084.324 Td +/F1.0 8 Tf +[<312c3030302e30>] TJ +ET + + +BT +0.0 1075.076 Td +/F1.0 8 Tf +[<4265> 30 <76> 25 <6572> 10 <616765>] TJ +ET + + +BT +190.88 1075.076 Td +/F1.0 8 Tf +[<302e30>] TJ +ET + + +BT +0.0 1065.828 Td +/F1.0 8 Tf +[<50726f64756374>] TJ +ET + + +BT +190.88 1065.828 Td +/F1.0 8 Tf +[<302e30>] TJ +ET + +0.0 1057.324 m +210.0 1057.324 l +S + +BT +0.0 1045.862 Td +/F1.0 9 Tf +[<53706c69742042696c6c2066> 30 <6f72203020706572736f6e73>] TJ +ET + + +BT +0.0 1031.58 Td +/F1.0 8 Tf +[<416d6f756e7420447565202870657220706572736f6e29>] TJ +ET + + +BT +193.104 1031.58 Td +/F1.0 8 Tf +[<496e66>] TJ +ET + +0.0 1023.076 m +210.0 1023.076 l +S + +BT +0.0 1010.896 Td +/F2.0 10 Tf +[<50> 30 <616964>] TJ +ET + + +BT +102.0 1012.332 Td +/F1.0 8 Tf +[<5468616e6b2059> 140 <6f7521205365652079> 20 <6f7520416761696e>] TJ +ET + +Q + +endstream +endobj +5 0 obj +<< /Type /Page +/Parent 3 0 R +/MediaBox [0 0 210 1450] +/CropBox [0 0 210 1450] +/BleedBox [0 0 210 1450] +/TrimBox [0 0 210 1450] +/ArtBox [0 0 210 1450] +/Contents 4 0 R +/Resources << /ProcSet [/PDF /Text /ImageB /ImageC /ImageI] +/Font << /F1.0 6 0 R +/F2.0 7 0 R +>> +>> +>> +endobj +6 0 obj +<< /Type /Font +/Subtype /Type1 +/BaseFont /Helvetica +/Encoding /WinAnsiEncoding +>> +endobj +7 0 obj +<< /Type /Font +/Subtype /Type1 +/BaseFont /Helvetica-Bold +/Encoding /WinAnsiEncoding +>> +endobj +xref +0 8 +0000000000 65535 f +0000000015 00000 n +0000000109 00000 n +0000000158 00000 n +0000000215 00000 n +0000004279 00000 n +0000004562 00000 n +0000004659 00000 n +trailer +<< /Size 8 +/Root 2 0 R +/Info 1 0 R +>> +startxref +4761 +%%EOF diff --git a/public/receipts/receipt_bill_qwer-20180307-83.pdf b/public/receipts/receipt_bill_qwer-20180307-83.pdf new file mode 100644 index 00000000..ebac5da2 --- /dev/null +++ b/public/receipts/receipt_bill_qwer-20180307-83.pdf @@ -0,0 +1,455 @@ +%PDF-1.3 +%ÿÿÿÿ +1 0 obj +<< /Creator +/Producer +>> +endobj +2 0 obj +<< /Type /Catalog +/Pages 3 0 R +>> +endobj +3 0 obj +<< /Type /Pages +/Count 1 +/Kids [5 0 R] +>> +endobj +4 0 obj +<< /Length 4003 +>> +stream +q + +BT +48.975 1417.82 Td +/F1.0 10 Tf +[<4f53414b41204f4853484f2854> 120 <616d77> 10 <6529>] TJ +ET + + +BT +10.268 1402.696 Td +/F1.0 8 Tf +[<4e6f> 40 <2e203235362c204b> 50 <79> 20 <61696b6b6173616e20526f61642c2054> 120 <616d77> 10 <652054> 120 <6f> 15 <776e73686970> 35 <2c2059> 140 <616e676f6e>] TJ +ET + + +BT +71.904 1388.448 Td +/F1.0 8 Tf +[<54> 120 <656c3a2030392d323538363736363131>] TJ +ET + +0.0 1379.944 m +210.0 1379.944 l +S +0.0 1379.944 m +210.0 1379.944 l +S + +BT +0.0 1367.2 Td +/F1.0 8 Tf +[<52656365697074204e6f3a207177> 10 <65722d32303138303330372d3833>] TJ +ET + + +BT +0.0 1347.2 Td +/F1.0 8 Tf +[<54> 120 <6162> 20 <6c65202d207431>] TJ +ET + + +BT +100.0 1347.2 Td +/F1.0 8 Tf +[<573a2043617368696572>] TJ +ET + + +BT +160.216 1347.2 Td +/F1.0 8 Tf +[<433a2043617368696572>] TJ +ET + + +BT +0.0 1327.2 Td +/F1.0 8 Tf +[<44617465203a2030372d30332d323031382830363a313720504d2d30363a313720504d29>] TJ +ET + +0.0 1312.944 m +210.0 1312.944 l +S + +BT +0.0 1302.2 Td +/F1.0 8 Tf +[<4974656d73>] TJ +ET + + +BT +106.656 1302.2 Td +/F1.0 8 Tf +[<5072> -15 <696365>] TJ +ET + + +BT +138.276 1302.2 Td +/F1.0 8 Tf +[<517479>] TJ +ET + + +BT +187.176 1302.2 Td +/F1.0 8 Tf +[<54> 120 <6f74616c>] TJ +ET + +0.0 1292.944 m +210.0 1292.944 l +S + +BT +0.0 1282.2 Td +/F1.0 8 Tf +[<746573745f6974656d31202d>] TJ +ET + + +BT +0.0 1272.952 Td +/F1.0 8 Tf +[<74657374315f736d616c6c>] TJ +ET + + +BT +98.312 1282.2 Td +/F1.0 8 Tf +[<312c3030302e30>] TJ +ET + + +BT +138.94 1282.2 Td +/F1.0 8 Tf +[<312e30>] TJ +ET + + +BT +177.312 1282.2 Td +/F1.0 8 Tf +[<312c3030302e30>] TJ +ET + +0.0 1264.448 m +210.0 1264.448 l +S + +BT +0.0 1253.704 Td +/F1.0 8 Tf +[<5375622054> 120 <6f74616c>] TJ +ET + + +BT +175.312 1253.704 Td +/F1.0 8 Tf +[<312c3030302e30>] TJ +ET + + +BT +0.0 1239.456 Td +/F1.0 8 Tf +[<4f76> 25 <6572> 10 <616c6c20446973636f756e743a>] TJ +ET + + +BT +181.104 1239.456 Td +/F1.0 8 Tf +[<2820302e302029>] TJ +ET + + +BT +0.0 1225.208 Td +/F1.0 8 Tf +[<536572> -30 <76696365204368617267657320282031302529>] TJ +ET + + +BT +181.984 1225.208 Td +/F1.0 8 Tf +[<3130302e30>] TJ +ET + + +BT +0.0 1210.96 Td +/F1.0 8 Tf +[<436f6d6d65726369616c2054> 120 <6178202820352529>] TJ +ET + + +BT +186.432 1210.96 Td +/F1.0 8 Tf +[<35302e30>] TJ +ET + + +BT +0.0 1195.276 Td +/F2.0 10 Tf +[<4772616e642054> 80 <6f74616c>] TJ +ET + + +BT +168.64 1195.276 Td +/F2.0 10 Tf +[<312c3135302e30>] TJ +ET + +0.0 1185.556 m +210.0 1185.556 l +S + +BT +0.0 1174.812 Td +/F1.0 8 Tf +[<436173682050> 40 <61> 30 <796d656e74>] TJ +ET + + +BT +175.312 1174.812 Td +/F1.0 8 Tf +[<312c3135302e30>] TJ +ET + + +BT +0.0 1160.564 Td +/F1.0 8 Tf +[<4368616e676520416d6f756e74>] TJ +ET + + +BT +190.88 1160.564 Td +/F1.0 8 Tf +[<302e30>] TJ +ET + + +BT +0.0 1141.316 Td +/F1.0 8 Tf +[<437573746f6d6572204e616d65>] TJ +ET + + +BT +169.064 1141.316 Td +/F1.0 8 Tf +[<57> 50 <414c4b2d494e>] TJ +ET + +0.0 1132.812 m +210.0 1132.812 l +S + +BT +0.0 1122.068 Td +/F1.0 8 Tf +[<54> 120 <6f74616c2046> 30 <6f6f6420446973636f756e7473>] TJ +ET + + +BT +185.552 1122.068 Td +/F1.0 8 Tf +[<28302e3029>] TJ +ET + + +BT +0.0 1112.82 Td +/F1.0 8 Tf +[<54> 120 <6f74616c204265> 30 <76> 25 <6572> 10 <61676520446973636f756e7473>] TJ +ET + + +BT +185.552 1112.82 Td +/F1.0 8 Tf +[<28302e3029>] TJ +ET + + +BT +0.0 1103.572 Td +/F1.0 8 Tf +[<54> 120 <6f74616c2050726f6475637420446973636f756e7473>] TJ +ET + + +BT +185.552 1103.572 Td +/F1.0 8 Tf +[<28302e3029>] TJ +ET + +0.0 1095.068 m +210.0 1095.068 l +S + +BT +0.0 1084.324 Td +/F1.0 8 Tf +[<46> 30 <6f6f64>] TJ +ET + + +BT +175.312 1084.324 Td +/F1.0 8 Tf +[<312c3030302e30>] TJ +ET + + +BT +0.0 1075.076 Td +/F1.0 8 Tf +[<4265> 30 <76> 25 <6572> 10 <616765>] TJ +ET + + +BT +190.88 1075.076 Td +/F1.0 8 Tf +[<302e30>] TJ +ET + + +BT +0.0 1065.828 Td +/F1.0 8 Tf +[<50726f64756374>] TJ +ET + + +BT +190.88 1065.828 Td +/F1.0 8 Tf +[<302e30>] TJ +ET + +0.0 1057.324 m +210.0 1057.324 l +S + +BT +0.0 1045.862 Td +/F1.0 9 Tf +[<53706c69742042696c6c2066> 30 <6f72203020706572736f6e73>] TJ +ET + + +BT +0.0 1031.58 Td +/F1.0 8 Tf +[<416d6f756e7420447565202870657220706572736f6e29>] TJ +ET + + +BT +193.104 1031.58 Td +/F1.0 8 Tf +[<496e66>] TJ +ET + +0.0 1023.076 m +210.0 1023.076 l +S + +BT +0.0 1010.896 Td +/F2.0 10 Tf +[<50> 30 <616964>] TJ +ET + + +BT +102.0 1012.332 Td +/F1.0 8 Tf +[<5468616e6b2059> 140 <6f7521205365652079> 20 <6f7520416761696e>] TJ +ET + +Q + +endstream +endobj +5 0 obj +<< /Type /Page +/Parent 3 0 R +/MediaBox [0 0 210 1450] +/CropBox [0 0 210 1450] +/BleedBox [0 0 210 1450] +/TrimBox [0 0 210 1450] +/ArtBox [0 0 210 1450] +/Contents 4 0 R +/Resources << /ProcSet [/PDF /Text /ImageB /ImageC /ImageI] +/Font << /F1.0 6 0 R +/F2.0 7 0 R +>> +>> +>> +endobj +6 0 obj +<< /Type /Font +/Subtype /Type1 +/BaseFont /Helvetica +/Encoding /WinAnsiEncoding +>> +endobj +7 0 obj +<< /Type /Font +/Subtype /Type1 +/BaseFont /Helvetica-Bold +/Encoding /WinAnsiEncoding +>> +endobj +xref +0 8 +0000000000 65535 f +0000000015 00000 n +0000000109 00000 n +0000000158 00000 n +0000000215 00000 n +0000004270 00000 n +0000004553 00000 n +0000004650 00000 n +trailer +<< /Size 8 +/Root 2 0 R +/Info 1 0 R +>> +startxref +4752 +%%EOF From 28c23bb50d06cb0f86dc444cc214545aba98712b Mon Sep 17 00:00:00 2001 From: Yan Date: Thu, 15 Mar 2018 11:16:31 +0630 Subject: [PATCH 02/61] check bill --- app/pdf/receipt_bill_pdf.rb | 218 ++++++++++++++++++------------------ 1 file changed, 108 insertions(+), 110 deletions(-) diff --git a/app/pdf/receipt_bill_pdf.rb b/app/pdf/receipt_bill_pdf.rb index efc85c7f..6b8b33af 100755 --- a/app/pdf/receipt_bill_pdf.rb +++ b/app/pdf/receipt_bill_pdf.rb @@ -1,111 +1,113 @@ class ReceiptBillPdf < Prawn::Document - include ActionView::Helpers::NumberHelper + include ActionView::Helpers::NumberHelper - attr_accessor :label_width,:price_column_width,:page_width, :page_height, :margin, :price_width, :item_width, :header_font_size, :item_font_size,:item_height,:qty_width,:total_width,:item_description_width, :description_width, :price_num_width, :line_move - def initialize(printer_settings, sale_items, sale_data, customer_name, item_price_by_accounts, discount_price_by_accounts, member_info = nil,rebate_amount = nil,shop_details, printed_status,current_balance,card_data) - self.page_width = printer_settings.page_width - self.page_height = printer_settings.page_height - self.margin = 0 - self.price_width = 60 - self.qty_width = 25 - self.total_width = 60 - self.item_width = self.page_width - ((self.qty_width + self.price_width + self.total_width)) - self.item_height = 15 - self.item_description_width = (self.page_width-5) / 2 - self.label_width = 100 + attr_accessor :label_width,:price_column_width,:page_width, :page_height, :margin, :price_width, :item_width, :header_font_size, :item_font_size,:item_height,:qty_width,:total_width,:item_description_width, :description_width, :price_num_width, :line_move + + def initialize(printer_settings, sale_items, sale_data, customer_name, item_price_by_accounts, discount_price_by_accounts, member_info = nil,rebate_amount = nil,shop_details, printed_status,current_balance,card_data) + self.page_width = printer_settings.page_width + self.page_height = printer_settings.page_height + self.margin = 0 + self.price_width = 60 + self.qty_width = 25 + self.total_width = 60 + self.item_width = self.page_width - ((self.qty_width + self.price_width + self.total_width)) + self.item_height = 15 + self.item_description_width = (self.page_width-5) / 2 + self.label_width = 100 - self.description_width = 150 - self.price_num_width = 50 - self.line_move = 2 - # @item_width = self.page_width.to_i / 2 - # @qty_width = @item_width.to_i / 3 - # @double = @qty_width * 1.3 - # @half_qty = @qty_width / 2 - #setting page margin and width - super(:margin => [printer_settings.heading_space, self.margin, self.margin, self.margin], :page_size => [self.page_width, self.page_height]) + self.description_width = 150 + self.price_num_width = 50 + self.line_move = 2 + # @item_width = self.page_width.to_i / 2 + # @qty_width = @item_width.to_i / 3 + # @double = @qty_width * 1.3 + # @half_qty = @qty_width / 2 + #setting page margin and width + super(:margin => [printer_settings.heading_space, self.margin, self.margin, self.margin]) - #precision checked - if printer_settings.precision.to_i > 2 - printer_settings.precision = 2 + #precision checked + if printer_settings.precision.to_i > 2 + printer_settings.precision = 2 + end + + # db font setup + if printer_settings.font != "" + font_families.update("#{printer_settings.font}" => { + :normal => "public/fonts/#{printer_settings.font}.ttf", + :italic => "public/fonts/#{printer_settings.font}.ttf", + :bold => "public/fonts/#{printer_settings.font}.ttf", + :bold_italic => "public/fonts/#{printer_settings.font}.ttf" + }) + + font "#{printer_settings.font}" + fallback_fonts ["Courier", "Helvetica", "Times-Roman"] + end + # font "public/fonts/Zawgyi-One.ttf" + # font "public/fonts/padauk.ttf" + self.header_font_size = 10 + self.item_font_size = 8 + + if printer_settings.delimiter + delimiter = "," + else + delimiter = "" + end + + header(shop_details) + + stroke_horizontal_rule + + cashier_info(sale_data, customer_name) + line_items(sale_items,printer_settings.precision,delimiter) + all_total(sale_data,printer_settings.precision,delimiter) + + + if member_info != nil + member_info(member_info,customer_name,rebate_amount,sale_data,printer_settings.precision,delimiter,current_balance) + end + + customer(customer_name) + + #start card sale trans data + if card_data != nil + card_sale_data(card_data) + end + #end card sale trans data + + if discount_price_by_accounts.length > 0 && shop_details.show_account_info + discount_account(discount_price_by_accounts,printer_settings.precision,delimiter) + end + + if shop_details.show_account_info + items_account(item_price_by_accounts,printer_settings.precision,delimiter) + end + + #start for individual payment + if !sale_data.equal_persons.nil? + individual_payment(sale_data, printer_settings.precision, delimiter) + end + #end for individual payment + + sign(sale_data) + + footer(printed_status) end - # db font setup - if printer_settings.font != "" - font_families.update("#{printer_settings.font}" => { - :normal => "public/fonts/#{printer_settings.font}.ttf", - :italic => "public/fonts/#{printer_settings.font}.ttf", - :bold => "public/fonts/#{printer_settings.font}.ttf", - :bold_italic => "public/fonts/#{printer_settings.font}.ttf" - }) - - font "#{printer_settings.font}" - fallback_fonts ["Courier", "Helvetica", "Times-Roman"] - end - # font "public/fonts/Zawgyi-One.ttf" - # font "public/fonts/padauk.ttf" - self.header_font_size = 10 - self.item_font_size = 8 - - if printer_settings.delimiter - delimiter = "," - else - delimiter = "" - end - - header(shop_details) - - stroke_horizontal_rule - - cashier_info(sale_data, customer_name) - line_items(sale_items,printer_settings.precision,delimiter) - all_total(sale_data,printer_settings.precision,delimiter) - - - if member_info != nil - member_info(member_info,customer_name,rebate_amount,sale_data,printer_settings.precision,delimiter,current_balance) - end - - customer(customer_name) - - #start card sale trans data - if card_data != nil - card_sale_data(card_data) - end - #end card sale trans data - - if discount_price_by_accounts.length > 0 && shop_details.show_account_info - discount_account(discount_price_by_accounts,printer_settings.precision,delimiter) - end - - if shop_details.show_account_info - items_account(item_price_by_accounts,printer_settings.precision,delimiter) - end - - #start for individual payment - if !sale_data.equal_persons.nil? - individual_payment(sale_data, printer_settings.precision, delimiter) - end - #end for individual payment - - sign(sale_data) - - footer(printed_status) - end - - def header (shop_details) - text "#{shop_details.name}", :left_margin => -10, :size => self.header_font_size,:align => :center - move_down line_move - text "#{shop_details.address}", :size => self.item_font_size,:align => :center - # move_down self.item_height - move_down line_move - text "#{shop_details.phone_no}", :size => self.item_font_size,:align => :center - move_down line_move - - stroke_horizontal_rule - end - - def cashier_info(sale_data, customer_name) + def header (shop_details) + text "#{shop_details.name}", :left_margin => -10, :size => self.header_font_size,:align => :center move_down line_move + text "#{shop_details.address}", :size => self.item_font_size,:align => :center + # move_down self.item_height + move_down line_move + text "#{shop_details.phone_no}", :size => self.item_font_size,:align => :center + move_down line_move + + stroke_horizontal_rule + end + + def cashier_info(sale_data, customer_name) + move_down line_move + # move_down 2 y_position = cursor bounding_box([0,y_position], :width =>self.description_width + self.price_num_width, :height => self.item_height) do @@ -117,7 +119,7 @@ class ReceiptBillPdf < Prawn::Document text "#{ sale_data.bookings[0].dining_facility.type } - #{ sale_data.bookings[0].dining_facility.name }" , :size => self.item_font_size,:align => :right end end - + move_down line_move y_position = cursor @@ -141,12 +143,11 @@ class ReceiptBillPdf < Prawn::Document else time = sale_data.receipt_date.strftime('%d-%m-%Y %H:%M %p') end - + bounding_box([0,y_position], :width =>self.page_width - 10, :height => self.item_height) do text "Date : #{ time }",:size => self.item_font_size,:align => :left end - # bounding_box([self.item_description_width,y_position], :width =>self.label_width+5) do # text "(#{ sale_data.bookings[0].checkin_at.utc.getlocal.strftime('%I:%M %p') } # - #{ sale_data.bookings[0].checkin_at.utc.getlocal.strftime('%I:%M %p') })" , @@ -155,7 +156,7 @@ class ReceiptBillPdf < Prawn::Document move_down line_move stroke_horizontal_rule - end + end def line_items(sale_items,precision,delimiter) if precision.to_i > 0 @@ -250,7 +251,6 @@ class ReceiptBillPdf < Prawn::Document end def all_total(sale_data,precision,delimiter) - move_down line_move item_name_width = self.item_width y_position = cursor @@ -316,8 +316,7 @@ class ReceiptBillPdf < Prawn::Document end move_down line_move - sale_payment(sale_data,precision,delimiter) - + sale_payment(sale_data,precision,delimiter) end def sale_payment(sale_data,precision,delimiter) @@ -548,8 +547,7 @@ class ReceiptBillPdf < Prawn::Document text "Acknowledged By" , :size => self.item_font_size,:align => :center end end - - + end def footer(printed_status) From c982da42648c3eabb144fdfd5ae524e20658b51f Mon Sep 17 00:00:00 2001 From: Yan Date: Thu, 15 Mar 2018 18:56:29 +0630 Subject: [PATCH 03/61] add printer brand and api and type --- app/controllers/origami/payments_controller.rb | 11 ++++++++++- app/controllers/print_settings_controller.rb | 13 ++++++++++++- app/models/print_setting.rb | 2 +- app/models/printer/printer_worker.rb | 5 +++++ app/models/printer/receipt_printer.rb | 10 +++++----- app/pdf/receipt_bill_pdf.rb | 15 ++++----------- app/views/origami/home/show.html.erb | 4 +++- app/views/print_settings/_form.html.erb | 18 ++++++++++++++++++ .../_print_setting.json.jbuilder | 2 +- app/views/print_settings/show.html.erb | 8 ++++++++ config/routes.rb | 2 ++ .../20170628103624_create_print_settings.rb | 2 +- 12 files changed, 70 insertions(+), 22 deletions(-) diff --git a/app/controllers/origami/payments_controller.rb b/app/controllers/origami/payments_controller.rb index c764b92f..fc07f966 100755 --- a/app/controllers/origami/payments_controller.rb +++ b/app/controllers/origami/payments_controller.rb @@ -79,7 +79,16 @@ class Origami::PaymentsController < BaseOrigamiController printer = Printer::ReceiptPrinter.new(print_settings) - printer.print_receipt_bill(print_settings,cashier_terminal,sale_items,sale_data,customer.name, item_price_by_accounts, discount_price_by_accounts, member_info, shop_details, "Frt",current_balance,nil) + filename, receipt_no, cashier_printer = printer.print_receipt_bill(print_settings,cashier_terminal,sale_items,sale_data,customer.name, item_price_by_accounts, discount_price_by_accounts, member_info, shop_details, "Frt",current_balance,nil) + + result = { + :filepath => filename, + :printer_model => print_settings.brand_name, + :printer_url => print_settings.api_settings + } + + # Mobile Print + render :json => result.to_json end end diff --git a/app/controllers/print_settings_controller.rb b/app/controllers/print_settings_controller.rb index 710e6ea4..f12778af 100755 --- a/app/controllers/print_settings_controller.rb +++ b/app/controllers/print_settings_controller.rb @@ -64,6 +64,17 @@ class PrintSettingsController < ApplicationController end end + def get_printer_options + printer_name = params[:printer_name] + printer_options = Printer::PrinterWorker.printer_options(printer_name) + options = { + :url => printer_options['device-uri'], + :model => printer_options['printer-info'], + } + + render :json => options.to_json + end + private # Use callbacks to share common setup or constraints between actions. def set_print_setting @@ -72,7 +83,7 @@ class PrintSettingsController < ApplicationController # Never trust parameters from the scary internet, only allow the white list through. def print_setting_params - params.require(:print_setting).permit(:name, :unique_code, :template, :printer_name, :font, :api_settings, :page_width, :page_height, :print_copies,:precision,:delimiter,:heading_space) + params.require(:print_setting).permit(:name, :unique_code, :template, :printer_name, :brand_name, :printer_type, :font, :api_settings, :page_width, :page_height, :print_copies,:precision,:delimiter,:heading_space) end #Shop Name in Navbor diff --git a/app/models/print_setting.rb b/app/models/print_setting.rb index d28b852b..a3cfc597 100755 --- a/app/models/print_setting.rb +++ b/app/models/print_setting.rb @@ -1,6 +1,6 @@ class PrintSetting < ApplicationRecord # validations - validates_presence_of :name, :unique_code, :printer_name, :page_width, :page_height, :print_copies + validates_presence_of :name, :unique_code, :printer_name, :brand_name, :api_settings, :page_width, :page_height, :print_copies def self.get_precision_delimiter PrintSetting.find_by_unique_code("ReceiptBillPdf") diff --git a/app/models/printer/printer_worker.rb b/app/models/printer/printer_worker.rb index c0485187..2924853e 100755 --- a/app/models/printer/printer_worker.rb +++ b/app/models/printer/printer_worker.rb @@ -24,6 +24,11 @@ class Printer::PrinterWorker end end + # Options from printer name + def self.printer_options(printer_name) + Cups.options_for(printer_name) + end + def self.printers() Cups.show_destinations end diff --git a/app/models/printer/receipt_printer.rb b/app/models/printer/receipt_printer.rb index d544c908..597f264a 100755 --- a/app/models/printer/receipt_printer.rb +++ b/app/models/printer/receipt_printer.rb @@ -176,7 +176,7 @@ class Printer::ReceiptPrinter < Printer::PrinterWorker def print_receipt_bill(printer_settings,cashier_terminal,sale_items,sale_data, customer_name, item_price_by_accounts, discount_price_by_accounts, member_info = nil,rebate_amount=nil,shop_details, printed_status,balance,card_data) #Use CUPS service #Generate PDF - #Print + #Print pdf = ReceiptBillPdf.new(printer_settings, sale_items, sale_data, customer_name, item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount,shop_details,printed_status,balance,card_data) receipt_bill_a5_pdf = Lookup.collection_of("print_settings") #print_settings with name:ReceiptBillA5Pdf if !receipt_bill_a5_pdf.empty? @@ -202,14 +202,14 @@ class Printer::ReceiptPrinter < Printer::PrinterWorker begin if count == 1 - filename = "/receipts/receipt_bill_#{sale_data.receipt_no}.pdf" - pdf.render_file directory_name + "/receipt_bill_#{sale_data.receipt_no}.pdf" + filename = directory_name + "/receipt_bill_#{sale_data.receipt_no}.pdf" + pdf.render_file filename if printed_status != 'Paid' self.print(directory_name + "/receipt_bill_#{sale_data.receipt_no}.pdf", cashier_terminal.printer_name) end else - filename = "/receipts/receipt_bill_#{sale_data.receipt_no}_#{count}.pdf" - pdf.render_file directory_name + "/receipt_bill_#{sale_data.receipt_no}_#{count}.pdf" + filename = directory_name + "/receipt_bill_#{sale_data.receipt_no}_#{count}.pdf" + pdf.render_file filename if printed_status != 'Paid' self.print(directory_name + "/receipt_bill_#{sale_data.receipt_no}_#{count}.pdf", cashier_terminal.printer_name) end diff --git a/app/pdf/receipt_bill_pdf.rb b/app/pdf/receipt_bill_pdf.rb index 9926e423..c0299033 100755 --- a/app/pdf/receipt_bill_pdf.rb +++ b/app/pdf/receipt_bill_pdf.rb @@ -23,7 +23,7 @@ class ReceiptBillPdf < Prawn::Document # @double = @qty_width * 1.3 # @half_qty = @qty_width / 2 #setting page margin and width - super(:margin => [printer_settings.heading_space, self.margin, self.margin, self.margin]) + super(:margin => [printer_settings.heading_space, self.margin, self.margin, self.margin], :page_size => [self.page_width, self.page_height]) #precision checked if printer_settings.precision.to_i > 2 @@ -121,15 +121,8 @@ class ReceiptBillPdf < Prawn::Document end move_down line_move - y_position = cursor - if sale_data.bookings[0].dining_facility_id.to_i > 0 - bounding_box([0,y_position], :width => self.label_width, :height => self.item_height) do - text "#{ sale_data.bookings[0].dining_facility.type } - #{ sale_data.bookings[0].dining_facility.name }" , :size => self.item_font_size,:align => :left - end - end - - bounding_box([self.label_width, y_position], :width =>self.label_width, :height => self.item_height) do + bounding_box([0, y_position], :width =>self.label_width, :height => self.item_height) do text "W: #{sale_data.requested_by}" , :size => self.item_font_size, :align => :left end bounding_box([self.label_width - 2,y_position], :width =>self.label_width, :height => self.item_height) do @@ -493,8 +486,8 @@ class ReceiptBillPdf < Prawn::Document end #individual payment per person - def individual_payment(sale_data, precision, delimiter) - per_person = sale_data.grand_total.to_i / sale_data.equal_persons.to_i + def individual_payment(sale_data, survey, precision, delimiter) + per_person = sale_data.grand_total.to_f / survey.total_customer.to_i stroke_horizontal_rule move_down line_move y_position = cursor diff --git a/app/views/origami/home/show.html.erb b/app/views/origami/home/show.html.erb index 8c2e58bc..5f0245a9 100755 --- a/app/views/origami/home/show.html.erb +++ b/app/views/origami/home/show.html.erb @@ -689,7 +689,9 @@ receipt_no = ($("#receipt_no").html()).trim(); if((receipt_no!=undefined) && (receipt_no!="")) createReceiptNoInFirstBillData(receipt_no,""); - + + // console.log(result); + code2lab.printBill(result.filepath, result.printer_model, result.printer_url); location.reload(); } }); diff --git a/app/views/print_settings/_form.html.erb b/app/views/print_settings/_form.html.erb index b8804dcc..bec1b931 100755 --- a/app/views/print_settings/_form.html.erb +++ b/app/views/print_settings/_form.html.erb @@ -12,6 +12,8 @@ <%= f.input :template %> <%= f.input :font %> <%= f.input :printer_name, :as => :select, :collection => Printer::PrinterWorker.printers, include_blank: false %> + <%= f.input :brand_name %> + <%= f.input :printer_type %> <%= f.input :api_settings %> <%= f.input :page_width %> <%= f.input :page_height %> @@ -61,6 +63,22 @@ diff --git a/app/views/settings/tax_profiles/index.html.erb b/app/views/settings/tax_profiles/index.html.erb index bda31d46..e1e63c06 100755 --- a/app/views/settings/tax_profiles/index.html.erb +++ b/app/views/settings/tax_profiles/index.html.erb @@ -30,9 +30,7 @@ <% @settings_tax_profiles.each do |settings_tax_profile| %> - - <%= settings_tax_profile.group_type %> - + <%= settings_tax_profile.group_type %> <%= settings_tax_profile.name %> <%= settings_tax_profile.rate %> <%= settings_tax_profile.inclusive %> diff --git a/app/views/settings/tax_profiles/show.html.erb b/app/views/settings/tax_profiles/show.html.erb index 77a503f2..b405066f 100755 --- a/app/views/settings/tax_profiles/show.html.erb +++ b/app/views/settings/tax_profiles/show.html.erb @@ -15,6 +15,11 @@

<%= t("en.tax_profile") %>

+ + + + + From e956b54886ade60a79b8f5b6a4a41d3f2ccc3a33 Mon Sep 17 00:00:00 2001 From: Aung Myo Date: Fri, 16 Mar 2018 17:41:30 +0630 Subject: [PATCH 06/61] update option and menu export csv single --- Gemfile | 4 +- app/assets/javascripts/addorder.js | 54 ++++---- app/controllers/api/orders_controller.rb | 3 +- .../origami/addorders_controller.rb | 6 +- app/controllers/settings/menus_controller.rb | 14 +- .../transactions/orders_controller.rb | 9 +- app/models/menu.rb | 19 +-- app/models/menu_category.rb | 17 ++- app/models/order_item.rb | 3 +- app/views/origami/addorders/detail.html.erb | 2 +- app/views/settings/menus/index.html.erb | 5 + config/application.rb | 2 + config/routes.rb | 1 + data/recent_users.json | 128 ------------------ 14 files changed, 84 insertions(+), 183 deletions(-) delete mode 100644 data/recent_users.json diff --git a/Gemfile b/Gemfile index 94ed4ef3..4ca47865 100755 --- a/Gemfile +++ b/Gemfile @@ -48,7 +48,6 @@ gem 'prawn' gem 'prawn-table' gem 'spreadsheet' gem 'to_xls-rails' - #Reporting gem #gem 'compendium' #gem "cancan" @@ -81,7 +80,6 @@ gem 'kaminari', '~> 1.0.1' gem 'filterrific' gem 'cancancan', '~> 1.10' - #pageless no need for current # gem 'will_paginate' # gem 'pageless-rails', github: 'rorlab/pageless-rails' @@ -129,4 +127,4 @@ gem 'momentjs-rails' # for date-range selector # gem 'bootstrap-datepicker-rails' # date picker # gem 'jquery-datetimepicker-rails' # gem 'select2-rails' # for multi-select and auto-complete select box -gem "chartkick" #chart lib +gem "chartkick" #chart lib \ No newline at end of file diff --git a/app/assets/javascripts/addorder.js b/app/assets/javascripts/addorder.js index 401d894a..f6365db0 100755 --- a/app/assets/javascripts/addorder.js +++ b/app/assets/javascripts/addorder.js @@ -180,7 +180,6 @@ $(function() { image_path = "image/logo.png"; } } - console.log(menu_items[field].options) row = '
' +'
' @@ -190,6 +189,7 @@ $(function() { +JSON.stringify(menu_items[field].instances)+"' data-id = '" +JSON.stringify(menu_items[field].attributes)+"' data-item = '" +JSON.stringify(item_attributes)+"' data-option = '" + +JSON.stringify(menu_items[field].options)+"'data-opt = '" +JSON.stringify(menu_items[field].options)+"' data-item-sets = '" +JSON.stringify(menu_items[field].item_sets)+"' data-toggle='modal' data-target='."+data_target+"' >" +"" @@ -202,6 +202,7 @@ $(function() { + price +"' data-instance-code = '"+ code +"' data-instance = '" + name +"' data-promotion-price = '"+ promotion_price +"' data-attributes = '" + JSON.stringify(item_attributes) +"' data-options = '" + + JSON.stringify(menu_items[field].options) +"' data-opt = '" + JSON.stringify(menu_items[field].options) +"' data-image='"+image_path+"' data-toggle='" +data_modal+"' data-target='."+data_target+"' data-item-sets = '" +JSON.stringify(menu_items[field].item_sets)+"'data-instances = '" @@ -296,7 +297,7 @@ $(function() { $('.set-item').attr('data-code',instances[0]['code']); $('.set-item').attr('data-name',instances[0]['name']); $('.set-item').attr('data-price',instances[0]['price']); - // $('.set-item').attr('data-options','[]'); + $('.set-item').attr('data-options',''); $('.set-item').attr('data-parent',true); $('#set_change_qty').val(1); @@ -351,6 +352,7 @@ $(function() { sub_total = $('#set_total_price').text(); name = $(this).data('name'); price = $(this).data('price'); + options = $(this).attr('data-options',''); // qty = $('#set_change_qty').val(); qty = document.getElementById("set_count").value; total = qty*price; @@ -379,14 +381,14 @@ $(function() { item = get_set_item(items); customer_display_view(item,"set_add"); - + var option = '' attribute_arr = [] var rowCount = $('.summary-items tbody tr').length+1; code = $('.set-item').attr('data-code'); name = $('.set-item').attr('data-name'); price = $('.set-item').attr('data-price'); - option = $('.set-item').attr('data-options'); + option = ($('.set-item').attr('data-options') === 'undefined') ? '' :$('.set-item').attr('data-options'); parent = $('.set-item').attr('data-parent'); total = qty * price ; row ="
" +'' - +'' + +'' +'' +''; $(".summary-items tbody").append(row); var rowCount = $('.summary-items tbody tr').length+1; + var set_option = '' $(items).each(function(i){ code = $(items[i]).attr('data-code'); name = $(items[i]).attr('data-name'); price = $(items[i]).attr('data-price'); - option = $(items[i]).attr('data-options'); + set_option = ($(items[i]).attr('data-options') === 'undefined') ? ' ' :$(items[i]).attr('data-options'); + sub_item = $(items[i]).attr('data-sub-item'); - option = $(items[i]).attr('data-options'); total = qty * price ; row ="" + +set_option+"' data-row ='"+rowCount+ "' data-sub-item ='"+sub_item+ "'>" +'' - +'' + +'' +'' +'' - +'' + +'' +'' +' + <% order_item_count = 0 %> <% if !@order_items.nil? %> <% sub_total = 0 %> <% @order_items.each do |order_item| %> <% if order_item.include? ('all_order') %> <% order_item['all_order'].each do |odr_item| %> <% + order_item_count = order_item_count.to_i + 1 sub_total += odr_item['qty'].to_f * odr_item['price'].to_f %> > @@ -385,10 +387,10 @@ //order_item_split $('#order_item_split').on('click',function () { - var cnt_order_item = "<%= @order_items.count %>"; + var cnt_order_item = "<%= order_item_count %>"; var order_items = get_selected_order_items();// Selected Order Items - var cnt_items = parseInt(cnt_order_item - 1) - parseInt(order_items.length); + var cnt_items = parseInt(cnt_order_item) - parseInt(order_items.length); if (order_items.length > 0){ // if(cnt_items > 0){ swal({ From fa125df35579b03e96c483e8203d5405357c0c48 Mon Sep 17 00:00:00 2001 From: Yan Date: Fri, 16 Mar 2018 18:37:54 +0630 Subject: [PATCH 08/61] add junction pay --- .../origami/junction_pay_controller.rb | 58 ++++ .../origami/payments_controller.rb | 11 +- app/models/sale_payment.rb | 18 ++ app/views/origami/home/show.html.erb | 2 +- .../origami/junction_pay/create.json.jbuilder | 5 + app/views/origami/junction_pay/index.html.erb | 259 ++++++++++++++++++ app/views/origami/payments/show.html.erb | 22 +- config/routes.rb | 2 + 8 files changed, 369 insertions(+), 8 deletions(-) create mode 100644 app/controllers/origami/junction_pay_controller.rb create mode 100755 app/views/origami/junction_pay/create.json.jbuilder create mode 100755 app/views/origami/junction_pay/index.html.erb diff --git a/app/controllers/origami/junction_pay_controller.rb b/app/controllers/origami/junction_pay_controller.rb new file mode 100644 index 00000000..c02461aa --- /dev/null +++ b/app/controllers/origami/junction_pay_controller.rb @@ -0,0 +1,58 @@ +class Origami::JunctionPayController < BaseOrigamiController + + def index + @sale_id = params[:sale_id] + @cashier_type = params[:type] + # limit jcb_amount + sale_data = Sale.find_by_sale_id(@sale_id) + total = sale_data.grand_total + @junction_pay_count = 0 + others = 0 + @cashier_id = current_user.emp_id + + @payment_method_setting_nav = PaymentMethodSetting.all + @shop = Shop::ShopDetail + if @shop.is_rounding_adj + new_total = Sale.get_rounding_adjustment(sale_data.grand_total) + else + new_total = sale_data.grand_total + end + @rounding_adj = new_total-sale_data.grand_total + + sale_data.sale_payments.each do |sale_payment| + if sale_payment.payment_method == "JunctionPay" + @junction_pay_count = @junction_pay_count + sale_payment.payment_amount + else + others = others + sale_payment.payment_amount + end + end + @can_junction_pay = total - @junction_pay_count - others + + @member_discount = MembershipSetting.find_by_discount(1) + @sub_total = sale_data.total_amount + @membership_id = sale_data.customer.membership_id + #for bank integration + @receipt_no = sale_data.receipt_no + end + + def create + cash = params[:amount] + sale_id = params[:sale_id] + if(Sale.exists?(sale_id)) + saleObj = Sale.find(sale_id) + shop_details = Shop::ShopDetail + + # rounding adjustment + # if shop_details.is_rounding_adj + # new_total = Sale.get_rounding_adjustment(saleObj.grand_total) + # rounding_adj = new_total-saleObj.grand_total + # saleObj.update_attributes(grand_total: new_total,old_grand_total: saleObj.grand_total,rounding_adjustment:rounding_adj) + # end + + # saleObj = Sale.find(sale_id) + sale_payment = SalePayment.new + @status, @sale = sale_payment.process_payment(saleObj, @user, cash, "JunctionPay") + end + end + +end diff --git a/app/controllers/origami/payments_controller.rb b/app/controllers/origami/payments_controller.rb index fc07f966..1b4bd5bb 100755 --- a/app/controllers/origami/payments_controller.rb +++ b/app/controllers/origami/payments_controller.rb @@ -27,7 +27,7 @@ class Origami::PaymentsController < BaseOrigamiController cashier_terminal = CashierTerminal.find(shift.cashier_terminal_id) end - if ENV["SERVER_MODE"] != "cloud" #no print in cloud server + # if ENV["SERVER_MODE"] != "cloud" #no print in cloud server receipt_bill_a5_pdf = Lookup.collection_of("print_settings") #print_settings with name:ReceiptBillA5Pdf # Print for First Bill to Customer unique_code = "ReceiptBillPdf" @@ -89,7 +89,7 @@ class Origami::PaymentsController < BaseOrigamiController # Mobile Print render :json => result.to_json - end + # end end def create @@ -138,7 +138,7 @@ class Origami::PaymentsController < BaseOrigamiController end # For Print - if ENV["SERVER_MODE"] != "cloud" #no print in cloud server + # if ENV["SERVER_MODE"] != "cloud" #no print in cloud server receipt_bill_a5_pdf = Lookup.collection_of("print_settings") #print_settings with name:ReceiptBillA5Pdf unique_code = "ReceiptBillPdf" if !receipt_bill_a5_pdf.empty? @@ -202,8 +202,8 @@ class Origami::PaymentsController < BaseOrigamiController booking.booking_orders.each do |order| Order.pay_process_order_queue(order.order_id,table_id) end + # end end - end end end @@ -221,6 +221,7 @@ class Origami::PaymentsController < BaseOrigamiController @jcbcount= 0.0 @mastercount = 0.0 @unionpaycount = 0.0 + @junctionpaycount = 0.0 @credit = 0.0 @sale_data = Sale.find_by_sale_id(sale_id) @balance = 0.00 @@ -333,6 +334,8 @@ class Origami::PaymentsController < BaseOrigamiController @mastercount += spay.payment_amount elsif spay.payment_method == "unionpay" @unionpaycount += spay.payment_amount + elsif spay.payment_method == "junctionpay" + @unionpaycount += spay.payment_amount elsif spay.payment_method == "creditnote" @credit += spay.payment_amount end diff --git a/app/models/sale_payment.rb b/app/models/sale_payment.rb index 5809dc0f..c49f30a7 100755 --- a/app/models/sale_payment.rb +++ b/app/models/sale_payment.rb @@ -48,6 +48,8 @@ class SalePayment < ApplicationRecord payment_status = paypar_payment when "foc" payment_status = foc_payment + when "JunctionPay" + payment_status = junction_pay_payment else puts "it was something else" end @@ -297,6 +299,22 @@ class SalePayment < ApplicationRecord end + def junction_pay_payment + payment_status = false + + #Next time - validate if the vochure number is valid - within + self.payment_method = "JunctionPay" + self.payment_amount = self.received_amount + self.payment_reference = self.voucher_no + self.outstanding_amount = self.sale.grand_total- self.received_amount + self.payment_status = "paid" + payment_method = self.save! + sale_update_payment_status(self.received_amount) + + return payment_status + + end + def sale_update_payment_status(paid_amount,check_foc = false) #update amount_outstanding self.sale.amount_received = self.sale.amount_received.to_f + paid_amount.to_f diff --git a/app/views/origami/home/show.html.erb b/app/views/origami/home/show.html.erb index 5f0245a9..571758be 100755 --- a/app/views/origami/home/show.html.erb +++ b/app/views/origami/home/show.html.erb @@ -691,7 +691,7 @@ createReceiptNoInFirstBillData(receipt_no,""); // console.log(result); - code2lab.printBill(result.filepath, result.printer_model, result.printer_url); + // code2lab.printBill(result.filepath, result.printer_model, result.printer_url); location.reload(); } }); diff --git a/app/views/origami/junction_pay/create.json.jbuilder b/app/views/origami/junction_pay/create.json.jbuilder new file mode 100755 index 00000000..9767a7d8 --- /dev/null +++ b/app/views/origami/junction_pay/create.json.jbuilder @@ -0,0 +1,5 @@ +if(@status) + json.status @status +else + json.status false +end diff --git a/app/views/origami/junction_pay/index.html.erb b/app/views/origami/junction_pay/index.html.erb new file mode 100755 index 00000000..4e371f76 --- /dev/null +++ b/app/views/origami/junction_pay/index.html.erb @@ -0,0 +1,259 @@ +
+ + +
+
+ + + +
+
+
+
+ + +
+
+
+ +
+
+ + <%@can_junction_pay = @can_junction_pay +@rounding_adj%> + +
+
+
+ <% if @jcbcount != 0 %> +
+
+ + +
+
+
+ <% end %> +
+
+ + +
+
+
+
+
+
+ +
0.0
+
+
+
+
+
+
+ +
+
+
+
+
+
1
+
2
+
3
+
+
+
4
+
5
+
6
+
+
+
7
+
8
+
9
+
+
+
0
+
.
+
00
+
+
+
Nett
+
Del
+
Clr
+
+
+
+
+
1000
+
3000
+
+
+
5000
+
10000
+
+
+
Pay
+
+
+
+
+
+ +
+ +
+
+
+ diff --git a/app/views/origami/payments/show.html.erb b/app/views/origami/payments/show.html.erb index 2deb9c0c..84ff842d 100755 --- a/app/views/origami/payments/show.html.erb +++ b/app/views/origami/payments/show.html.erb @@ -265,6 +265,20 @@
<%= number_with_precision(0, precision: precision.to_i ) %>
<% end %> + + <% if @junctionpaycount != 0.0 %> +
+
+
JUNCTION PAY
+
<%= number_with_precision(@junctionpaycount, precision: precision.to_i ) rescue number_with_precision(0, precision: precision.to_i ) %>
+
+ <% else %> + + <% end %>
Balance
<%= number_with_precision(@sale_data.grand_total, precision: precision.to_i ) rescue number_with_precision(0, precision: precision.to_i ) %>
@@ -488,10 +502,7 @@ var customer_name = "<%= @customer.name %>"; payment_type = ''; if ($("#server_mode").val() != "cloud") { // first bill not used in cloud - console.log("ssssssssssss") payment_type = checkReceiptNoInFirstBillData(receipt_no,"payment"); - console.log(member_id); - console.log(member_discount); if (member_id && member_discount) { if(parseInt(jQuery.inArray("Credit", payment_type)) == -1){ $("#credit_payment").hide(); @@ -562,6 +573,9 @@ var customer_name = "<%= @customer.name %>"; else if(payment_type == "UNIONPAY" && $('#unionpaycount').text()==0 && sub_total != 0.0){ swal("Oops","Please Pay with UNIONPAY Payment","warning"); } + else if(payment_type == "JUNCTIONPAY" && $('#junctionpaycount').text()==0 && sub_total != 0.0){ + swal("Oops","Please Pay with JUNCTIONPAY Payment","warning"); + } else if(payment_type == "Credit" && $('#credit').text()==0 && sub_total != 0.0){ swal("Oops","Please Pay with Credit Payment","warning"); }else{ @@ -837,6 +851,7 @@ var customer_name = "<%= @customer.name %>"; var jcb1 = $('#jcbcount').text(); var master1 = $('#mastercount').text(); var unionpay1 = $('#unionpaycount').text(); + var junctionpay1 = $('#junctionpaycount').text(); var othertotal = parseFloat(credit1) + parseFloat(card1) + parseFloat(paypar1) + parseFloat(visa1) + parseFloat(jcb1) + parseFloat(master1) + parseFloat(unionpay1); var total = $('#amount_due').text(); var amt = 0; @@ -865,6 +880,7 @@ var customer_name = "<%= @customer.name %>"; var jcb = $('#jcbcount').text(); var master = $('#mastercount').text(); var unionpay = $('#unionpaycount').text(); + var junctionpay = $('#junctionpaycount').text(); var amount_due = $('#amount_due').text(); var total = parseFloat(cash) + parseFloat(credit) + parseFloat(card) + parseFloat(paypar) + parseFloat(visa) + parseFloat(jcb) + parseFloat(master) + parseFloat(unionpay) var result = parseFloat(amount_due) - parseFloat(total); diff --git a/config/routes.rb b/config/routes.rb index 21395c32..57cd404f 100755 --- a/config/routes.rb +++ b/config/routes.rb @@ -177,6 +177,7 @@ scope "(:locale)", locale: /en|mm/ do post 'payment/master' => "master#create" post 'payment/visa' => "visa#create" post 'payment/unionpay' => "unionpay#create" + post 'payment/junctionpay' => "junction_pay#create" post 'payment/paypar' => 'paypar_payments#create' post 'payment/credit' => 'credit_payments#create' post 'payment/voucher' => 'voucher_payments#create' @@ -188,6 +189,7 @@ scope "(:locale)", locale: /en|mm/ do get 'sale/:sale_id/:type/payment/others_payment/Master' => "master#index" get 'sale/:sale_id/:type/payment/others_payment/JCB' => "jcb#index" get 'sale/:sale_id/:type/payment/others_payment/UNIONPAY' => "unionpay#index" + get 'sale/:sale_id/:type/payment/others_payment/JUNCTIONPAY' => "junction_pay#index" get 'sale/:sale_id/:type/payment/others_payment/Redeem' => "redeem_payments#index" get 'sale/:sale_id/:type/payment/others_payment/Voucher' => "voucher#index" From e55ff8b5e0d240c8b4eb20f819917b97f21e1e63 Mon Sep 17 00:00:00 2001 From: phyusin Date: Mon, 19 Mar 2018 09:17:12 +0630 Subject: [PATCH 09/61] SQA feedback --- app/controllers/oqs/edit_controller.rb | 17 ++++++++++------- app/views/oqs/edit/index.html.erb | 4 ++++ app/views/origami/pending_order/show.html.erb | 10 +++++++++- app/views/origami/split_bill/index.html.erb | 5 +++-- 4 files changed, 26 insertions(+), 10 deletions(-) mode change 100755 => 100644 app/controllers/oqs/edit_controller.rb mode change 100755 => 100644 app/views/oqs/edit/index.html.erb mode change 100755 => 100644 app/views/origami/pending_order/show.html.erb mode change 100755 => 100644 app/views/origami/split_bill/index.html.erb diff --git a/app/controllers/oqs/edit_controller.rb b/app/controllers/oqs/edit_controller.rb old mode 100755 new mode 100644 index b123ac73..94ba5842 --- a/app/controllers/oqs/edit_controller.rb +++ b/app/controllers/oqs/edit_controller.rb @@ -6,6 +6,11 @@ class Oqs::EditController < BaseOqsController if params[:type] == 'oqs' assigned_item = AssignedOrderItem.find(assigned_item_id) @order_item = OrderItem.where("order_id='#{ assigned_item.order_id }' AND item_instance_code='#{ assigned_item.instance_code }'") + elsif + assigned_item = OrderItem.find(assigned_item_id) + @booking = Booking.joins(" JOIN booking_orders as bko on bko.booking_id = bookings.booking_id") + .where("bko.order_id = '#{assigned_item.order_id}'").first() + @order_item = OrderItem.where("order_id='#{ assigned_item.order_id }' AND item_instance_code='#{ assigned_item.item_instance_code }'") else assigned_item = OrderItem.find(assigned_item_id) dining = DiningFacility.find_by_id(params[:type]) @@ -25,13 +30,6 @@ class Oqs::EditController < BaseOqsController order_item.item_order_by = current_user.name order_item.qty = qty_weight order_item.remark = remarks - if !order_item.set_menu_items.nil? - instance_item_sets = JSON.parse(order_item.set_menu_items) - instance_item_sets.each_with_index do |instance_item, instance_index| - instance_item_sets[instance_index]["quantity"] = qty_weight - end - order_item.set_menu_items = instance_item_sets.to_json - end order_item.save if ENV["SERVER_MODE"] != "cloud" #no print in cloud server @@ -67,4 +65,9 @@ class Oqs::EditController < BaseOqsController end end + #Shop Name in Navbor + helper_method :shop_detail + def shop_detail + @shop = Shop.first + end end diff --git a/app/views/oqs/edit/index.html.erb b/app/views/oqs/edit/index.html.erb old mode 100755 new mode 100644 index 775b214d..7a1eebab --- a/app/views/oqs/edit/index.html.erb +++ b/app/views/oqs/edit/index.html.erb @@ -112,6 +112,8 @@ $(document).ready(function(){ var remarks = $("textarea[name='remarks']").val(); var order_items_id = $(this).attr('data-id'); var params = { 'order_items_id': order_items_id, 'qty_weight': qty_weight, 'remarks': remarks } + var booking_id = '<%= @booking.booking_id %>'; + $.ajax({ type: 'POST', url: '/oqs/' + order_items_id, @@ -121,6 +123,8 @@ $(document).ready(function(){ <% if !@link_type.nil? %> <% if @link_type == 'oqs' %> window.location.href = '/oqs'; + <% elsif @link_type == 'pending' %> + window.location.href = '/origami/quick_service/pending_order/'+booking_id; <% else %> <% if !@dining_type.nil? %> <% if @dining_type == 'Table' %> diff --git a/app/views/origami/pending_order/show.html.erb b/app/views/origami/pending_order/show.html.erb old mode 100755 new mode 100644 index ac164636..a7ade0a4 --- a/app/views/origami/pending_order/show.html.erb +++ b/app/views/origami/pending_order/show.html.erb @@ -100,7 +100,7 @@ @order_items.each do |order_item| sub_total = sub_total + order_item.price %> -
+ @@ -289,5 +289,13 @@ $(document).ready(function(){ window.location.href = linkURL; }); } + + /*edit order in oqs*/ + $('.edit_order').on('click',function(){ + var assigned_order_item_id = $(this).attr('data-id'); + if((assigned_order_item_id!=undefined) && (assigned_order_item_id!='')){ + window.location.href = '/oqs/'+ assigned_order_item_id + "/edit/pending"; + } + }); }); diff --git a/app/views/origami/split_bill/index.html.erb b/app/views/origami/split_bill/index.html.erb old mode 100755 new mode 100644 index 69743cf1..a62fb66e --- a/app/views/origami/split_bill/index.html.erb +++ b/app/views/origami/split_bill/index.html.erb @@ -60,7 +60,7 @@ <% if order_item.include? ('all_order') %> <% order_item['all_order'].each do |odr_item| %> <% - order_item_count = order_item_count.to_i + 1 + order_item_count = order_item_count.to_i + 1 sub_total += odr_item['qty'].to_f * odr_item['price'].to_f %> > @@ -389,7 +389,6 @@ $('#order_item_split').on('click',function () { var cnt_order_item = "<%= order_item_count %>"; var order_items = get_selected_order_items();// Selected Order Items - var cnt_items = parseInt(cnt_order_item) - parseInt(order_items.length); if (order_items.length > 0){ // if(cnt_items > 0){ @@ -425,6 +424,7 @@ $.each(orders, function(key,value){ if($("a[href$='#"+value.order_id+"']").parent().hasClass('selected-split-item')){ $("a[href$='#"+value.order_id+"']").parent().removeClass('selected-split-item'); + $(".item-row").removeClass('selected-split-item'); } }); } @@ -623,6 +623,7 @@ function orderItemSplitBillProcess(cnt_items){ if(cnt_items == 0){ booking_id = json_booking.booking_id; } + console.log(booking_id); var order_ids = []; var arr_order_ids = []; From a9c8eb4e93a775b8bddcab462e933dfdcce812af Mon Sep 17 00:00:00 2001 From: phyusin Date: Mon, 19 Mar 2018 11:35:43 +0630 Subject: [PATCH 10/61] check tax profile --- .../origami/addorders_controller.rb | 8 +-- .../origami/payments_controller.rb | 3 +- .../origami/request_bills_controller.rb | 2 +- .../origami/sale_edit_controller.rb | 18 +++++-- app/controllers/origami/void_controller.rb | 3 +- app/models/sale.rb | 52 +++++++++++-------- app/views/origami/home/show.html.erb | 2 +- app/views/origami/payments/show.html.erb | 4 +- app/views/origami/rooms/show.html.erb | 2 +- app/views/origami/sale_edit/edit.html.erb | 4 +- .../origami/table_invoices/show.html.erb | 4 +- config/routes.rb | 4 +- 12 files changed, 61 insertions(+), 45 deletions(-) diff --git a/app/controllers/origami/addorders_controller.rb b/app/controllers/origami/addorders_controller.rb index 3a8dea9b..f5bb7d37 100755 --- a/app/controllers/origami/addorders_controller.rb +++ b/app/controllers/origami/addorders_controller.rb @@ -103,11 +103,11 @@ class Origami::AddordersController < BaseOrigamiController } # begin - if params[:order_source] == "quick_service" - customer_id = "CUS-000000000002" # for no customer id from mobile - else + # if params[:order_source] == "quick_service" + # customer_id = "CUS-000000000002" # for no customer id from mobile + # else customer_id = params[:customer_id] == ""? "CUS-000000000001" : params[:customer_id] # for no customer id from mobile - end + # end @order = Order.new @order.source = params[:order_source] @order.order_type = params[:order_type] diff --git a/app/controllers/origami/payments_controller.rb b/app/controllers/origami/payments_controller.rb index 49320273..00ad4e4d 100755 --- a/app/controllers/origami/payments_controller.rb +++ b/app/controllers/origami/payments_controller.rb @@ -402,12 +402,13 @@ class Origami::PaymentsController < BaseOrigamiController member_info = nil rebate_amount = nil current_balance = nil + order_source = params[:type] if(Sale.exists?(sale_id)) saleObj = Sale.find(sale_id) if saleObj.discount_type == "member_discount" saleObj.update_attributes(rounding_adjustment: 0) - saleObj.compute_by_sale_items(sale_id, saleObj.sale_items,0) + saleObj.compute_by_sale_items(sale_id, saleObj.sale_items,0,order_source) end saleObj.update_attributes(rounding_adjustment: 0) diff --git a/app/controllers/origami/request_bills_controller.rb b/app/controllers/origami/request_bills_controller.rb index aa145b4f..adfe35a6 100755 --- a/app/controllers/origami/request_bills_controller.rb +++ b/app/controllers/origami/request_bills_controller.rb @@ -13,7 +13,7 @@ class Origami::RequestBillsController < ApplicationController if check_booking.sale_id.nil? # Create Sale if it doesn't exist - @status, @sale_id = @sale.generate_invoice_from_booking(check_booking.id,current_login_employee, current_user) + @status, @sale_id = @sale.generate_invoice_from_booking(check_booking.id,current_login_employee, current_user, order.source) @sale_data = Sale.find_by_sale_id(@sale_id) @sale_items = SaleItem.where("sale_id=?",@sale_id) else diff --git a/app/controllers/origami/sale_edit_controller.rb b/app/controllers/origami/sale_edit_controller.rb index 72df82ac..1743f881 100755 --- a/app/controllers/origami/sale_edit_controller.rb +++ b/app/controllers/origami/sale_edit_controller.rb @@ -76,11 +76,14 @@ class Origami::SaleEditController < BaseOrigamiController # re-calc tax saleObj = Sale.find(saleitemObj.sale_id) + order_id = SaleOrder.find_by_sale_id(saleitemObj.sale_id).order_id + order = Order.find(order_id) + action_by = current_user.id remark = "FOC Sale Item ID #{saleitemObj.sale_item_id} | Receipt No #{saleObj.receipt_no} | Item Name ->#{saleitemObj.product_name}-Product Code ->#{saleitemObj.product_code}-Instance Code ->#{saleitemObj.item_instance_code}Receipt No #{saleObj.receipt_no}" sale_audit = SaleAudit.record_audit_for_edit(saleitemObj.sale_id,saleObj.cashier_id, action_by,remark,"SALEITEMFOC" ) - saleObj.compute_by_sale_items(saleObj.sale_id, saleObj.sale_items, saleObj.total_discount) + saleObj.compute_by_sale_items(saleObj.sale_id, saleObj.sale_items, saleObj.total_discount,order.source) ProductCommission.create_product_commission(@newsaleitem, saleitemObj) end @@ -141,7 +144,7 @@ class Origami::SaleEditController < BaseOrigamiController end end - saleObj.compute_by_sale_items(saleObj.sale_id, saleObj.sale_items, saleObj.total_discount) + saleObj.compute_by_sale_items(saleObj.sale_id, saleObj.sale_items, saleObj.total_discount,order.source) ProductCommission.edit_product_commission(saleitemObj) end @@ -162,17 +165,21 @@ class Origami::SaleEditController < BaseOrigamiController # re-calc tax saleObj = Sale.find(saleitemObj.sale_id) + order_id = SaleOrder.find_by_sale_id(saleitemObj.sale_id).order_id + order = Order.find(order_id) + action_by = current_user.id remark = "Cancle Void Sale Item ID #{saleitemObj.sale_item_id} | Item Name ->#{saleitemObj.product_name}-Product Code ->#{saleitemObj.product_code}-Instance Code ->#{saleitemObj.item_instance_code}|Receipt No #{saleObj.receipt_no}" sale_audit = SaleAudit.record_audit_for_edit(saleitemObj.sale_id,saleObj.cashier_id, action_by,remark,"ITEMCANCELVOID" ) - saleObj.compute_by_sale_items(saleObj.sale_id, saleObj.sale_items, saleObj.total_discount) + saleObj.compute_by_sale_items(saleObj.sale_id, saleObj.sale_items, saleObj.total_discount, order.source) ProductCommission.remove_product_commission(saleitemObj) end # remove all void items def cancel_all_void sale_id = params[:sale_id] + order_source = params[:type] saleObj = Sale.find(sale_id) saleObj.sale_items.each do |item| if item.qty.to_i < 0 @@ -185,13 +192,14 @@ class Origami::SaleEditController < BaseOrigamiController end # re-calc tax - saleObj.compute_by_sale_items(saleObj.sale_id, saleObj.sale_items, saleObj.total_discount) + saleObj.compute_by_sale_items(saleObj.sale_id, saleObj.sale_items, saleObj.total_discount,order_source) end def apply_void sale_id = params[:sale_id] + order_source = params[:type] saleObj = Sale.find(sale_id) - saleObj.compute_without_void + saleObj.compute_without_void(order_source) saleObj.sale_items.each do |item| ProductCommission.remove_product_commission(item) end diff --git a/app/controllers/origami/void_controller.rb b/app/controllers/origami/void_controller.rb index 33ff0d76..00f9d76b 100755 --- a/app/controllers/origami/void_controller.rb +++ b/app/controllers/origami/void_controller.rb @@ -4,12 +4,13 @@ class Origami::VoidController < BaseOrigamiController sale_id = params[:sale_id] remark = params[:remark] + order_source = params[:type] #tax profile source if Sale.exists?(sale_id) sale = Sale.find_by_sale_id(sale_id) if sale.discount_type == "member_discount" sale.update_attributes(total_discount: 0) - sale.compute_by_sale_items(sale_id, sale.sale_items,0) + sale.compute_by_sale_items(sale_id, sale.sale_items,0,order_source) end # update count for shift sale diff --git a/app/models/sale.rb b/app/models/sale.rb index 5d46aafc..11ddd296 100755 --- a/app/models/sale.rb +++ b/app/models/sale.rb @@ -26,7 +26,7 @@ class Sale < ApplicationRecord SALE_STATUS_OUTSTANDING = "outstanding" SALE_STATUS_COMPLETED = "completed" - def generate_invoice_from_booking(booking_id, requested_by, cashier) + def generate_invoice_from_booking(booking_id, requested_by, cashier, order_source = nil) booking = Booking.find(booking_id) status = false Rails.logger.debug "Booking -> " + booking.id.to_s @@ -36,9 +36,9 @@ class Sale < ApplicationRecord booking.booking_orders.each do |order| if booking.sale_id - status, sale_id = generate_invoice_from_order(order.order_id, nil, booking, requested_by, cashier) + status, sale_id = generate_invoice_from_order(order.order_id, nil, booking, requested_by, cashier, order_source) else - status, sale_id = generate_invoice_from_order(order.order_id, booking.sale_id, booking, requested_by, cashier) + status, sale_id = generate_invoice_from_order(order.order_id, booking.sale_id, booking, requested_by, cashier, order_source) end booking.sale_id = sale_id end @@ -58,7 +58,7 @@ class Sale < ApplicationRecord end end - def generate_invoice_from_order (order_id, sale_id, booking, requested_by, cashier = nil) + def generate_invoice_from_order (order_id, sale_id, booking, requested_by, cashier = nil, order_source = nil) taxable = true #if sale_id is exsit and validate #add order to that invoice @@ -128,7 +128,7 @@ class Sale < ApplicationRecord self.save! #compute sales summary - compute + compute(order_source) #Update the order items that is billed order.update_items_status_to_billed(nil) @@ -172,7 +172,7 @@ class Sale < ApplicationRecord # Create Sale if it doesn't exist # puts "current_login_employee" # puts current_login_employee.name - @status, @sale_id = @sale.generate_invoice_from_booking(check_booking.id,current_login_employee,current_user) + @status, @sale_id = @sale.generate_invoice_from_booking(check_booking.id,current_login_employee,current_user,order.source) @sale_data = Sale.find_by_sale_id(@sale_id) @sale_items = SaleItem.where("sale_id=?",@sale_id) else @@ -310,7 +310,7 @@ class Sale < ApplicationRecord end #compute - invoice total - def compute + def compute(order_source = nil) sales_items = self.sale_items #Computation Fields @@ -329,7 +329,7 @@ class Sale < ApplicationRecord # total_taxable = total_taxable + (item.taxable_price * item.qty) end - apply_tax (total_taxable) + apply_tax(total_taxable, order_source) self.total_amount = subtotal_price self.total_discount = total_discount @@ -342,7 +342,7 @@ class Sale < ApplicationRecord end #compute - invoice total - def compute_by_sale_items(sale_id, sale_itemss, total_discount,discount_type=nil) + def compute_by_sale_items(sale_id, sale_itemss, total_discount,discount_type=nil,order_source=nil) sale = Sale.find(sale_id) sales_items = sale_itemss @@ -362,7 +362,7 @@ class Sale < ApplicationRecord end end - compute_tax(sale, total_taxable, total_discount) + compute_tax(sale, total_taxable, total_discount, order_source) sale.total_amount = subtotal_price sale.total_discount = total_discount sale.grand_total = (sale.total_amount - sale.total_discount) + sale.total_tax @@ -376,7 +376,7 @@ class Sale < ApplicationRecord end # No Use too many wrong - def compute_without_void + def compute_without_void(order_source = nil) sales_items = self.sale_items #Computation Fields @@ -396,7 +396,7 @@ class Sale < ApplicationRecord end end - apply_tax (total_taxable) + apply_tax(total_taxable, order_source) self.total_amount = subtotal_price self.total_discount = total_discount self.grand_total = (self.total_amount - self.total_discount) + self.total_tax @@ -407,7 +407,7 @@ class Sale < ApplicationRecord end # Tax Re-Calculte - def compute_tax(sale, total_taxable, total_discount = 0) + def compute_tax(sale, total_taxable, total_discount = 0, order_source = nil) shop = Shop.first(); #if tax is not apply create new record @@ -423,8 +423,9 @@ class Sale < ApplicationRecord # #Creat new tax records if sale.payment_status != 'foc' tax_profiles.each do |tax| - customer.tax_profiles.each do |cus_tax| - if cus_tax.to_i == tax.id + # customer.tax_profiles.each do |cus_tax| + # if cus_tax.to_i == tax.id + if tax.group_type.to_s == order_source.to_s sale_tax = SaleTax.new(:sale => sale) sale_tax.tax_name = tax.name sale_tax.tax_rate = tax.rate @@ -447,15 +448,16 @@ class Sale < ApplicationRecord sale_tax.inclusive = tax.inclusive sale_tax.save - end end + # end + # end end end sale.total_tax = total_tax_amount end # Tax Calculate - def apply_tax(total_taxable) + def apply_tax(total_taxable, order_source = nil) shop = Shop.first(); #if tax is not apply create new record @@ -469,11 +471,14 @@ class Sale < ApplicationRecord tax_profiles = TaxProfile.all.order("order_by asc") customer = Customer.find(self.customer_id) - + if order_source.to_s == "emenu" + order_source = "cashier" + end #Create new tax records tax_profiles.each do |tax| - customer.tax_profiles.each do |cus_tax| - if cus_tax.to_i == tax.id + # customer.tax_profiles.each do |cus_tax| + # if cus_tax.to_i == tax.id + if tax.group_type.to_s == order_source.to_s sale_tax = SaleTax.new(:sale => self) sale_tax.tax_name = tax.name sale_tax.tax_rate = tax.rate @@ -497,8 +502,9 @@ class Sale < ApplicationRecord sale_tax.inclusive = tax.inclusive sale_tax.save - end end + # end + # end end self.total_tax = total_tax_amount end @@ -1963,7 +1969,7 @@ end end # Re-compute for add - saleobj.compute + saleobj.compute(order.source) saleobj.save order.save booking.save @@ -1993,7 +1999,7 @@ end end # Re-compute for add - saleobj.compute + saleobj.compute(order.source) saleobj.save order.save booking.save diff --git a/app/views/origami/home/show.html.erb b/app/views/origami/home/show.html.erb index 54b0e956..ffbf1e4c 100755 --- a/app/views/origami/home/show.html.erb +++ b/app/views/origami/home/show.html.erb @@ -905,7 +905,7 @@ }, function (isConfirm) { if (isConfirm) { var sale_id = "<%= @obj_sale.sale_id rescue "" %>" - var ajax_url = "/origami/sale/" + sale_id + '/void'; + var ajax_url = "/origami/sale/" + sale_id + '/cashier/void'; var remark = $("#remark").val(); $.ajax({ diff --git a/app/views/origami/payments/show.html.erb b/app/views/origami/payments/show.html.erb index 2deb9c0c..a5449d35 100755 --- a/app/views/origami/payments/show.html.erb +++ b/app/views/origami/payments/show.html.erb @@ -691,7 +691,7 @@ var customer_name = "<%= @customer.name %>"; if (isConfirm) { var sale_id = $('#sale_id').text(); var remark = $("#remark").val(); - var ajax_url = "/origami/sale/" + sale_id + '/void'; + var ajax_url = "/origami/sale/" + sale_id +'/'+cashier_type+ '/void'; $.ajax({ type: 'POST', url: ajax_url, @@ -897,7 +897,7 @@ var customer_name = "<%= @customer.name %>"; if (isConfirm) { $.ajax({ type: "POST", - url: "<%= origami_payment_foc_path %>", + url: "/origami/payment/"+cashier_type+"/foc", data: params, success:function(result){ customer_display_view(null,"reload"); diff --git a/app/views/origami/rooms/show.html.erb b/app/views/origami/rooms/show.html.erb index d98a3fe2..758a5273 100755 --- a/app/views/origami/rooms/show.html.erb +++ b/app/views/origami/rooms/show.html.erb @@ -889,7 +889,7 @@ $('#add_invoice').on('click',function(){ var sure = confirm("Are you sure want to Void"); if (sure == true) { var sale_id = $('#sale_id').val(); - var ajax_url = "/origami/sale/" + sale_id + '/void'; + var ajax_url = "/origami/sale/" + sale_id + '/cashier/void'; $.ajax({ type: 'POST', url: ajax_url, diff --git a/app/views/origami/sale_edit/edit.html.erb b/app/views/origami/sale_edit/edit.html.erb index 745286d3..ff203657 100755 --- a/app/views/origami/sale_edit/edit.html.erb +++ b/app/views/origami/sale_edit/edit.html.erb @@ -331,7 +331,7 @@ var cashier_type = "<%= @cashier_type %>"; $.ajax({ type: "POST", url: ajax_url, - data: 'sale_id=' + sale_id, + data: 'sale_id=' + sale_id +'&type='+cashier_type, success: function (result) { location.reload(); } @@ -345,7 +345,7 @@ var cashier_type = "<%= @cashier_type %>"; $.ajax({ type: "POST", url: ajax_url, - data: 'sale_id=' + sale_id, + data: 'sale_id=' + sale_id+'&type='+cashier_type, success: function (result) { if (cashier_type=="quick_service") { window.location.href = '/origami/sale/'+sale_id+'/'+cashier_type+'/payment/'; diff --git a/app/views/origami/table_invoices/show.html.erb b/app/views/origami/table_invoices/show.html.erb index 515973f1..216e5eea 100644 --- a/app/views/origami/table_invoices/show.html.erb +++ b/app/views/origami/table_invoices/show.html.erb @@ -261,7 +261,7 @@ $('#void').on('click',function () { if (isConfirm) { var sale_id = $('#sale_id').val(); var remark = $("#remark").val(); - var ajax_url = "/origami/sale/" + sale_id + '/void'; + var ajax_url = "/origami/sale/" + sale_id + '/cashier/void'; $.ajax({ type: 'POST', url: ajax_url, @@ -291,7 +291,7 @@ $('#foc').click(function() { if ($(this).attr('active')=== "true") { $.ajax({ type: "POST", - url: "<%= origami_payment_foc_path %>", + url: "/origami/payment/cashier/foc", data: params, success:function(result){ if (cash >= 0) { diff --git a/config/routes.rb b/config/routes.rb index b51baca3..34020dee 100755 --- a/config/routes.rb +++ b/config/routes.rb @@ -170,7 +170,7 @@ scope "(:locale)", locale: /en|mm/ do get 'sale/:sale_id/:type/payment' => 'payments#show' post 'sale/:sale_id/:type/payment/print' => 'payments#print' #route for print receipt - post 'payment/foc' => 'payments#foc', :defaults => {:format => 'json'} + post 'payment/:type/foc' => 'payments#foc', :defaults => {:format => 'json'} post 'payment/cash' => 'payments#create' post 'payment/mpu' => "mpu#create" post 'payment/jcb' => "jcb#create" @@ -192,7 +192,7 @@ scope "(:locale)", locale: /en|mm/ do get 'sale/:sale_id/:type/payment/others_payment/Voucher' => "voucher#index" #---------Void --------------# - post 'sale/:sale_id/void' => 'void#overall_void' + post 'sale/:sale_id/:type/void' => 'void#overall_void' #---------Multiple Invoices --------------# get 'table/:table_id/table_invoices' => "table_invoices#index", :as => "table_invoice_index" From 259778a8919f32ac54ceeeea2beb5aa311913154 Mon Sep 17 00:00:00 2001 From: Yan Date: Mon, 19 Mar 2018 14:38:55 +0630 Subject: [PATCH 11/61] add junctionpay(vaap) --- .../origami/junction_pay_controller.rb | 16 +++- .../origami/payments_controller.rb | 4 +- app/models/sale_payment.rb | 3 +- app/views/origami/junction_pay/index.html.erb | 91 ++++++++++++++----- app/views/origami/payments/show.html.erb | 6 +- 5 files changed, 87 insertions(+), 33 deletions(-) diff --git a/app/controllers/origami/junction_pay_controller.rb b/app/controllers/origami/junction_pay_controller.rb index c02461aa..1c52a271 100644 --- a/app/controllers/origami/junction_pay_controller.rb +++ b/app/controllers/origami/junction_pay_controller.rb @@ -36,8 +36,20 @@ class Origami::JunctionPayController < BaseOrigamiController end def create - cash = params[:amount] + gift_amount = params[:gift_amount] + voucher_amount = params[:voucher_amount] + voucher_no = params[:voucher_no] sale_id = params[:sale_id] + + # Gift card or Voucher classified and add for payment_reference + remarks = '' + cash = (gift_amount.to_f + voucher_amount.to_f) + if gift_amount.to_f > 0 + remarks = "Junciton Gift Card Payment. RefNo-" + voucher_no + else + remarks = "Junciton Voucher Payment. RefNo-" + voucher_no + end + if(Sale.exists?(sale_id)) saleObj = Sale.find(sale_id) shop_details = Shop::ShopDetail @@ -51,7 +63,7 @@ class Origami::JunctionPayController < BaseOrigamiController # saleObj = Sale.find(sale_id) sale_payment = SalePayment.new - @status, @sale = sale_payment.process_payment(saleObj, @user, cash, "JunctionPay") + @status, @sale = sale_payment.process_payment(saleObj, @user, cash, "JunctionPay", remarks) end end diff --git a/app/controllers/origami/payments_controller.rb b/app/controllers/origami/payments_controller.rb index 1b4bd5bb..4e0c7100 100755 --- a/app/controllers/origami/payments_controller.rb +++ b/app/controllers/origami/payments_controller.rb @@ -334,8 +334,8 @@ class Origami::PaymentsController < BaseOrigamiController @mastercount += spay.payment_amount elsif spay.payment_method == "unionpay" @unionpaycount += spay.payment_amount - elsif spay.payment_method == "junctionpay" - @unionpaycount += spay.payment_amount + elsif spay.payment_method == "JunctionPay" + @junctionpaycount += spay.payment_amount elsif spay.payment_method == "creditnote" @credit += spay.payment_amount end diff --git a/app/models/sale_payment.rb b/app/models/sale_payment.rb index c49f30a7..b82cbf18 100755 --- a/app/models/sale_payment.rb +++ b/app/models/sale_payment.rb @@ -11,6 +11,7 @@ class SalePayment < ApplicationRecord def process_payment(invoice, action_by, cash_amount, payment_method,remark=nil) self.sale = invoice self.received_amount = cash_amount + self.payment_reference = remark amount_due = invoice.grand_total #get all payment for this invoices @@ -305,7 +306,7 @@ class SalePayment < ApplicationRecord #Next time - validate if the vochure number is valid - within self.payment_method = "JunctionPay" self.payment_amount = self.received_amount - self.payment_reference = self.voucher_no + # self.payment_reference = self.payment_reference self.outstanding_amount = self.sale.grand_total- self.received_amount self.payment_status = "paid" payment_method = self.save! diff --git a/app/views/origami/junction_pay/index.html.erb b/app/views/origami/junction_pay/index.html.erb index 4e371f76..cdbdc47d 100755 --- a/app/views/origami/junction_pay/index.html.erb +++ b/app/views/origami/junction_pay/index.html.erb @@ -202,32 +202,48 @@ $('#junction_pay').on('click',function(){ //end member discount $("#loading_wrapper").show(); var com_port = '/dev/' + $("#com_port_name").val(); + var is_rebate=false; //alert(cashier_id + amount + com_port); - code2lab.reqJunctionPay(true, cashier_id, parseFloat(amount), receipt_no, com_port); - - resJunctionPayUpdate(function(totalBillAmount , finalBillAmt,giftCardAmount,voucherAmount,voucherNumber,receiptNumber){ + code2lab.reqJunctionPay(true, cashier_id, parseFloat(amount), receipt_no, com_port); + resJunctionPayUpdate = function(totalBillAmount , finalBillAmt,giftCardAmount, voucherAmount,voucherNumber,receiptNumber){ $("#loading_wrapper").hide(); - $.ajax({type: "POST", - url: "/origami/payment/junctionpay", - data: "amount="+ totalBillAmount + "&sale_id="+ sale_id, - success:function(result){ - if(result){ - swal({ - title: "Information!", - text: "Payment Successfully", - html: true, + + var voucher_no = voucherNumber; + if (voucher_no == ''){ + voucher_no = reference_no; + } + + $.ajax({ + type: "POST", + url: "<%= origami_payment_junctionpay_path %>", + data: "gift_amount="+ giftCardAmount + "&voucher_amount=" + voucherAmount + + "&voucher_no=" + voucher_no + "&sale_id="+ sale_id, + success:function(result){ + if(result){ + var desc = 'Payment Successfully'; + // is_rebate get from resJunctionPay and if member + if(is_rebate){ desc = desc + ". And You get Rebate!"} + + swal({ + title: "Information!", + text: desc, + html: true, closeOnConfirm: false, closeOnCancel: false, allowOutsideClick: false - }, function () { - window.location.href = '/origami/sale/'+ sale_id +"/"+cashier_type+"/payment"; - }); - } - } - }); - }) + }, function () { + window.location.href = '/origami/sale/'+ sale_id +"/"+cashier_type+"/payment"; + }); + } + } + }); + }; - // resJunctionPay(function(memberno,transactionNo,finalBillingAmt){ + resJunctionPay = function(memberno,transactionNo,finalBillingAmt){ + if(memberno != ''){ is_rebate = true; } + }; + + // $("#loading_wrapper").hide(); // $.ajax({type: "POST", // url: "/origami/payment/"+payment_type, @@ -249,11 +265,36 @@ $('#junction_pay').on('click',function(){ // }); // }); - resError(function(message){ - $("#loading_wrapper").hide(); - swal ( "Oops" , message , "error" ); - }); + // var resError = function(message){ + // console.log(message); + // $("#loading_wrapper").hide(); + // swal ( "Oops" , message , "error" ); + // }; } } -}) +}); + +// var resJunctionPayUpdate = function(totalBillAmount , finalBillAmt,giftCardAmount,voucherAmount, voucherNumber,receiptNumber){ +// $("#loading_wrapper").hide(); +// // alert(voucherNumber + ' ' + totalBillAmount + ' ' + receiptNumber + ' ' + giftCardAmount); +// $.ajax({ +// type: "POST", +// url: "<%= origami_payment_junctionpay_path %>", +// data: "amount="+ totalBillAmount + "&sale_id="+ sale_id, +// success:function(result){ +// if(result){ +// swal({ +// title: "Information!", +// text: "Payment Successfully", +// html: true, +// closeOnConfirm: false, +// closeOnCancel: false, +// allowOutsideClick: false +// }, function () { +// window.location.href = '/origami/sale/'+ sale_id +"/"+cashier_type+"/payment"; +// }); +// } +// } +// }); +// }; diff --git a/app/views/origami/payments/show.html.erb b/app/views/origami/payments/show.html.erb index 84ff842d..415a3ba2 100755 --- a/app/views/origami/payments/show.html.erb +++ b/app/views/origami/payments/show.html.erb @@ -510,7 +510,7 @@ var customer_name = "<%= @customer.name %>"; $("#credit_payment").show(); } - if(parseInt(jQuery.inArray("MPU", payment_type)) !=-1 || parseInt(jQuery.inArray("VISA", payment_type)) !=-1 || parseInt(jQuery.inArray("JCB", payment_type)) !=-1 || parseInt(jQuery.inArray("Master", payment_type)) !=-1 || parseInt(jQuery.inArray("UNIONPAY", payment_type)) !=-1 || parseInt(jQuery.inArray("Redeem", payment_type)) !=-1){ + if(parseInt(jQuery.inArray("MPU", payment_type)) !=-1 || parseInt(jQuery.inArray("VISA", payment_type)) !=-1 || parseInt(jQuery.inArray("JCB", payment_type)) !=-1 || parseInt(jQuery.inArray("Master", payment_type)) !=-1 || parseInt(jQuery.inArray("UNIONPAY", payment_type)) !=-1 || parseInt(jQuery.inArray("Redeem", payment_type)) !=-1 || parseInt(jQuery.inArray("JUNCTIONPAY", payment_type)) !=-1){ $("#card_payment").show(); } else{ $("#card_payment").hide(); @@ -852,7 +852,7 @@ var customer_name = "<%= @customer.name %>"; var master1 = $('#mastercount').text(); var unionpay1 = $('#unionpaycount').text(); var junctionpay1 = $('#junctionpaycount').text(); - var othertotal = parseFloat(credit1) + parseFloat(card1) + parseFloat(paypar1) + parseFloat(visa1) + parseFloat(jcb1) + parseFloat(master1) + parseFloat(unionpay1); + var othertotal = parseFloat(credit1) + parseFloat(card1) + parseFloat(paypar1) + parseFloat(visa1) + parseFloat(jcb1) + parseFloat(master1) + parseFloat(unionpay1) + parseFloat(junctionpay1); var total = $('#amount_due').text(); var amt = 0; <% if precision.to_i > 0 %>; @@ -882,7 +882,7 @@ var customer_name = "<%= @customer.name %>"; var unionpay = $('#unionpaycount').text(); var junctionpay = $('#junctionpaycount').text(); var amount_due = $('#amount_due').text(); - var total = parseFloat(cash) + parseFloat(credit) + parseFloat(card) + parseFloat(paypar) + parseFloat(visa) + parseFloat(jcb) + parseFloat(master) + parseFloat(unionpay) + var total = parseFloat(cash) + parseFloat(credit) + parseFloat(card) + parseFloat(paypar) + parseFloat(visa) + parseFloat(jcb) + parseFloat(master) + parseFloat(unionpay) + parseFloat(junctionpay) var result = parseFloat(amount_due) - parseFloat(total); <% if precision.to_i > 0 %> $('#balance').text(parseFloat(result).toFixed(<%= precision %>)); From ca817197d917b017674a20f310741be6b2dd8c03 Mon Sep 17 00:00:00 2001 From: Aung Myo Date: Mon, 19 Mar 2018 18:13:38 +0630 Subject: [PATCH 12/61] update menu import and export --- Gemfile | 5 +- Gemfile.lock | 18 +++- app/controllers/settings/menus_controller.rb | 11 +-- app/models/menu.rb | 42 ++++++++- app/views/settings/menus/index.html.erb | 5 +- app/views/settings/menus/index.xlsx.axlsx | 86 +++++++++++++++++++ config/application.rb | 2 + config/initializers/mime_types.rb | 1 + out.xls | Bin 0 -> 3584 bytes 9 files changed, 155 insertions(+), 15 deletions(-) create mode 100644 app/views/settings/menus/index.xlsx.axlsx create mode 100644 out.xls diff --git a/Gemfile b/Gemfile index 4ca47865..c20dec66 100755 --- a/Gemfile +++ b/Gemfile @@ -46,8 +46,11 @@ gem 'mini_magick' gem 'cups' gem 'prawn' gem 'prawn-table' -gem 'spreadsheet' gem 'to_xls-rails' +gem 'rubyzip', '= 1.0.0' +gem 'axlsx', '= 2.0.1' +gem 'axlsx_rails' +gem 'roo' #Reporting gem #gem 'compendium' #gem "cancan" diff --git a/Gemfile.lock b/Gemfile.lock index 1c7e6534..254ff760 100755 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -50,6 +50,13 @@ GEM airbrussh (1.3.0) sshkit (>= 1.6.1, != 1.7.0) arel (8.0.0) + axlsx (2.0.1) + htmlentities (~> 4.3.1) + nokogiri (>= 1.4.1) + rubyzip (~> 1.0.0) + axlsx_rails (0.5.1) + actionpack (>= 3.1) + axlsx (>= 2.0.1) bcrypt (3.1.11) bindex (0.5.0) builder (3.2.3) @@ -100,6 +107,7 @@ GEM railties (>= 3.2, < 5.2) globalid (0.4.1) activesupport (>= 4.2.0) + htmlentities (4.3.4) httparty (0.15.6) multi_xml (>= 0.5.2) i18n (0.9.1) @@ -197,6 +205,10 @@ GEM rb-inotify (0.9.10) ffi (>= 0.5.0, < 2) redis (3.3.5) + roo (1.13.2) + nokogiri + rubyzip + spreadsheet (> 0.6.4) rspec-core (3.7.0) rspec-support (~> 3.7.0) rspec-expectations (3.7.0) @@ -215,6 +227,7 @@ GEM rspec-support (~> 3.7.0) rspec-support (3.7.0) ruby-ole (1.2.12.1) + rubyzip (1.0.0) sass (3.5.3) sass-listen (~> 4.0.0) sass-listen (4.0.0) @@ -286,6 +299,8 @@ PLATFORMS DEPENDENCIES aescrypt + axlsx (= 2.0.1) + axlsx_rails bcrypt (~> 3.1.7) byebug cancancan (~> 1.10) @@ -320,13 +335,14 @@ DEPENDENCIES rack-cors rails (~> 5.1.0) redis (~> 3.0) + roo rspec-rails (~> 3.5) + rubyzip (= 1.0.0) sass-rails (~> 5.0) schema_to_scaffold shoulda-matchers (~> 3.1) sidekiq simple_form - spreadsheet spring spring-watcher-listen (~> 2.0.0) tether-rails diff --git a/app/controllers/settings/menus_controller.rb b/app/controllers/settings/menus_controller.rb index 0a6d87c7..8fed1e97 100755 --- a/app/controllers/settings/menus_controller.rb +++ b/app/controllers/settings/menus_controller.rb @@ -7,12 +7,9 @@ class Settings::MenusController < ApplicationController def index @settings_menus = Menu.all.page(params[:page]).per(10) respond_to do |format| - format.html - # format.csv { send_data MenuCsvExport.generate } - -format.csv { send_data Menu.to_csv } -# format.csv { send_data MenuCategory.to_csv } - end + format.html + format.xlsx + end end # GET /settings/menus/1 @@ -76,7 +73,7 @@ format.csv { send_data Menu.to_csv } def import Menu.import(params[:file]) - redirect_to settings_menu_path, notice: "imported" + redirect_to settings_menus_path, notice: "imported" end private diff --git a/app/models/menu.rb b/app/models/menu.rb index 12784eea..09e36928 100755 --- a/app/models/menu.rb +++ b/app/models/menu.rb @@ -1,4 +1,6 @@ class Menu < ApplicationRecord + + require 'spreadsheet' has_many :menu_categories, dependent: :destroy validates_presence_of :name, :valid_days, :valid_time_from, :valid_time_to @@ -34,7 +36,7 @@ class Menu < ApplicationRecord def self.to_csv m_attributes = %w{name is_active valid_days valid_time_from valid_time_to created_by created_at updated_at} - CSV.generate(headers: true) do |csv| + CSV.generate(headers: true, row_sep: "\r\n") do |csv| csv << m_attributes menu = Menu.all menu.each do |user| @@ -44,9 +46,41 @@ class Menu < ApplicationRecord end def self.import(file) - CSV.foreach(file.path, headers:true) do |row| - Menu.create! row.to_hash - end + spreadsheet = Roo::Spreadsheet.open(file.path) + puts spreadsheet.info + + spreadsheet = Roo::Excelx.new(file.path) + puts spreadsheet.info + + # Use the extension option if the extension is ambiguous. + spreadsheet = Roo::Spreadsheet.open(file.path, extension: :xlsx) + + puts spreadsheet.info + + header = spreadsheet.row(1) + + (2..spreadsheet.last_row).each do |i| + + row = Hash[[header,spreadsheet.row(i)].transpose] + + menu = Menu.new + menu.name = row["name"] + menu.is_active = row["is_active"] + menu.valid_days = row["valid_days"] + menu.valid_time_from = row["valid_time_from"] + menu.valid_time_to = row["valid_time_to"] + menu.created_by = row["created_by"] + menu.save + end + end + + def self.open_spreadsheet(file) + case File.extname(file.original_filename) + when ".csv" then Roo::CSV.new(file.path,nil,:ignore) + when ".xls" then Roo::Excel.new(file.path,nil,:ignore) + when ".xlsx" then Roo::Excelx.new(file.path,nil,:ignore) + else raise "Unknown File type: #{original_filename}" + end end end \ No newline at end of file diff --git a/app/views/settings/menus/index.html.erb b/app/views/settings/menus/index.html.erb index ed215031..11ae575f 100755 --- a/app/views/settings/menus/index.html.erb +++ b/app/views/settings/menus/index.html.erb @@ -7,11 +7,12 @@ - +<%end%> +<%= link_to "Export users as spreadsheet", settings_menus_path(format: "xlsx") %>


diff --git a/app/views/settings/menus/index.xlsx.axlsx b/app/views/settings/menus/index.xlsx.axlsx new file mode 100644 index 00000000..977e9782 --- /dev/null +++ b/app/views/settings/menus/index.xlsx.axlsx @@ -0,0 +1,86 @@ +wb = xlsx_package.workbook +wb.styles do |s| + date = s.add_style(:format_code => "yyyy-mm-dd", :border => Axlsx::STYLE_THIN_BORDER) + wrap_text = s.add_style :sz => 11, + :alignment => { :horizontal => :left,:vertical => :center , + :wrap_text => true} + header_text = s.add_style :fg_color=> "FFFFFF", + :b => true, + :bg_color => "004586", + :sz => 12, + :border => { :style => :thin, :color => "00" }, + :alignment => { :horizontal => :left, + :vertical => :center , + :header_text => true} + + wb.add_worksheet(name: "Menu") do |sheet| + sheet.add_row %w( name is_active valid_days valid_time_from valid_time_to created_by ), :style=>header_text + @settings_menus.each do |menu| + sheet.add_row [ menu.name, menu.is_active, menu.valid_days, menu.valid_time_from,menu.valid_time_to, menu.created_by], :style=>[date,wrap_text] + end + end + + wb.add_worksheet(name: "Menu Category") do |sheet| + sheet.add_row %w(menu_id code name alt_name order_by created_by menu_category_id is_available created_at updated_at), :style=>header_text + MenuCategory.all.each do |mc| + sheet.add_row [mc.menu_id, mc.code, mc.name, mc.alt_name, mc.order_by, mc.created_by, mc.menu_category_id, mc.is_available, mc.created_at, mc.updated_at], :style=>wrap_text + end + end + + wb.add_worksheet(name: "Menu Item") do |sheet| + sheet.add_row %w(item_code name alt_name image_path description information unit type menu_category_id item_attributes item_options account_id _qty taxable is_sub_item is_available created_by created_at updated_at), :style=>header_text + MenuItem.all.each do |mi| + sheet.add_row [mi.item_code, mi.name, mi.alt_name, mi.image_path, mi.description, mi.information, mi.unit, mi.type, mi.menu_category_id, mi.item_attributes, mi.item_options, mi.account_id, mi.min_qty, mi.taxable, mi.is_sub_item, mi.is_available, mi.created_by, mi.created_at, mi.updated_at], :style=>wrap_text + end + end + + wb.add_worksheet(name: "Menu Item Instance") do |sheet| + sheet.add_row %w(menu_item_id item_instance_code item_instance_name item_attributes price is_on_promotion promotion_price is_available is_default created_at updated_at), :style=>header_text + MenuItemInstance.all.each do |mii| + sheet.add_row [mii.menu_item_id, mii.item_instance_code, mii.item_instance_name, mii.item_attributes, mii.price, mii.is_on_promotion, mii.promotion_price, mii.is_available, mii.is_default, mii.created_at, mii.updated_at], :style=>wrap_text + end + end + + wb.add_worksheet(name: "Menu Options") do |sheet| + sheet.add_row %w(option_type name value created_at updated_at), :style=>header_text + MenuItemOption.all.each do |option| + sheet.add_row [option.option_type, option.name, option.value, option.created_at, option.updated_at], :style=>wrap_text + end + end + + wb.add_worksheet(name: "Item Attributes") do |sheet| + sheet.add_row %w(attribute_type name value created_at updated_at), :style=>header_text + MenuItemAttribute.all.each do |attr| + sheet.add_row [ attr.attribute_type,attr.name,attr.value,attr.created_at,attr.updated_at], :style=>wrap_text + end + end + + wb.add_worksheet(name: "Account") do |sheet| + sheet.add_row %w(title account_type discount point bonus rebate created_at updated_at), :style=>header_text + Account.all.each do |acc| + sheet.add_row [acc.title,acc.account_type,acc.discount,acc.point,acc.bonus,acc.rebate,acc.created_at,acc.updated_at], :style=>wrap_text + end + end + + wb.add_worksheet(name: "Item Set") do |sheet| + sheet.add_row %w(name alt_name min_selectable_qty max_selectable_qty created_at updated_at), :style=>header_text + ItemSet.all.each do |set| + sheet.add_row [set.name, set.alt_name, set.min_selectable_qty, set.max_selectable_qty, set.created_at, set.updated_at], :style=>wrap_text + end + end + + wb.add_worksheet(name: "Menu Instance Item Set") do |sheet| + sheet.add_row %w(item_set_id menu_item_instance_id created_at updated_at), :style=>header_text + MenuInstanceItemSet.all.each do |miis| + sheet.add_row [miis.item_set_id, miis.menu_item_instance_id, miis.created_at, miis.updated_at], :style=>wrap_text + end + end + + wb.add_worksheet(name: "Menu Item Set") do |sheet| + sheet.add_row %w(item_set_id menu_item_id created_at updated_at), :style=>header_text + MenuItemSet.all.each do |mis| + sheet.add_row [mis.item_set_id, mis.menu_item_id, mis.created_at, mis.updated_at], :style=>wrap_text + end + end + +end diff --git a/config/application.rb b/config/application.rb index e9a4e634..5e672414 100755 --- a/config/application.rb +++ b/config/application.rb @@ -2,6 +2,8 @@ require_relative 'boot' require 'csv' require 'rails/all' +require 'creek' +# require 'iconv' # Require the gems listed in Gemfile, including any gems # you've limited to :test, :development, or :production. diff --git a/config/initializers/mime_types.rb b/config/initializers/mime_types.rb index 3859c754..3e0fb279 100755 --- a/config/initializers/mime_types.rb +++ b/config/initializers/mime_types.rb @@ -3,3 +3,4 @@ # Add new mime types for use in respond_to blocks: # Mime::Type.register "text/richtext", :rtf Mime::Type.register 'application/vnd.ms-excel', :xls +Mime::Type.register "application/xlsx", :xlsx diff --git a/out.xls b/out.xls new file mode 100644 index 0000000000000000000000000000000000000000..ffe4b922dd3da5584007d3d2209613a7f913243e GIT binary patch literal 3584 zcmeHJy=xRv5dXc+UcA%G*Ckpg$P(}i(#SS~#53YyqZTKUQlhyK zGLV13Mhgqi&SD{ooz*D_mO(5v&)>}59x+^D1dAg(yYpt=yf^dS&b*m@?>DD9>o1Oe z#x6LI5p25xMt8^!`H{3g3Haniw(Xn~agInfgCX)jAb>V6UGaTQ*4;KJ@^M2m<&<-;B|M7!5d4QjH%b$Bp^BC?KzMva!o^EKq z_Zmrlm5_-+=ru8EEFCiKcAF%IwGK9nSSAuAoFDOVlp|t45rbSx9%0p+y2qT9uNhs%RK}(EiKC)=FTHpkPmV%Hk(JE3FQkQ}!IEKqwQCgkuP!*A?-?9qr<+5Qf8jB%>)&Kc>)v?Jeo8KQCA`$!OeI3snQ;ZKAa)Ej=gges7ok&5sln;~ez(de z`~0`^sU7^8KEG9#ugPFPd7z30pH)`e3RXy)SliR*A3@Hfzq{T6{44#E9DTwfS8t+@ z+q#c>SGb3kf2RKWvX6nPA2w$nzWHd7Qcg2_Gqm&QM%!{>oC{&I&;@z?NuMz-UB^uTWm^ Date: Mon, 19 Mar 2018 18:22:15 +0630 Subject: [PATCH 13/61] update addorder sytle --- app/assets/javascripts/addorder.js | 2 +- app/models/menu.rb | 2 -- config/application.rb | 1 - 3 files changed, 1 insertion(+), 4 deletions(-) diff --git a/app/assets/javascripts/addorder.js b/app/assets/javascripts/addorder.js index f6365db0..d3723026 100755 --- a/app/assets/javascripts/addorder.js +++ b/app/assets/javascripts/addorder.js @@ -196,7 +196,7 @@ $(function() { +add+ '
' +'
' +'
' - +"
Date: Mon, 19 Mar 2018 19:34:34 +0630 Subject: [PATCH 14/61] SQA feedback --- app/assets/javascripts/origami.js | 4 +- app/controllers/oqs/edit_controller.rb | 2 +- app/controllers/origami/jcb_controller.rb | 61 +++++++++------ app/controllers/origami/master_controller.rb | 60 +++++++++------ app/controllers/origami/mpu_controller.rb | 63 ++++++++++------ .../origami/payments_controller.rb | 5 +- .../origami/unionpay_controller.rb | 59 +++++++++------ app/controllers/origami/visa_controller.rb | 59 +++++++++------ app/models/order.rb | 10 +-- app/models/order_queue_station.rb | 74 +++++++++++++++++++ app/models/sale_payment.rb | 13 +++- .../origami/pending_order/index.html.erb | 0 app/views/origami/pending_order/show.html.erb | 8 +- 13 files changed, 289 insertions(+), 129 deletions(-) mode change 100755 => 100644 app/controllers/origami/jcb_controller.rb mode change 100755 => 100644 app/controllers/origami/master_controller.rb mode change 100755 => 100644 app/controllers/origami/mpu_controller.rb mode change 100755 => 100644 app/controllers/origami/visa_controller.rb mode change 100755 => 100644 app/views/origami/pending_order/index.html.erb diff --git a/app/assets/javascripts/origami.js b/app/assets/javascripts/origami.js index 418b6ebe..7388529b 100755 --- a/app/assets/javascripts/origami.js +++ b/app/assets/javascripts/origami.js @@ -249,7 +249,7 @@ function setCommPorts(comPortLists) { closeOnCancel: false, allowOutsideClick: false }, function () { - window.location.href = '/origami/sale/'+ sale_id + "/payment/others_payment"; + window.location.href = '/origami/sale/'+ sale_id +"/"+cashier_type+"/payment/others_payment"; }); } } @@ -342,6 +342,8 @@ function resCBPay(resMsg,card_sale_trans_id,cmd_type,payment_type,bnk_bill_amoun }else{ if(payment_type!="master"){ payment_type = payment_type.toUpperCase(); + }else{ + payment_type = "Master"; } swal({ title: 'Oops', diff --git a/app/controllers/oqs/edit_controller.rb b/app/controllers/oqs/edit_controller.rb index 94ba5842..98ec1d63 100644 --- a/app/controllers/oqs/edit_controller.rb +++ b/app/controllers/oqs/edit_controller.rb @@ -6,7 +6,7 @@ class Oqs::EditController < BaseOqsController if params[:type] == 'oqs' assigned_item = AssignedOrderItem.find(assigned_item_id) @order_item = OrderItem.where("order_id='#{ assigned_item.order_id }' AND item_instance_code='#{ assigned_item.instance_code }'") - elsif + elsif params[:type] == "pending" assigned_item = OrderItem.find(assigned_item_id) @booking = Booking.joins(" JOIN booking_orders as bko on bko.booking_id = bookings.booking_id") .where("bko.order_id = '#{assigned_item.order_id}'").first() diff --git a/app/controllers/origami/jcb_controller.rb b/app/controllers/origami/jcb_controller.rb old mode 100755 new mode 100644 index 06ee6087..5c06f9fe --- a/app/controllers/origami/jcb_controller.rb +++ b/app/controllers/origami/jcb_controller.rb @@ -5,33 +5,43 @@ class Origami::JcbController < BaseOrigamiController @cashier_type = params[:type] # limit jcb_amount sale_data = Sale.find_by_sale_id(@sale_id) - total = sale_data.grand_total + total = 0 @jcbcount = 0 - others = 0 + @shop = Shop::ShopDetail + @rounding_adj = 0 + @can_jcb = 0 + @member_discount= 0 + @sub_total = 0 + @membership_id = nil + @receipt_no = nil + if !sale_data.nil? + total = sale_data.grand_total + + others = 0 + + if @shop.is_rounding_adj + new_total = Sale.get_rounding_adjustment(sale_data.grand_total) + else + new_total = sale_data.grand_total + end + @rounding_adj = new_total-sale_data.grand_total + + sale_data.sale_payments.each do |sale_payment| + if sale_payment.payment_method == "jcb" + @jcbcount = @jcbcount + sale_payment.payment_amount + else + others = others + sale_payment.payment_amount + end + end + @can_jcb = total - @jcbcount - others - @payment_method_setting_nav = PaymentMethodSetting.all - @shop = Shop::ShopDetail - if @shop.is_rounding_adj - new_total = Sale.get_rounding_adjustment(sale_data.grand_total) - else - new_total = sale_data.grand_total + @member_discount = MembershipSetting.find_by_discount(1) + @sub_total = sale_data.total_amount + @membership_id = sale_data.customer.membership_id + #for bank integration + @receipt_no = sale_data.receipt_no end - @rounding_adj = new_total-sale_data.grand_total - - sale_data.sale_payments.each do |sale_payment| - if sale_payment.payment_method == "jcb" - @jcbcount = @jcbcount + sale_payment.payment_amount - else - others = others + sale_payment.payment_amount - end - end - @can_jcb = total - @jcbcount - others - @member_discount = MembershipSetting.find_by_discount(1) - @sub_total = sale_data.total_amount - @membership_id = sale_data.customer.membership_id - #for bank integration - @receipt_no = sale_data.receipt_no bank_integration = Lookup.collection_of('bank_integration') @bank_integration = 0 if !bank_integration[0].nil? @@ -59,4 +69,9 @@ class Origami::JcbController < BaseOrigamiController end end + #Shop Name in Navbor + helper_method :shop_detail + def shop_detail + @shop = Shop.first + end end diff --git a/app/controllers/origami/master_controller.rb b/app/controllers/origami/master_controller.rb old mode 100755 new mode 100644 index 77ae99d2..858d0125 --- a/app/controllers/origami/master_controller.rb +++ b/app/controllers/origami/master_controller.rb @@ -5,32 +5,41 @@ class Origami::MasterController < BaseOrigamiController @cashier_type = params[:type] # limit master_amount sale_data = Sale.find_by_sale_id(@sale_id) - total = sale_data.grand_total + total = 0 @mastercount = 0 - others = 0 - - @payment_method_setting_nav = PaymentMethodSetting.all - @shop = Shop::ShopDetail - if @shop.is_rounding_adj - new_total = Sale.get_rounding_adjustment(sale_data.grand_total) - else - new_total = sale_data.grand_total - end - @rounding_adj = new_total-sale_data.grand_total + @shop = Shop::ShopDetail + @rounding_adj = 0 + @can_master = 0 + @member_discount = 0 + @sub_total = 0 + @membership_id = nil + @receipt_no = nil + if !sale_data.nil? + total = sale_data.grand_total + + others = 0 + + if @shop.is_rounding_adj + new_total = Sale.get_rounding_adjustment(sale_data.grand_total) + else + new_total = sale_data.grand_total + end + @rounding_adj = new_total-sale_data.grand_total - sale_data.sale_payments.each do |sale_payment| - if sale_payment.payment_method == "master" - @mastercount = @mastercount + sale_payment.payment_amount - else - others = others + sale_payment.payment_amount - end + sale_data.sale_payments.each do |sale_payment| + if sale_payment.payment_method == "master" + @mastercount = @mastercount + sale_payment.payment_amount + else + others = others + sale_payment.payment_amount + end + end + @can_master = total - @mastercount - others + @member_discount = MembershipSetting.find_by_discount(1) + @sub_total = sale_data.total_amount + @membership_id = sale_data.customer.membership_id + #for bank integration + @receipt_no = sale_data.receipt_no end - @can_master = total - @mastercount - others - @member_discount = MembershipSetting.find_by_discount(1) - @sub_total = sale_data.total_amount - @membership_id = sale_data.customer.membership_id - #for bank integration - @receipt_no = sale_data.receipt_no bank_integration = Lookup.collection_of('bank_integration') @bank_integration = 0 if !bank_integration[0].nil? @@ -58,4 +67,9 @@ class Origami::MasterController < BaseOrigamiController end end + #Shop Name in Navbor + helper_method :shop_detail + def shop_detail + @shop = Shop.first + end end diff --git a/app/controllers/origami/mpu_controller.rb b/app/controllers/origami/mpu_controller.rb old mode 100755 new mode 100644 index c3f74133..1b125bda --- a/app/controllers/origami/mpu_controller.rb +++ b/app/controllers/origami/mpu_controller.rb @@ -4,33 +4,43 @@ class Origami::MpuController < BaseOrigamiController @cashier_type = params[:type] # limit mpu_amount sale_data = Sale.find_by_sale_id(@sale_id) - total = sale_data.grand_total + total = 0 @mpucount = 0 - others = 0 - - @payment_method_setting_nav = PaymentMethodSetting.all @shop = Shop::ShopDetail - if @shop.is_rounding_adj - new_total = Sale.get_rounding_adjustment(sale_data.grand_total) - else - new_total = sale_data.grand_total - end - @rounding_adj = new_total-sale_data.grand_total - - sale_data.sale_payments.each do |sale_payment| - if sale_payment.payment_method == "mpu" - @mpucount = @mpucount + sale_payment.payment_amount - else - others = others + sale_payment.payment_amount - end - end - @can_mpu = total - @mpucount - others + @rounding_adj = 0 + @can_mpu = 0 + @member_discount = 0 + @sub_total = 0 + @membership_id = nil + @receipt_no = nil + if !sale_data.nil? + total = sale_data.grand_total + + others = 0 + + if @shop.is_rounding_adj + new_total = Sale.get_rounding_adjustment(sale_data.grand_total) + else + new_total = sale_data.grand_total + end + @rounding_adj = new_total-sale_data.grand_total + + sale_data.sale_payments.each do |sale_payment| + if sale_payment.payment_method == "mpu" + @mpucount = @mpucount + sale_payment.payment_amount + else + others = others + sale_payment.payment_amount + end + end + @can_mpu = total - @mpucount - others + + @member_discount = MembershipSetting.find_by_discount(1) + @sub_total = sale_data.total_amount + @membership_id = sale_data.customer.membership_id + #for bank integration + @receipt_no = sale_data.receipt_no + end - @member_discount = MembershipSetting.find_by_discount(1) - @sub_total = sale_data.total_amount - @membership_id = sale_data.customer.membership_id - #for bank integration - @receipt_no = sale_data.receipt_no bank_integration = Lookup.collection_of('bank_integration') @bank_integration = 0 if !bank_integration[0].nil? @@ -58,4 +68,9 @@ class Origami::MpuController < BaseOrigamiController end end + #Shop Name in Navbor + helper_method :shop_detail + def shop_detail + @shop = Shop.first + end end diff --git a/app/controllers/origami/payments_controller.rb b/app/controllers/origami/payments_controller.rb index f9aaa51c..edee8a03 100755 --- a/app/controllers/origami/payments_controller.rb +++ b/app/controllers/origami/payments_controller.rb @@ -177,8 +177,11 @@ class Origami::PaymentsController < BaseOrigamiController end booking.booking_orders.each do |order| - Order.pay_process_order_queue(order.order_id,table_id) + # Order.pay_process_order_queue(order.order_id, table_id) + oqs = OrderQueueStation.new + oqs.pay_process_order_queue(order.order_id, table_id) end + end #for card sale data diff --git a/app/controllers/origami/unionpay_controller.rb b/app/controllers/origami/unionpay_controller.rb index 707a1022..7213af6d 100644 --- a/app/controllers/origami/unionpay_controller.rb +++ b/app/controllers/origami/unionpay_controller.rb @@ -4,32 +4,40 @@ class Origami::UnionpayController < BaseOrigamiController @cashier_type = params[:type] # limit unionpay_amount sale_data = Sale.find_by_sale_id(@sale_id) - total = sale_data.grand_total + total = 0 @unionpaycount = 0 - others = 0 - - @payment_method_setting_nav = PaymentMethodSetting.all @shop = Shop::ShopDetail - if @shop.is_rounding_adj - new_total = Sale.get_rounding_adjustment(sale_data.grand_total) - else - new_total = sale_data.grand_total + @rounding_adj = 0 + @can_unionpay = 0 + @member_discount = 0 + @sub_total = 0 + @membership_id = nil + @receipt_no = nil + if !sale_data.nil? + total = sale_data.grand_total + others = 0 + + if @shop.is_rounding_adj + new_total = Sale.get_rounding_adjustment(sale_data.grand_total) + else + new_total = sale_data.grand_total + end + @rounding_adj = new_total-sale_data.grand_total + + sale_data.sale_payments.each do |sale_payment| + if sale_payment.payment_method == "unionpay" + @unionpaycount = @unionpaycount + sale_payment.payment_amount + else + others = others + sale_payment.payment_amount + end + end + @can_unionpay = total - @unionpaycount - others + @member_discount = MembershipSetting.find_by_discount(1) + @sub_total = sale_data.total_amount + @membership_id = sale_data.customer.membership_id + #for bank integration + @receipt_no = sale_data.receipt_no end - @rounding_adj = new_total-sale_data.grand_total - - sale_data.sale_payments.each do |sale_payment| - if sale_payment.payment_method == "unionpay" - @unionpaycount = @unionpaycount + sale_payment.payment_amount - else - others = others + sale_payment.payment_amount - end - end - @can_unionpay = total - @unionpaycount - others - @member_discount = MembershipSetting.find_by_discount(1) - @sub_total = sale_data.total_amount - @membership_id = sale_data.customer.membership_id - #for bank integration - @receipt_no = sale_data.receipt_no bank_integration = Lookup.collection_of('bank_integration') @bank_integration = 0 if !bank_integration[0].nil? @@ -58,4 +66,9 @@ class Origami::UnionpayController < BaseOrigamiController end end + #Shop Name in Navbor + helper_method :shop_detail + def shop_detail + @shop = Shop.first + end end diff --git a/app/controllers/origami/visa_controller.rb b/app/controllers/origami/visa_controller.rb old mode 100755 new mode 100644 index 788704eb..346b66d1 --- a/app/controllers/origami/visa_controller.rb +++ b/app/controllers/origami/visa_controller.rb @@ -4,32 +4,40 @@ class Origami::VisaController < BaseOrigamiController @cashier_type = params[:type] # limit visa_amount sale_data = Sale.find_by_sale_id(@sale_id) - total = sale_data.grand_total + total = 0 @visacount = 0 - others = 0 - - @payment_method_setting_nav = PaymentMethodSetting.all @shop = Shop::ShopDetail - if @shop.is_rounding_adj - new_total = Sale.get_rounding_adjustment(sale_data.grand_total) - else - new_total = sale_data.grand_total + @rounding_adj = 0 + @can_visa = 0 + @member_discount = 0 + @sub_total = 0 + @membership_id = nil + @receipt_no = nil + if !sale_data.nil? + total = sale_data.grand_total + others = 0 + + if @shop.is_rounding_adj + new_total = Sale.get_rounding_adjustment(sale_data.grand_total) + else + new_total = sale_data.grand_total + end + @rounding_adj = new_total-sale_data.grand_total + + sale_data.sale_payments.each do |sale_payment| + if sale_payment.payment_method == "visa" + @visacount = @visacount + sale_payment.payment_amount + else + others = others + sale_payment.payment_amount + end + end + @can_visa = total - @visacount - others + @member_discount = MembershipSetting.find_by_discount(1) + @sub_total = sale_data.total_amount + @membership_id = sale_data.customer.membership_id + #for bank integration + @receipt_no = sale_data.receipt_no end - @rounding_adj = new_total-sale_data.grand_total - - sale_data.sale_payments.each do |sale_payment| - if sale_payment.payment_method == "visa" - @visacount = @visacount + sale_payment.payment_amount - else - others = others + sale_payment.payment_amount - end - end - @can_visa = total - @visacount - others - @member_discount = MembershipSetting.find_by_discount(1) - @sub_total = sale_data.total_amount - @membership_id = sale_data.customer.membership_id - #for bank integration - @receipt_no = sale_data.receipt_no bank_integration = Lookup.collection_of('bank_integration') @bank_integration = 0 if !bank_integration[0].nil? @@ -58,4 +66,9 @@ class Origami::VisaController < BaseOrigamiController end end + #Shop Name in Navbor + helper_method :shop_detail + def shop_detail + @shop = Shop.first + end end diff --git a/app/models/order.rb b/app/models/order.rb index 25c5db4a..fcc8b6c2 100755 --- a/app/models/order.rb +++ b/app/models/order.rb @@ -71,9 +71,9 @@ class Order < ApplicationRecord BookingOrder.create({:booking_id => booking.booking_id, :order => self}) #Send order to queue one it done! - if self.source != "quick_service" + # if self.source != "quick_service" process_order_queue - end + # end #send order to broadcast job send_order_broadcast(booking) @@ -297,7 +297,7 @@ class Order < ApplicationRecord else if order oqs = OrderQueueStation.new - oqs.process_order(order, self.table_id) + oqs.process_order(order, self.table_id, self.source) end assign_order = AssignedOrderItem.assigned_order_item_by_job(self.id) ActionCable.server.broadcast "order_queue_station_channel",order: assign_order @@ -313,7 +313,7 @@ class Order < ApplicationRecord else if order oqs = OrderQueueStation.new - oqs.process_order(order, self.table_id) + oqs.process_order(order, self.table_id, self.source) end assign_order = AssignedOrderItem.assigned_order_item_by_job(self.id) ActionCable.server.broadcast "order_queue_station_channel",order: assign_order @@ -326,7 +326,7 @@ class Order < ApplicationRecord else if order oqs = OrderQueueStation.new - oqs.process_order(order, self.table_id) + oqs.process_order(order, self.table_id, self.source) end assign_order = AssignedOrderItem.assigned_order_item_by_job(self.id) ActionCable.server.broadcast "order_queue_station_channel",order: assign_order diff --git a/app/models/order_queue_station.rb b/app/models/order_queue_station.rb index af544ce5..3380f244 100755 --- a/app/models/order_queue_station.rb +++ b/app/models/order_queue_station.rb @@ -101,6 +101,80 @@ class OrderQueueStation < ApplicationRecord end #end else end + def pay_process_order_queue (order_id, table_id) + + oqs_stations = OrderQueueStation.active + + order = Order.find(order_id) + order_items = order.order_items + + if table_id.to_i > 0 + # get dining + dining = DiningFacility.find(table_id) + oqs_by_zones = OrderQueueProcessByZone.where("zone_id=#{dining.zone_id}") + booking = Booking.find_by_dining_facility_id(dining.id) + + # ToDo per item per printer + + oqs_by_zones.each do |oqpbz| + oqs = OrderQueueStation.find(oqpbz.order_queue_station_id) + is_auto_printed = false + oqs_order_items = [] + + if oqs.is_active + #Get List of items - + pq_items = JSON.parse(oqs.processing_items) + #Loop through the processing items + pq_items.each do |pq_item| + #Processing through the looping items + order_items.each do |order_item| + if (pq_item == order_item.item_code) + if (order_item.qty > 0) + oqs_order_items.push(order_item) + end + end + end + end + + if oqs.auto_print + if oqs_order_items.length > 0 + print_slip(oqs, order, oqs_order_items) + is_auto_printed = true + end + end + end + end + else + oqs_stations.each do |oqs| + is_auto_printed = false + oqs_order_items = [] + + if oqs.is_active + #Get List of items - + pq_items = JSON.parse(oqs.processing_items) + #Loop through the processing items + pq_items.each do |pq_item| + #Processing through the looping items + order_items.each do |order_item| + if (pq_item == order_item.item_code) + if (order_item.qty > 0) + oqs_order_items.push(order_item) + end + end + end + end + + if oqs.auto_print + if oqs_order_items.length > 0 + print_slip(oqs, order, oqs_order_items) + is_auto_printed = true + end + end + end + end + end #end else + end + private #Print order_items in 1 slip def print_slip(oqs, order, order_items) diff --git a/app/models/sale_payment.rb b/app/models/sale_payment.rb index b82cbf18..91a4db1e 100755 --- a/app/models/sale_payment.rb +++ b/app/models/sale_payment.rb @@ -325,6 +325,7 @@ class SalePayment < ApplicationRecord sObj = Sale.find(self.sale_id) is_credit = 0 is_foc = 0 + is_cash = false sObj.sale_payments.each do |spay| all_received_amount += spay.payment_amount.to_f if spay.payment_method == "creditnote" @@ -333,8 +334,12 @@ class SalePayment < ApplicationRecord if spay.payment_method == "foc" is_foc = 1 end + if spay.payment_method.to_s == "cash" + is_cash = true + end end - if (self.sale.grand_total <= all_received_amount) + + if (self.sale.grand_total <= all_received_amount) && is_cash if is_credit == 0 self.sale.payment_status = "paid" else @@ -374,11 +379,15 @@ class SalePayment < ApplicationRecord end self.sale.save! - table_update_status(sObj) if check_foc + table_update_status(sObj) update_shift elsif paid_amount.to_f > 0 #|| paid_amount != "0.0" + table_update_status(sObj) + update_shift + elsif is_cash && paid_amount.to_f == 0 + table_update_status(sObj) update_shift end end diff --git a/app/views/origami/pending_order/index.html.erb b/app/views/origami/pending_order/index.html.erb old mode 100755 new mode 100644 diff --git a/app/views/origami/pending_order/show.html.erb b/app/views/origami/pending_order/show.html.erb index a7ade0a4..19750c4d 100644 --- a/app/views/origami/pending_order/show.html.erb +++ b/app/views/origami/pending_order/show.html.erb @@ -97,13 +97,15 @@ <% end%> <% else%> <% sub_total = 0 + total = 0 @order_items.each do |order_item| - sub_total = sub_total + order_item.price %> + total = order_item.qty * order_item.price + sub_total = sub_total + total %>
- + <% end%> <% end%> @@ -210,7 +212,7 @@ $(document).ready(function(){ swal("Information!", result.error_message); } else { - location.reload(); + window.location.href = '/origami/quick_service/pending_order'; } } }); From 27a3026c2a8642e826a66898149708fdef6887e0 Mon Sep 17 00:00:00 2001 From: phyusin Date: Mon, 19 Mar 2018 19:41:32 +0630 Subject: [PATCH 15/61] oqs edit --- app/models/order_queue_station.rb | 6 +++--- app/views/oqs/edit/index.html.erb | 3 +++ 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/app/models/order_queue_station.rb b/app/models/order_queue_station.rb index 3380f244..889491ed 100755 --- a/app/models/order_queue_station.rb +++ b/app/models/order_queue_station.rb @@ -13,7 +13,7 @@ class OrderQueueStation < ApplicationRecord # validations validates_presence_of :station_name, :printer_name - def process_order (order, table_id) + def process_order (order, table_id, order_source = nil) oqs_stations = OrderQueueStation.active @@ -55,7 +55,7 @@ class OrderQueueStation < ApplicationRecord end end - if oqs.auto_print + if oqs.auto_print && order_source != "quick_service" if oqs_order_items.length > 0 print_slip(oqs, order, oqs_order_items) is_auto_printed = true @@ -90,7 +90,7 @@ class OrderQueueStation < ApplicationRecord end end - if oqs.auto_print + if oqs.auto_print && order_source != "quick_service" if oqs_order_items.length > 0 print_slip(oqs, order, oqs_order_items) is_auto_printed = true diff --git a/app/views/oqs/edit/index.html.erb b/app/views/oqs/edit/index.html.erb index 7a1eebab..70e9a0ff 100644 --- a/app/views/oqs/edit/index.html.erb +++ b/app/views/oqs/edit/index.html.erb @@ -144,9 +144,12 @@ $(document).ready(function(){ }); $('#back').on('click', function () { + var booking_id = '<%= @booking.booking_id %>'; <% if !@link_type.nil? %> <% if @link_type == 'oqs' %> window.location.href = '/oqs'; + <% elsif @link_type == 'pending' %> + window.location.href = '/origami/quick_service/pending_order/'+booking_id; <% else %> <% if !@dining_type.nil? %> <% if @dining_type == 'Table' %> From 829c09040d6bbf3c531a7d9c41698c6c15a2eb73 Mon Sep 17 00:00:00 2001 From: phyusin Date: Tue, 20 Mar 2018 09:54:15 +0630 Subject: [PATCH 16/61] delete receipts --- .gitignore | 2 +- public/receipts/receipt_bill_20180219-75.pdf | 483 ------------------ .../receipt_bill_qwer-20180307-77.pdf | 455 ----------------- .../receipt_bill_qwer-20180307-78.pdf | 455 ----------------- .../receipt_bill_qwer-20180307-79.pdf | 455 ----------------- .../receipt_bill_qwer-20180307-80.pdf | 455 ----------------- .../receipt_bill_qwer-20180307-81.pdf | 455 ----------------- .../receipt_bill_qwer-20180307-82.pdf | 455 ----------------- .../receipt_bill_qwer-20180307-83.pdf | 455 ----------------- 9 files changed, 1 insertion(+), 3669 deletions(-) delete mode 100644 public/receipts/receipt_bill_20180219-75.pdf delete mode 100644 public/receipts/receipt_bill_qwer-20180307-77.pdf delete mode 100644 public/receipts/receipt_bill_qwer-20180307-78.pdf delete mode 100644 public/receipts/receipt_bill_qwer-20180307-79.pdf delete mode 100644 public/receipts/receipt_bill_qwer-20180307-80.pdf delete mode 100644 public/receipts/receipt_bill_qwer-20180307-81.pdf delete mode 100644 public/receipts/receipt_bill_qwer-20180307-82.pdf delete mode 100644 public/receipts/receipt_bill_qwer-20180307-83.pdf diff --git a/.gitignore b/.gitignore index b404db53..e32934b1 100755 --- a/.gitignore +++ b/.gitignore @@ -26,7 +26,7 @@ capybara-*.html /public/assets/* /public/uploads/* /public/swf/* -/public/receipts +/public/receipts/ /coverage/ /spec/tmp/* *.orig diff --git a/public/receipts/receipt_bill_20180219-75.pdf b/public/receipts/receipt_bill_20180219-75.pdf deleted file mode 100644 index 95238846..00000000 --- a/public/receipts/receipt_bill_20180219-75.pdf +++ /dev/null @@ -1,483 +0,0 @@ -%PDF-1.3 -%ÿÿÿÿ -1 0 obj -<< /Creator -/Producer ->> -endobj -2 0 obj -<< /Type /Catalog -/Pages 3 0 R ->> -endobj -3 0 obj -<< /Type /Pages -/Count 1 -/Kids [5 0 R] ->> -endobj -4 0 obj -<< /Length 4242 ->> -stream -q - -BT -48.975 1417.82 Td -/F1.0 10 Tf -[<4f53414b41204f4853484f2854> 120 <616d77> 10 <6529>] TJ -ET - - -BT -10.268 1402.696 Td -/F1.0 8 Tf -[<4e6f> 40 <2e203235362c204b> 50 <79> 20 <61696b6b6173616e20526f61642c2054> 120 <616d77> 10 <652054> 120 <6f> 15 <776e73686970> 35 <2c2059> 140 <616e676f6e>] TJ -ET - - -BT -71.904 1388.448 Td -/F1.0 8 Tf -[<54> 120 <656c3a2030392d323538363736363131>] TJ -ET - -0.0 1379.944 m -210.0 1379.944 l -S -0.0 1379.944 m -210.0 1379.944 l -S - -BT -0.0 1367.2 Td -/F1.0 8 Tf -[<52656365697074204e6f3a2032303138303231392d3735>] TJ -ET - - -BT -0.0 1347.2 Td -/F1.0 8 Tf -[<54> 120 <6162> 20 <6c65202d207432>] TJ -ET - - -BT -100.0 1347.2 Td -/F1.0 8 Tf -[<573a2043617368696572>] TJ -ET - - -BT -160.216 1347.2 Td -/F1.0 8 Tf -[<433a2043617368696572>] TJ -ET - - -BT -0.0 1327.2 Td -/F1.0 8 Tf -[<44617465203a2031392d30322d323031382831303a323920414d2d31303a333620414d29>] TJ -ET - -0.0 1312.944 m -210.0 1312.944 l -S - -BT -0.0 1302.2 Td -/F1.0 8 Tf -[<4974656d73>] TJ -ET - - -BT -106.656 1302.2 Td -/F1.0 8 Tf -[<5072> -15 <696365>] TJ -ET - - -BT -138.276 1302.2 Td -/F1.0 8 Tf -[<517479>] TJ -ET - - -BT -187.176 1302.2 Td -/F1.0 8 Tf -[<54> 120 <6f74616c>] TJ -ET - -0.0 1292.944 m -210.0 1292.944 l -S - -BT -0.0 1282.2 Td -/F1.0 8 Tf -[<56> 80 <6f646b61202d>] TJ -ET - - -BT -93.864 1282.2 Td -/F1.0 8 Tf -[<31302c3030302e30>] TJ -ET - - -BT -138.94 1282.2 Td -/F1.0 8 Tf -[<312e30>] TJ -ET - - -BT -172.864 1282.2 Td -/F1.0 8 Tf -[<31302c3030302e30>] TJ -ET - - -BT -0.0 1267.952 Td -/F1.0 8 Tf -[<746573745f6974656d31202d>] TJ -ET - - -BT -0.0 1258.704 Td -/F1.0 8 Tf -[<74657374315f736d616c6c>] TJ -ET - - -BT -98.312 1267.952 Td -/F1.0 8 Tf -[<312c3030302e30>] TJ -ET - - -BT -138.94 1267.952 Td -/F1.0 8 Tf -[<312e30>] TJ -ET - - -BT -177.312 1267.952 Td -/F1.0 8 Tf -[<312c3030302e30>] TJ -ET - -0.0 1250.2 m -210.0 1250.2 l -S - -BT -0.0 1239.456 Td -/F1.0 8 Tf -[<5375622054> 120 <6f74616c>] TJ -ET - - -BT -170.864 1239.456 Td -/F1.0 8 Tf -[<31312c3030302e30>] TJ -ET - - -BT -0.0 1225.208 Td -/F1.0 8 Tf -[<4f76> 25 <6572> 10 <616c6c20446973636f756e743a>] TJ -ET - - -BT -181.104 1225.208 Td -/F1.0 8 Tf -[<2820302e302029>] TJ -ET - - -BT -0.0 1210.96 Td -/F1.0 8 Tf -[<536572> -30 <76696365204368617267657320282031302529>] TJ -ET - - -BT -175.312 1210.96 Td -/F1.0 8 Tf -[<312c3130302e30>] TJ -ET - - -BT -0.0 1196.712 Td -/F1.0 8 Tf -[<436f6d6d65726369616c2054> 120 <6178202820352529>] TJ -ET - - -BT -181.984 1196.712 Td -/F1.0 8 Tf -[<3535302e30>] TJ -ET - - -BT -0.0 1181.028 Td -/F2.0 10 Tf -[<4772616e642054> 80 <6f74616c>] TJ -ET - - -BT -163.08 1181.028 Td -/F2.0 10 Tf -[<31322c3635302e30>] TJ -ET - -0.0 1171.308 m -210.0 1171.308 l -S - -BT -0.0 1160.564 Td -/F1.0 8 Tf -[<436173682050> 40 <61> 30 <796d656e74>] TJ -ET - - -BT -170.864 1160.564 Td -/F1.0 8 Tf -[<31322c3635302e30>] TJ -ET - - -BT -0.0 1146.316 Td -/F1.0 8 Tf -[<4368616e676520416d6f756e74>] TJ -ET - - -BT -190.88 1146.316 Td -/F1.0 8 Tf -[<302e30>] TJ -ET - - -BT -0.0 1127.068 Td -/F1.0 8 Tf -[<437573746f6d6572204e616d65>] TJ -ET - - -BT -169.064 1127.068 Td -/F1.0 8 Tf -[<57> 50 <414c4b2d494e>] TJ -ET - -0.0 1118.564 m -210.0 1118.564 l -S - -BT -0.0 1107.82 Td -/F1.0 8 Tf -[<54> 120 <6f74616c2046> 30 <6f6f6420446973636f756e7473>] TJ -ET - - -BT -185.552 1107.82 Td -/F1.0 8 Tf -[<28302e3029>] TJ -ET - - -BT -0.0 1098.572 Td -/F1.0 8 Tf -[<54> 120 <6f74616c204265> 30 <76> 25 <6572> 10 <61676520446973636f756e7473>] TJ -ET - - -BT -185.552 1098.572 Td -/F1.0 8 Tf -[<28302e3029>] TJ -ET - - -BT -0.0 1089.324 Td -/F1.0 8 Tf -[<54> 120 <6f74616c2050726f6475637420446973636f756e7473>] TJ -ET - - -BT -185.552 1089.324 Td -/F1.0 8 Tf -[<28302e3029>] TJ -ET - -0.0 1080.82 m -210.0 1080.82 l -S - -BT -0.0 1070.076 Td -/F1.0 8 Tf -[<46> 30 <6f6f64>] TJ -ET - - -BT -175.312 1070.076 Td -/F1.0 8 Tf -[<312c3030302e30>] TJ -ET - - -BT -0.0 1060.828 Td -/F1.0 8 Tf -[<4265> 30 <76> 25 <6572> 10 <616765>] TJ -ET - - -BT -170.864 1060.828 Td -/F1.0 8 Tf -[<31302c3030302e30>] TJ -ET - - -BT -0.0 1051.58 Td -/F1.0 8 Tf -[<50726f64756374>] TJ -ET - - -BT -190.88 1051.58 Td -/F1.0 8 Tf -[<302e30>] TJ -ET - -0.0 1043.076 m -210.0 1043.076 l -S - -BT -0.0 1031.614 Td -/F1.0 9 Tf -[<53706c69742042696c6c2066> 30 <6f72203020706572736f6e73>] TJ -ET - - -BT -0.0 1017.332 Td -/F1.0 8 Tf -[<416d6f756e7420447565202870657220706572736f6e29>] TJ -ET - - -BT -193.104 1017.332 Td -/F1.0 8 Tf -[<496e66>] TJ -ET - -0.0 1008.828 m -210.0 1008.828 l -S - -BT -0.0 996.648 Td -/F2.0 10 Tf -[<50> 30 <616964>] TJ -ET - - -BT -102.0 998.084 Td -/F1.0 8 Tf -[<5468616e6b2059> 140 <6f7521205365652079> 20 <6f7520416761696e>] TJ -ET - -Q - -endstream -endobj -5 0 obj -<< /Type /Page -/Parent 3 0 R -/MediaBox [0 0 210 1450] -/CropBox [0 0 210 1450] -/BleedBox [0 0 210 1450] -/TrimBox [0 0 210 1450] -/ArtBox [0 0 210 1450] -/Contents 4 0 R -/Resources << /ProcSet [/PDF /Text /ImageB /ImageC /ImageI] -/Font << /F1.0 6 0 R -/F2.0 7 0 R ->> ->> ->> -endobj -6 0 obj -<< /Type /Font -/Subtype /Type1 -/BaseFont /Helvetica -/Encoding /WinAnsiEncoding ->> -endobj -7 0 obj -<< /Type /Font -/Subtype /Type1 -/BaseFont /Helvetica-Bold -/Encoding /WinAnsiEncoding ->> -endobj -xref -0 8 -0000000000 65535 f -0000000015 00000 n -0000000109 00000 n -0000000158 00000 n -0000000215 00000 n -0000004509 00000 n -0000004792 00000 n -0000004889 00000 n -trailer -<< /Size 8 -/Root 2 0 R -/Info 1 0 R ->> -startxref -4991 -%%EOF diff --git a/public/receipts/receipt_bill_qwer-20180307-77.pdf b/public/receipts/receipt_bill_qwer-20180307-77.pdf deleted file mode 100644 index 13df612b..00000000 --- a/public/receipts/receipt_bill_qwer-20180307-77.pdf +++ /dev/null @@ -1,455 +0,0 @@ -%PDF-1.3 -%ÿÿÿÿ -1 0 obj -<< /Creator -/Producer ->> -endobj -2 0 obj -<< /Type /Catalog -/Pages 3 0 R ->> -endobj -3 0 obj -<< /Type /Pages -/Count 1 -/Kids [5 0 R] ->> -endobj -4 0 obj -<< /Length 4003 ->> -stream -q - -BT -48.975 1417.82 Td -/F1.0 10 Tf -[<4f53414b41204f4853484f2854> 120 <616d77> 10 <6529>] TJ -ET - - -BT -10.268 1402.696 Td -/F1.0 8 Tf -[<4e6f> 40 <2e203235362c204b> 50 <79> 20 <61696b6b6173616e20526f61642c2054> 120 <616d77> 10 <652054> 120 <6f> 15 <776e73686970> 35 <2c2059> 140 <616e676f6e>] TJ -ET - - -BT -71.904 1388.448 Td -/F1.0 8 Tf -[<54> 120 <656c3a2030392d323538363736363131>] TJ -ET - -0.0 1379.944 m -210.0 1379.944 l -S -0.0 1379.944 m -210.0 1379.944 l -S - -BT -0.0 1367.2 Td -/F1.0 8 Tf -[<52656365697074204e6f3a207177> 10 <65722d32303138303330372d3737>] TJ -ET - - -BT -0.0 1347.2 Td -/F1.0 8 Tf -[<54> 120 <6162> 20 <6c65202d207431>] TJ -ET - - -BT -100.0 1347.2 Td -/F1.0 8 Tf -[<573a2043617368696572>] TJ -ET - - -BT -160.216 1347.2 Td -/F1.0 8 Tf -[<433a2043617368696572>] TJ -ET - - -BT -0.0 1327.2 Td -/F1.0 8 Tf -[<44617465203a2030372d30332d323031382830353a333320504d2d30353a353020504d29>] TJ -ET - -0.0 1312.944 m -210.0 1312.944 l -S - -BT -0.0 1302.2 Td -/F1.0 8 Tf -[<4974656d73>] TJ -ET - - -BT -106.656 1302.2 Td -/F1.0 8 Tf -[<5072> -15 <696365>] TJ -ET - - -BT -138.276 1302.2 Td -/F1.0 8 Tf -[<517479>] TJ -ET - - -BT -187.176 1302.2 Td -/F1.0 8 Tf -[<54> 120 <6f74616c>] TJ -ET - -0.0 1292.944 m -210.0 1292.944 l -S - -BT -0.0 1282.2 Td -/F1.0 8 Tf -[<746573745f6974656d31202d>] TJ -ET - - -BT -0.0 1272.952 Td -/F1.0 8 Tf -[<74657374315f736d616c6c>] TJ -ET - - -BT -98.312 1282.2 Td -/F1.0 8 Tf -[<312c3030302e30>] TJ -ET - - -BT -138.94 1282.2 Td -/F1.0 8 Tf -[<312e30>] TJ -ET - - -BT -177.312 1282.2 Td -/F1.0 8 Tf -[<312c3030302e30>] TJ -ET - -0.0 1264.448 m -210.0 1264.448 l -S - -BT -0.0 1253.704 Td -/F1.0 8 Tf -[<5375622054> 120 <6f74616c>] TJ -ET - - -BT -175.312 1253.704 Td -/F1.0 8 Tf -[<312c3030302e30>] TJ -ET - - -BT -0.0 1239.456 Td -/F1.0 8 Tf -[<4f76> 25 <6572> 10 <616c6c20446973636f756e743a>] TJ -ET - - -BT -181.104 1239.456 Td -/F1.0 8 Tf -[<2820302e302029>] TJ -ET - - -BT -0.0 1225.208 Td -/F1.0 8 Tf -[<536572> -30 <76696365204368617267657320282031302529>] TJ -ET - - -BT -181.984 1225.208 Td -/F1.0 8 Tf -[<3130302e30>] TJ -ET - - -BT -0.0 1210.96 Td -/F1.0 8 Tf -[<436f6d6d65726369616c2054> 120 <6178202820352529>] TJ -ET - - -BT -186.432 1210.96 Td -/F1.0 8 Tf -[<35302e30>] TJ -ET - - -BT -0.0 1195.276 Td -/F2.0 10 Tf -[<4772616e642054> 80 <6f74616c>] TJ -ET - - -BT -168.64 1195.276 Td -/F2.0 10 Tf -[<312c3135302e30>] TJ -ET - -0.0 1185.556 m -210.0 1185.556 l -S - -BT -0.0 1174.812 Td -/F1.0 8 Tf -[<436173682050> 40 <61> 30 <796d656e74>] TJ -ET - - -BT -175.312 1174.812 Td -/F1.0 8 Tf -[<312c3135302e30>] TJ -ET - - -BT -0.0 1160.564 Td -/F1.0 8 Tf -[<4368616e676520416d6f756e74>] TJ -ET - - -BT -190.88 1160.564 Td -/F1.0 8 Tf -[<302e30>] TJ -ET - - -BT -0.0 1141.316 Td -/F1.0 8 Tf -[<437573746f6d6572204e616d65>] TJ -ET - - -BT -169.064 1141.316 Td -/F1.0 8 Tf -[<57> 50 <414c4b2d494e>] TJ -ET - -0.0 1132.812 m -210.0 1132.812 l -S - -BT -0.0 1122.068 Td -/F1.0 8 Tf -[<54> 120 <6f74616c2046> 30 <6f6f6420446973636f756e7473>] TJ -ET - - -BT -185.552 1122.068 Td -/F1.0 8 Tf -[<28302e3029>] TJ -ET - - -BT -0.0 1112.82 Td -/F1.0 8 Tf -[<54> 120 <6f74616c204265> 30 <76> 25 <6572> 10 <61676520446973636f756e7473>] TJ -ET - - -BT -185.552 1112.82 Td -/F1.0 8 Tf -[<28302e3029>] TJ -ET - - -BT -0.0 1103.572 Td -/F1.0 8 Tf -[<54> 120 <6f74616c2050726f6475637420446973636f756e7473>] TJ -ET - - -BT -185.552 1103.572 Td -/F1.0 8 Tf -[<28302e3029>] TJ -ET - -0.0 1095.068 m -210.0 1095.068 l -S - -BT -0.0 1084.324 Td -/F1.0 8 Tf -[<46> 30 <6f6f64>] TJ -ET - - -BT -175.312 1084.324 Td -/F1.0 8 Tf -[<312c3030302e30>] TJ -ET - - -BT -0.0 1075.076 Td -/F1.0 8 Tf -[<4265> 30 <76> 25 <6572> 10 <616765>] TJ -ET - - -BT -190.88 1075.076 Td -/F1.0 8 Tf -[<302e30>] TJ -ET - - -BT -0.0 1065.828 Td -/F1.0 8 Tf -[<50726f64756374>] TJ -ET - - -BT -190.88 1065.828 Td -/F1.0 8 Tf -[<302e30>] TJ -ET - -0.0 1057.324 m -210.0 1057.324 l -S - -BT -0.0 1045.862 Td -/F1.0 9 Tf -[<53706c69742042696c6c2066> 30 <6f72203020706572736f6e73>] TJ -ET - - -BT -0.0 1031.58 Td -/F1.0 8 Tf -[<416d6f756e7420447565202870657220706572736f6e29>] TJ -ET - - -BT -193.104 1031.58 Td -/F1.0 8 Tf -[<496e66>] TJ -ET - -0.0 1023.076 m -210.0 1023.076 l -S - -BT -0.0 1010.896 Td -/F2.0 10 Tf -[<50> 30 <616964>] TJ -ET - - -BT -102.0 1012.332 Td -/F1.0 8 Tf -[<5468616e6b2059> 140 <6f7521205365652079> 20 <6f7520416761696e>] TJ -ET - -Q - -endstream -endobj -5 0 obj -<< /Type /Page -/Parent 3 0 R -/MediaBox [0 0 210 1450] -/CropBox [0 0 210 1450] -/BleedBox [0 0 210 1450] -/TrimBox [0 0 210 1450] -/ArtBox [0 0 210 1450] -/Contents 4 0 R -/Resources << /ProcSet [/PDF /Text /ImageB /ImageC /ImageI] -/Font << /F1.0 6 0 R -/F2.0 7 0 R ->> ->> ->> -endobj -6 0 obj -<< /Type /Font -/Subtype /Type1 -/BaseFont /Helvetica -/Encoding /WinAnsiEncoding ->> -endobj -7 0 obj -<< /Type /Font -/Subtype /Type1 -/BaseFont /Helvetica-Bold -/Encoding /WinAnsiEncoding ->> -endobj -xref -0 8 -0000000000 65535 f -0000000015 00000 n -0000000109 00000 n -0000000158 00000 n -0000000215 00000 n -0000004270 00000 n -0000004553 00000 n -0000004650 00000 n -trailer -<< /Size 8 -/Root 2 0 R -/Info 1 0 R ->> -startxref -4752 -%%EOF diff --git a/public/receipts/receipt_bill_qwer-20180307-78.pdf b/public/receipts/receipt_bill_qwer-20180307-78.pdf deleted file mode 100644 index 0167d798..00000000 --- a/public/receipts/receipt_bill_qwer-20180307-78.pdf +++ /dev/null @@ -1,455 +0,0 @@ -%PDF-1.3 -%ÿÿÿÿ -1 0 obj -<< /Creator -/Producer ->> -endobj -2 0 obj -<< /Type /Catalog -/Pages 3 0 R ->> -endobj -3 0 obj -<< /Type /Pages -/Count 1 -/Kids [5 0 R] ->> -endobj -4 0 obj -<< /Length 4003 ->> -stream -q - -BT -48.975 1417.82 Td -/F1.0 10 Tf -[<4f53414b41204f4853484f2854> 120 <616d77> 10 <6529>] TJ -ET - - -BT -10.268 1402.696 Td -/F1.0 8 Tf -[<4e6f> 40 <2e203235362c204b> 50 <79> 20 <61696b6b6173616e20526f61642c2054> 120 <616d77> 10 <652054> 120 <6f> 15 <776e73686970> 35 <2c2059> 140 <616e676f6e>] TJ -ET - - -BT -71.904 1388.448 Td -/F1.0 8 Tf -[<54> 120 <656c3a2030392d323538363736363131>] TJ -ET - -0.0 1379.944 m -210.0 1379.944 l -S -0.0 1379.944 m -210.0 1379.944 l -S - -BT -0.0 1367.2 Td -/F1.0 8 Tf -[<52656365697074204e6f3a207177> 10 <65722d32303138303330372d3738>] TJ -ET - - -BT -0.0 1347.2 Td -/F1.0 8 Tf -[<54> 120 <6162> 20 <6c65202d207431>] TJ -ET - - -BT -100.0 1347.2 Td -/F1.0 8 Tf -[<573a2043617368696572>] TJ -ET - - -BT -160.216 1347.2 Td -/F1.0 8 Tf -[<433a2043617368696572>] TJ -ET - - -BT -0.0 1327.2 Td -/F1.0 8 Tf -[<44617465203a2030372d30332d323031382830363a303320504d2d30363a303420504d29>] TJ -ET - -0.0 1312.944 m -210.0 1312.944 l -S - -BT -0.0 1302.2 Td -/F1.0 8 Tf -[<4974656d73>] TJ -ET - - -BT -106.656 1302.2 Td -/F1.0 8 Tf -[<5072> -15 <696365>] TJ -ET - - -BT -138.276 1302.2 Td -/F1.0 8 Tf -[<517479>] TJ -ET - - -BT -187.176 1302.2 Td -/F1.0 8 Tf -[<54> 120 <6f74616c>] TJ -ET - -0.0 1292.944 m -210.0 1292.944 l -S - -BT -0.0 1282.2 Td -/F1.0 8 Tf -[<746573745f6974656d31202d>] TJ -ET - - -BT -0.0 1272.952 Td -/F1.0 8 Tf -[<74657374315f736d616c6c>] TJ -ET - - -BT -98.312 1282.2 Td -/F1.0 8 Tf -[<312c3030302e30>] TJ -ET - - -BT -138.94 1282.2 Td -/F1.0 8 Tf -[<312e30>] TJ -ET - - -BT -177.312 1282.2 Td -/F1.0 8 Tf -[<312c3030302e30>] TJ -ET - -0.0 1264.448 m -210.0 1264.448 l -S - -BT -0.0 1253.704 Td -/F1.0 8 Tf -[<5375622054> 120 <6f74616c>] TJ -ET - - -BT -175.312 1253.704 Td -/F1.0 8 Tf -[<312c3030302e30>] TJ -ET - - -BT -0.0 1239.456 Td -/F1.0 8 Tf -[<4f76> 25 <6572> 10 <616c6c20446973636f756e743a>] TJ -ET - - -BT -181.104 1239.456 Td -/F1.0 8 Tf -[<2820302e302029>] TJ -ET - - -BT -0.0 1225.208 Td -/F1.0 8 Tf -[<536572> -30 <76696365204368617267657320282031302529>] TJ -ET - - -BT -181.984 1225.208 Td -/F1.0 8 Tf -[<3130302e30>] TJ -ET - - -BT -0.0 1210.96 Td -/F1.0 8 Tf -[<436f6d6d65726369616c2054> 120 <6178202820352529>] TJ -ET - - -BT -186.432 1210.96 Td -/F1.0 8 Tf -[<35302e30>] TJ -ET - - -BT -0.0 1195.276 Td -/F2.0 10 Tf -[<4772616e642054> 80 <6f74616c>] TJ -ET - - -BT -168.64 1195.276 Td -/F2.0 10 Tf -[<312c3135302e30>] TJ -ET - -0.0 1185.556 m -210.0 1185.556 l -S - -BT -0.0 1174.812 Td -/F1.0 8 Tf -[<436173682050> 40 <61> 30 <796d656e74>] TJ -ET - - -BT -175.312 1174.812 Td -/F1.0 8 Tf -[<312c3135302e30>] TJ -ET - - -BT -0.0 1160.564 Td -/F1.0 8 Tf -[<4368616e676520416d6f756e74>] TJ -ET - - -BT -190.88 1160.564 Td -/F1.0 8 Tf -[<302e30>] TJ -ET - - -BT -0.0 1141.316 Td -/F1.0 8 Tf -[<437573746f6d6572204e616d65>] TJ -ET - - -BT -169.064 1141.316 Td -/F1.0 8 Tf -[<57> 50 <414c4b2d494e>] TJ -ET - -0.0 1132.812 m -210.0 1132.812 l -S - -BT -0.0 1122.068 Td -/F1.0 8 Tf -[<54> 120 <6f74616c2046> 30 <6f6f6420446973636f756e7473>] TJ -ET - - -BT -185.552 1122.068 Td -/F1.0 8 Tf -[<28302e3029>] TJ -ET - - -BT -0.0 1112.82 Td -/F1.0 8 Tf -[<54> 120 <6f74616c204265> 30 <76> 25 <6572> 10 <61676520446973636f756e7473>] TJ -ET - - -BT -185.552 1112.82 Td -/F1.0 8 Tf -[<28302e3029>] TJ -ET - - -BT -0.0 1103.572 Td -/F1.0 8 Tf -[<54> 120 <6f74616c2050726f6475637420446973636f756e7473>] TJ -ET - - -BT -185.552 1103.572 Td -/F1.0 8 Tf -[<28302e3029>] TJ -ET - -0.0 1095.068 m -210.0 1095.068 l -S - -BT -0.0 1084.324 Td -/F1.0 8 Tf -[<46> 30 <6f6f64>] TJ -ET - - -BT -175.312 1084.324 Td -/F1.0 8 Tf -[<312c3030302e30>] TJ -ET - - -BT -0.0 1075.076 Td -/F1.0 8 Tf -[<4265> 30 <76> 25 <6572> 10 <616765>] TJ -ET - - -BT -190.88 1075.076 Td -/F1.0 8 Tf -[<302e30>] TJ -ET - - -BT -0.0 1065.828 Td -/F1.0 8 Tf -[<50726f64756374>] TJ -ET - - -BT -190.88 1065.828 Td -/F1.0 8 Tf -[<302e30>] TJ -ET - -0.0 1057.324 m -210.0 1057.324 l -S - -BT -0.0 1045.862 Td -/F1.0 9 Tf -[<53706c69742042696c6c2066> 30 <6f72203020706572736f6e73>] TJ -ET - - -BT -0.0 1031.58 Td -/F1.0 8 Tf -[<416d6f756e7420447565202870657220706572736f6e29>] TJ -ET - - -BT -193.104 1031.58 Td -/F1.0 8 Tf -[<496e66>] TJ -ET - -0.0 1023.076 m -210.0 1023.076 l -S - -BT -0.0 1010.896 Td -/F2.0 10 Tf -[<50> 30 <616964>] TJ -ET - - -BT -102.0 1012.332 Td -/F1.0 8 Tf -[<5468616e6b2059> 140 <6f7521205365652079> 20 <6f7520416761696e>] TJ -ET - -Q - -endstream -endobj -5 0 obj -<< /Type /Page -/Parent 3 0 R -/MediaBox [0 0 210 1450] -/CropBox [0 0 210 1450] -/BleedBox [0 0 210 1450] -/TrimBox [0 0 210 1450] -/ArtBox [0 0 210 1450] -/Contents 4 0 R -/Resources << /ProcSet [/PDF /Text /ImageB /ImageC /ImageI] -/Font << /F1.0 6 0 R -/F2.0 7 0 R ->> ->> ->> -endobj -6 0 obj -<< /Type /Font -/Subtype /Type1 -/BaseFont /Helvetica -/Encoding /WinAnsiEncoding ->> -endobj -7 0 obj -<< /Type /Font -/Subtype /Type1 -/BaseFont /Helvetica-Bold -/Encoding /WinAnsiEncoding ->> -endobj -xref -0 8 -0000000000 65535 f -0000000015 00000 n -0000000109 00000 n -0000000158 00000 n -0000000215 00000 n -0000004270 00000 n -0000004553 00000 n -0000004650 00000 n -trailer -<< /Size 8 -/Root 2 0 R -/Info 1 0 R ->> -startxref -4752 -%%EOF diff --git a/public/receipts/receipt_bill_qwer-20180307-79.pdf b/public/receipts/receipt_bill_qwer-20180307-79.pdf deleted file mode 100644 index 8720c5b6..00000000 --- a/public/receipts/receipt_bill_qwer-20180307-79.pdf +++ /dev/null @@ -1,455 +0,0 @@ -%PDF-1.3 -%ÿÿÿÿ -1 0 obj -<< /Creator -/Producer ->> -endobj -2 0 obj -<< /Type /Catalog -/Pages 3 0 R ->> -endobj -3 0 obj -<< /Type /Pages -/Count 1 -/Kids [5 0 R] ->> -endobj -4 0 obj -<< /Length 4003 ->> -stream -q - -BT -48.975 1417.82 Td -/F1.0 10 Tf -[<4f53414b41204f4853484f2854> 120 <616d77> 10 <6529>] TJ -ET - - -BT -10.268 1402.696 Td -/F1.0 8 Tf -[<4e6f> 40 <2e203235362c204b> 50 <79> 20 <61696b6b6173616e20526f61642c2054> 120 <616d77> 10 <652054> 120 <6f> 15 <776e73686970> 35 <2c2059> 140 <616e676f6e>] TJ -ET - - -BT -71.904 1388.448 Td -/F1.0 8 Tf -[<54> 120 <656c3a2030392d323538363736363131>] TJ -ET - -0.0 1379.944 m -210.0 1379.944 l -S -0.0 1379.944 m -210.0 1379.944 l -S - -BT -0.0 1367.2 Td -/F1.0 8 Tf -[<52656365697074204e6f3a207177> 10 <65722d32303138303330372d3739>] TJ -ET - - -BT -0.0 1347.2 Td -/F1.0 8 Tf -[<54> 120 <6162> 20 <6c65202d207432>] TJ -ET - - -BT -100.0 1347.2 Td -/F1.0 8 Tf -[<573a2043617368696572>] TJ -ET - - -BT -160.216 1347.2 Td -/F1.0 8 Tf -[<433a2043617368696572>] TJ -ET - - -BT -0.0 1327.2 Td -/F1.0 8 Tf -[<44617465203a2030372d30332d323031382830363a303620504d2d30363a303620504d29>] TJ -ET - -0.0 1312.944 m -210.0 1312.944 l -S - -BT -0.0 1302.2 Td -/F1.0 8 Tf -[<4974656d73>] TJ -ET - - -BT -106.656 1302.2 Td -/F1.0 8 Tf -[<5072> -15 <696365>] TJ -ET - - -BT -138.276 1302.2 Td -/F1.0 8 Tf -[<517479>] TJ -ET - - -BT -187.176 1302.2 Td -/F1.0 8 Tf -[<54> 120 <6f74616c>] TJ -ET - -0.0 1292.944 m -210.0 1292.944 l -S - -BT -0.0 1282.2 Td -/F1.0 8 Tf -[<746573745f6974656d31202d>] TJ -ET - - -BT -0.0 1272.952 Td -/F1.0 8 Tf -[<74657374315f736d616c6c>] TJ -ET - - -BT -98.312 1282.2 Td -/F1.0 8 Tf -[<312c3030302e30>] TJ -ET - - -BT -138.94 1282.2 Td -/F1.0 8 Tf -[<312e30>] TJ -ET - - -BT -177.312 1282.2 Td -/F1.0 8 Tf -[<312c3030302e30>] TJ -ET - -0.0 1264.448 m -210.0 1264.448 l -S - -BT -0.0 1253.704 Td -/F1.0 8 Tf -[<5375622054> 120 <6f74616c>] TJ -ET - - -BT -175.312 1253.704 Td -/F1.0 8 Tf -[<312c3030302e30>] TJ -ET - - -BT -0.0 1239.456 Td -/F1.0 8 Tf -[<4f76> 25 <6572> 10 <616c6c20446973636f756e743a>] TJ -ET - - -BT -181.104 1239.456 Td -/F1.0 8 Tf -[<2820302e302029>] TJ -ET - - -BT -0.0 1225.208 Td -/F1.0 8 Tf -[<536572> -30 <76696365204368617267657320282031302529>] TJ -ET - - -BT -181.984 1225.208 Td -/F1.0 8 Tf -[<3130302e30>] TJ -ET - - -BT -0.0 1210.96 Td -/F1.0 8 Tf -[<436f6d6d65726369616c2054> 120 <6178202820352529>] TJ -ET - - -BT -186.432 1210.96 Td -/F1.0 8 Tf -[<35302e30>] TJ -ET - - -BT -0.0 1195.276 Td -/F2.0 10 Tf -[<4772616e642054> 80 <6f74616c>] TJ -ET - - -BT -168.64 1195.276 Td -/F2.0 10 Tf -[<312c3135302e30>] TJ -ET - -0.0 1185.556 m -210.0 1185.556 l -S - -BT -0.0 1174.812 Td -/F1.0 8 Tf -[<436173682050> 40 <61> 30 <796d656e74>] TJ -ET - - -BT -175.312 1174.812 Td -/F1.0 8 Tf -[<312c3135302e30>] TJ -ET - - -BT -0.0 1160.564 Td -/F1.0 8 Tf -[<4368616e676520416d6f756e74>] TJ -ET - - -BT -190.88 1160.564 Td -/F1.0 8 Tf -[<302e30>] TJ -ET - - -BT -0.0 1141.316 Td -/F1.0 8 Tf -[<437573746f6d6572204e616d65>] TJ -ET - - -BT -169.064 1141.316 Td -/F1.0 8 Tf -[<57> 50 <414c4b2d494e>] TJ -ET - -0.0 1132.812 m -210.0 1132.812 l -S - -BT -0.0 1122.068 Td -/F1.0 8 Tf -[<54> 120 <6f74616c2046> 30 <6f6f6420446973636f756e7473>] TJ -ET - - -BT -185.552 1122.068 Td -/F1.0 8 Tf -[<28302e3029>] TJ -ET - - -BT -0.0 1112.82 Td -/F1.0 8 Tf -[<54> 120 <6f74616c204265> 30 <76> 25 <6572> 10 <61676520446973636f756e7473>] TJ -ET - - -BT -185.552 1112.82 Td -/F1.0 8 Tf -[<28302e3029>] TJ -ET - - -BT -0.0 1103.572 Td -/F1.0 8 Tf -[<54> 120 <6f74616c2050726f6475637420446973636f756e7473>] TJ -ET - - -BT -185.552 1103.572 Td -/F1.0 8 Tf -[<28302e3029>] TJ -ET - -0.0 1095.068 m -210.0 1095.068 l -S - -BT -0.0 1084.324 Td -/F1.0 8 Tf -[<46> 30 <6f6f64>] TJ -ET - - -BT -175.312 1084.324 Td -/F1.0 8 Tf -[<312c3030302e30>] TJ -ET - - -BT -0.0 1075.076 Td -/F1.0 8 Tf -[<4265> 30 <76> 25 <6572> 10 <616765>] TJ -ET - - -BT -190.88 1075.076 Td -/F1.0 8 Tf -[<302e30>] TJ -ET - - -BT -0.0 1065.828 Td -/F1.0 8 Tf -[<50726f64756374>] TJ -ET - - -BT -190.88 1065.828 Td -/F1.0 8 Tf -[<302e30>] TJ -ET - -0.0 1057.324 m -210.0 1057.324 l -S - -BT -0.0 1045.862 Td -/F1.0 9 Tf -[<53706c69742042696c6c2066> 30 <6f72203020706572736f6e73>] TJ -ET - - -BT -0.0 1031.58 Td -/F1.0 8 Tf -[<416d6f756e7420447565202870657220706572736f6e29>] TJ -ET - - -BT -193.104 1031.58 Td -/F1.0 8 Tf -[<496e66>] TJ -ET - -0.0 1023.076 m -210.0 1023.076 l -S - -BT -0.0 1010.896 Td -/F2.0 10 Tf -[<50> 30 <616964>] TJ -ET - - -BT -102.0 1012.332 Td -/F1.0 8 Tf -[<5468616e6b2059> 140 <6f7521205365652079> 20 <6f7520416761696e>] TJ -ET - -Q - -endstream -endobj -5 0 obj -<< /Type /Page -/Parent 3 0 R -/MediaBox [0 0 210 1450] -/CropBox [0 0 210 1450] -/BleedBox [0 0 210 1450] -/TrimBox [0 0 210 1450] -/ArtBox [0 0 210 1450] -/Contents 4 0 R -/Resources << /ProcSet [/PDF /Text /ImageB /ImageC /ImageI] -/Font << /F1.0 6 0 R -/F2.0 7 0 R ->> ->> ->> -endobj -6 0 obj -<< /Type /Font -/Subtype /Type1 -/BaseFont /Helvetica -/Encoding /WinAnsiEncoding ->> -endobj -7 0 obj -<< /Type /Font -/Subtype /Type1 -/BaseFont /Helvetica-Bold -/Encoding /WinAnsiEncoding ->> -endobj -xref -0 8 -0000000000 65535 f -0000000015 00000 n -0000000109 00000 n -0000000158 00000 n -0000000215 00000 n -0000004270 00000 n -0000004553 00000 n -0000004650 00000 n -trailer -<< /Size 8 -/Root 2 0 R -/Info 1 0 R ->> -startxref -4752 -%%EOF diff --git a/public/receipts/receipt_bill_qwer-20180307-80.pdf b/public/receipts/receipt_bill_qwer-20180307-80.pdf deleted file mode 100644 index e1ecd3dd..00000000 --- a/public/receipts/receipt_bill_qwer-20180307-80.pdf +++ /dev/null @@ -1,455 +0,0 @@ -%PDF-1.3 -%ÿÿÿÿ -1 0 obj -<< /Creator -/Producer ->> -endobj -2 0 obj -<< /Type /Catalog -/Pages 3 0 R ->> -endobj -3 0 obj -<< /Type /Pages -/Count 1 -/Kids [5 0 R] ->> -endobj -4 0 obj -<< /Length 4003 ->> -stream -q - -BT -48.975 1417.82 Td -/F1.0 10 Tf -[<4f53414b41204f4853484f2854> 120 <616d77> 10 <6529>] TJ -ET - - -BT -10.268 1402.696 Td -/F1.0 8 Tf -[<4e6f> 40 <2e203235362c204b> 50 <79> 20 <61696b6b6173616e20526f61642c2054> 120 <616d77> 10 <652054> 120 <6f> 15 <776e73686970> 35 <2c2059> 140 <616e676f6e>] TJ -ET - - -BT -71.904 1388.448 Td -/F1.0 8 Tf -[<54> 120 <656c3a2030392d323538363736363131>] TJ -ET - -0.0 1379.944 m -210.0 1379.944 l -S -0.0 1379.944 m -210.0 1379.944 l -S - -BT -0.0 1367.2 Td -/F1.0 8 Tf -[<52656365697074204e6f3a207177> 10 <65722d32303138303330372d3830>] TJ -ET - - -BT -0.0 1347.2 Td -/F1.0 8 Tf -[<54> 120 <6162> 20 <6c65202d207432>] TJ -ET - - -BT -100.0 1347.2 Td -/F1.0 8 Tf -[<573a2043617368696572>] TJ -ET - - -BT -160.216 1347.2 Td -/F1.0 8 Tf -[<433a2043617368696572>] TJ -ET - - -BT -0.0 1327.2 Td -/F1.0 8 Tf -[<44617465203a2030372d30332d323031382830363a303720504d2d30363a303720504d29>] TJ -ET - -0.0 1312.944 m -210.0 1312.944 l -S - -BT -0.0 1302.2 Td -/F1.0 8 Tf -[<4974656d73>] TJ -ET - - -BT -106.656 1302.2 Td -/F1.0 8 Tf -[<5072> -15 <696365>] TJ -ET - - -BT -138.276 1302.2 Td -/F1.0 8 Tf -[<517479>] TJ -ET - - -BT -187.176 1302.2 Td -/F1.0 8 Tf -[<54> 120 <6f74616c>] TJ -ET - -0.0 1292.944 m -210.0 1292.944 l -S - -BT -0.0 1282.2 Td -/F1.0 8 Tf -[<746573745f6974656d31202d>] TJ -ET - - -BT -0.0 1272.952 Td -/F1.0 8 Tf -[<74657374315f736d616c6c>] TJ -ET - - -BT -98.312 1282.2 Td -/F1.0 8 Tf -[<312c3030302e30>] TJ -ET - - -BT -138.94 1282.2 Td -/F1.0 8 Tf -[<312e30>] TJ -ET - - -BT -177.312 1282.2 Td -/F1.0 8 Tf -[<312c3030302e30>] TJ -ET - -0.0 1264.448 m -210.0 1264.448 l -S - -BT -0.0 1253.704 Td -/F1.0 8 Tf -[<5375622054> 120 <6f74616c>] TJ -ET - - -BT -175.312 1253.704 Td -/F1.0 8 Tf -[<312c3030302e30>] TJ -ET - - -BT -0.0 1239.456 Td -/F1.0 8 Tf -[<4f76> 25 <6572> 10 <616c6c20446973636f756e743a>] TJ -ET - - -BT -181.104 1239.456 Td -/F1.0 8 Tf -[<2820302e302029>] TJ -ET - - -BT -0.0 1225.208 Td -/F1.0 8 Tf -[<536572> -30 <76696365204368617267657320282031302529>] TJ -ET - - -BT -181.984 1225.208 Td -/F1.0 8 Tf -[<3130302e30>] TJ -ET - - -BT -0.0 1210.96 Td -/F1.0 8 Tf -[<436f6d6d65726369616c2054> 120 <6178202820352529>] TJ -ET - - -BT -186.432 1210.96 Td -/F1.0 8 Tf -[<35302e30>] TJ -ET - - -BT -0.0 1195.276 Td -/F2.0 10 Tf -[<4772616e642054> 80 <6f74616c>] TJ -ET - - -BT -168.64 1195.276 Td -/F2.0 10 Tf -[<312c3135302e30>] TJ -ET - -0.0 1185.556 m -210.0 1185.556 l -S - -BT -0.0 1174.812 Td -/F1.0 8 Tf -[<436173682050> 40 <61> 30 <796d656e74>] TJ -ET - - -BT -175.312 1174.812 Td -/F1.0 8 Tf -[<312c3135302e30>] TJ -ET - - -BT -0.0 1160.564 Td -/F1.0 8 Tf -[<4368616e676520416d6f756e74>] TJ -ET - - -BT -190.88 1160.564 Td -/F1.0 8 Tf -[<302e30>] TJ -ET - - -BT -0.0 1141.316 Td -/F1.0 8 Tf -[<437573746f6d6572204e616d65>] TJ -ET - - -BT -169.064 1141.316 Td -/F1.0 8 Tf -[<57> 50 <414c4b2d494e>] TJ -ET - -0.0 1132.812 m -210.0 1132.812 l -S - -BT -0.0 1122.068 Td -/F1.0 8 Tf -[<54> 120 <6f74616c2046> 30 <6f6f6420446973636f756e7473>] TJ -ET - - -BT -185.552 1122.068 Td -/F1.0 8 Tf -[<28302e3029>] TJ -ET - - -BT -0.0 1112.82 Td -/F1.0 8 Tf -[<54> 120 <6f74616c204265> 30 <76> 25 <6572> 10 <61676520446973636f756e7473>] TJ -ET - - -BT -185.552 1112.82 Td -/F1.0 8 Tf -[<28302e3029>] TJ -ET - - -BT -0.0 1103.572 Td -/F1.0 8 Tf -[<54> 120 <6f74616c2050726f6475637420446973636f756e7473>] TJ -ET - - -BT -185.552 1103.572 Td -/F1.0 8 Tf -[<28302e3029>] TJ -ET - -0.0 1095.068 m -210.0 1095.068 l -S - -BT -0.0 1084.324 Td -/F1.0 8 Tf -[<46> 30 <6f6f64>] TJ -ET - - -BT -175.312 1084.324 Td -/F1.0 8 Tf -[<312c3030302e30>] TJ -ET - - -BT -0.0 1075.076 Td -/F1.0 8 Tf -[<4265> 30 <76> 25 <6572> 10 <616765>] TJ -ET - - -BT -190.88 1075.076 Td -/F1.0 8 Tf -[<302e30>] TJ -ET - - -BT -0.0 1065.828 Td -/F1.0 8 Tf -[<50726f64756374>] TJ -ET - - -BT -190.88 1065.828 Td -/F1.0 8 Tf -[<302e30>] TJ -ET - -0.0 1057.324 m -210.0 1057.324 l -S - -BT -0.0 1045.862 Td -/F1.0 9 Tf -[<53706c69742042696c6c2066> 30 <6f72203020706572736f6e73>] TJ -ET - - -BT -0.0 1031.58 Td -/F1.0 8 Tf -[<416d6f756e7420447565202870657220706572736f6e29>] TJ -ET - - -BT -193.104 1031.58 Td -/F1.0 8 Tf -[<496e66>] TJ -ET - -0.0 1023.076 m -210.0 1023.076 l -S - -BT -0.0 1010.896 Td -/F2.0 10 Tf -[<50> 30 <616964>] TJ -ET - - -BT -102.0 1012.332 Td -/F1.0 8 Tf -[<5468616e6b2059> 140 <6f7521205365652079> 20 <6f7520416761696e>] TJ -ET - -Q - -endstream -endobj -5 0 obj -<< /Type /Page -/Parent 3 0 R -/MediaBox [0 0 210 1450] -/CropBox [0 0 210 1450] -/BleedBox [0 0 210 1450] -/TrimBox [0 0 210 1450] -/ArtBox [0 0 210 1450] -/Contents 4 0 R -/Resources << /ProcSet [/PDF /Text /ImageB /ImageC /ImageI] -/Font << /F1.0 6 0 R -/F2.0 7 0 R ->> ->> ->> -endobj -6 0 obj -<< /Type /Font -/Subtype /Type1 -/BaseFont /Helvetica -/Encoding /WinAnsiEncoding ->> -endobj -7 0 obj -<< /Type /Font -/Subtype /Type1 -/BaseFont /Helvetica-Bold -/Encoding /WinAnsiEncoding ->> -endobj -xref -0 8 -0000000000 65535 f -0000000015 00000 n -0000000109 00000 n -0000000158 00000 n -0000000215 00000 n -0000004270 00000 n -0000004553 00000 n -0000004650 00000 n -trailer -<< /Size 8 -/Root 2 0 R -/Info 1 0 R ->> -startxref -4752 -%%EOF diff --git a/public/receipts/receipt_bill_qwer-20180307-81.pdf b/public/receipts/receipt_bill_qwer-20180307-81.pdf deleted file mode 100644 index c2c35188..00000000 --- a/public/receipts/receipt_bill_qwer-20180307-81.pdf +++ /dev/null @@ -1,455 +0,0 @@ -%PDF-1.3 -%ÿÿÿÿ -1 0 obj -<< /Creator -/Producer ->> -endobj -2 0 obj -<< /Type /Catalog -/Pages 3 0 R ->> -endobj -3 0 obj -<< /Type /Pages -/Count 1 -/Kids [5 0 R] ->> -endobj -4 0 obj -<< /Length 4005 ->> -stream -q - -BT -48.975 1417.82 Td -/F1.0 10 Tf -[<4f53414b41204f4853484f2854> 120 <616d77> 10 <6529>] TJ -ET - - -BT -10.268 1402.696 Td -/F1.0 8 Tf -[<4e6f> 40 <2e203235362c204b> 50 <79> 20 <61696b6b6173616e20526f61642c2054> 120 <616d77> 10 <652054> 120 <6f> 15 <776e73686970> 35 <2c2059> 140 <616e676f6e>] TJ -ET - - -BT -71.904 1388.448 Td -/F1.0 8 Tf -[<54> 120 <656c3a2030392d323538363736363131>] TJ -ET - -0.0 1379.944 m -210.0 1379.944 l -S -0.0 1379.944 m -210.0 1379.944 l -S - -BT -0.0 1367.2 Td -/F1.0 8 Tf -[<52656365697074204e6f3a207177> 10 <65722d32303138303330372d3831>] TJ -ET - - -BT -0.0 1347.2 Td -/F1.0 8 Tf -[<54> 120 <6162> 20 <6c65202d207432>] TJ -ET - - -BT -100.0 1347.2 Td -/F1.0 8 Tf -[<573a2043617368696572>] TJ -ET - - -BT -160.216 1347.2 Td -/F1.0 8 Tf -[<433a2043617368696572>] TJ -ET - - -BT -0.0 1327.2 Td -/F1.0 8 Tf -[<44617465203a2030372d30332d323031382830363a303920504d2d30363a303920504d29>] TJ -ET - -0.0 1312.944 m -210.0 1312.944 l -S - -BT -0.0 1302.2 Td -/F1.0 8 Tf -[<4974656d73>] TJ -ET - - -BT -106.656 1302.2 Td -/F1.0 8 Tf -[<5072> -15 <696365>] TJ -ET - - -BT -138.276 1302.2 Td -/F1.0 8 Tf -[<517479>] TJ -ET - - -BT -187.176 1302.2 Td -/F1.0 8 Tf -[<54> 120 <6f74616c>] TJ -ET - -0.0 1292.944 m -210.0 1292.944 l -S - -BT -0.0 1282.2 Td -/F1.0 8 Tf -[<746573745f6974656d32202d>] TJ -ET - - -BT -0.0 1272.952 Td -/F1.0 8 Tf -[<74657374315f736d616c32>] TJ -ET - - -BT -98.312 1282.2 Td -/F1.0 8 Tf -[<322c3032302e30>] TJ -ET - - -BT -138.94 1282.2 Td -/F1.0 8 Tf -[<312e30>] TJ -ET - - -BT -177.312 1282.2 Td -/F1.0 8 Tf -[<322c3032302e30>] TJ -ET - -0.0 1264.448 m -210.0 1264.448 l -S - -BT -0.0 1253.704 Td -/F1.0 8 Tf -[<5375622054> 120 <6f74616c>] TJ -ET - - -BT -175.312 1253.704 Td -/F1.0 8 Tf -[<322c3032302e30>] TJ -ET - - -BT -0.0 1239.456 Td -/F1.0 8 Tf -[<4f76> 25 <6572> 10 <616c6c20446973636f756e743a>] TJ -ET - - -BT -181.104 1239.456 Td -/F1.0 8 Tf -[<2820302e302029>] TJ -ET - - -BT -0.0 1225.208 Td -/F1.0 8 Tf -[<536572> -30 <76696365204368617267657320282031302529>] TJ -ET - - -BT -181.984 1225.208 Td -/F1.0 8 Tf -[<3230322e30>] TJ -ET - - -BT -0.0 1210.96 Td -/F1.0 8 Tf -[<436f6d6d65726369616c2054> 120 <6178202820352529>] TJ -ET - - -BT -181.984 1210.96 Td -/F1.0 8 Tf -[<3130312e30>] TJ -ET - - -BT -0.0 1195.276 Td -/F2.0 10 Tf -[<4772616e642054> 80 <6f74616c>] TJ -ET - - -BT -168.64 1195.276 Td -/F2.0 10 Tf -[<322c3332332e30>] TJ -ET - -0.0 1185.556 m -210.0 1185.556 l -S - -BT -0.0 1174.812 Td -/F1.0 8 Tf -[<436173682050> 40 <61> 30 <796d656e74>] TJ -ET - - -BT -175.312 1174.812 Td -/F1.0 8 Tf -[<322c3332332e30>] TJ -ET - - -BT -0.0 1160.564 Td -/F1.0 8 Tf -[<4368616e676520416d6f756e74>] TJ -ET - - -BT -190.88 1160.564 Td -/F1.0 8 Tf -[<302e30>] TJ -ET - - -BT -0.0 1141.316 Td -/F1.0 8 Tf -[<437573746f6d6572204e616d65>] TJ -ET - - -BT -169.064 1141.316 Td -/F1.0 8 Tf -[<57> 50 <414c4b2d494e>] TJ -ET - -0.0 1132.812 m -210.0 1132.812 l -S - -BT -0.0 1122.068 Td -/F1.0 8 Tf -[<54> 120 <6f74616c2046> 30 <6f6f6420446973636f756e7473>] TJ -ET - - -BT -185.552 1122.068 Td -/F1.0 8 Tf -[<28302e3029>] TJ -ET - - -BT -0.0 1112.82 Td -/F1.0 8 Tf -[<54> 120 <6f74616c204265> 30 <76> 25 <6572> 10 <61676520446973636f756e7473>] TJ -ET - - -BT -185.552 1112.82 Td -/F1.0 8 Tf -[<28302e3029>] TJ -ET - - -BT -0.0 1103.572 Td -/F1.0 8 Tf -[<54> 120 <6f74616c2050726f6475637420446973636f756e7473>] TJ -ET - - -BT -185.552 1103.572 Td -/F1.0 8 Tf -[<28302e3029>] TJ -ET - -0.0 1095.068 m -210.0 1095.068 l -S - -BT -0.0 1084.324 Td -/F1.0 8 Tf -[<46> 30 <6f6f64>] TJ -ET - - -BT -175.312 1084.324 Td -/F1.0 8 Tf -[<322c3032302e30>] TJ -ET - - -BT -0.0 1075.076 Td -/F1.0 8 Tf -[<4265> 30 <76> 25 <6572> 10 <616765>] TJ -ET - - -BT -190.88 1075.076 Td -/F1.0 8 Tf -[<302e30>] TJ -ET - - -BT -0.0 1065.828 Td -/F1.0 8 Tf -[<50726f64756374>] TJ -ET - - -BT -190.88 1065.828 Td -/F1.0 8 Tf -[<302e30>] TJ -ET - -0.0 1057.324 m -210.0 1057.324 l -S - -BT -0.0 1045.862 Td -/F1.0 9 Tf -[<53706c69742042696c6c2066> 30 <6f72203020706572736f6e73>] TJ -ET - - -BT -0.0 1031.58 Td -/F1.0 8 Tf -[<416d6f756e7420447565202870657220706572736f6e29>] TJ -ET - - -BT -193.104 1031.58 Td -/F1.0 8 Tf -[<496e66>] TJ -ET - -0.0 1023.076 m -210.0 1023.076 l -S - -BT -0.0 1010.896 Td -/F2.0 10 Tf -[<50> 30 <616964>] TJ -ET - - -BT -102.0 1012.332 Td -/F1.0 8 Tf -[<5468616e6b2059> 140 <6f7521205365652079> 20 <6f7520416761696e>] TJ -ET - -Q - -endstream -endobj -5 0 obj -<< /Type /Page -/Parent 3 0 R -/MediaBox [0 0 210 1450] -/CropBox [0 0 210 1450] -/BleedBox [0 0 210 1450] -/TrimBox [0 0 210 1450] -/ArtBox [0 0 210 1450] -/Contents 4 0 R -/Resources << /ProcSet [/PDF /Text /ImageB /ImageC /ImageI] -/Font << /F1.0 6 0 R -/F2.0 7 0 R ->> ->> ->> -endobj -6 0 obj -<< /Type /Font -/Subtype /Type1 -/BaseFont /Helvetica -/Encoding /WinAnsiEncoding ->> -endobj -7 0 obj -<< /Type /Font -/Subtype /Type1 -/BaseFont /Helvetica-Bold -/Encoding /WinAnsiEncoding ->> -endobj -xref -0 8 -0000000000 65535 f -0000000015 00000 n -0000000109 00000 n -0000000158 00000 n -0000000215 00000 n -0000004272 00000 n -0000004555 00000 n -0000004652 00000 n -trailer -<< /Size 8 -/Root 2 0 R -/Info 1 0 R ->> -startxref -4754 -%%EOF diff --git a/public/receipts/receipt_bill_qwer-20180307-82.pdf b/public/receipts/receipt_bill_qwer-20180307-82.pdf deleted file mode 100644 index 088b1130..00000000 --- a/public/receipts/receipt_bill_qwer-20180307-82.pdf +++ /dev/null @@ -1,455 +0,0 @@ -%PDF-1.3 -%ÿÿÿÿ -1 0 obj -<< /Creator -/Producer ->> -endobj -2 0 obj -<< /Type /Catalog -/Pages 3 0 R ->> -endobj -3 0 obj -<< /Type /Pages -/Count 1 -/Kids [5 0 R] ->> -endobj -4 0 obj -<< /Length 4012 ->> -stream -q - -BT -48.975 1417.82 Td -/F1.0 10 Tf -[<4f53414b41204f4853484f2854> 120 <616d77> 10 <6529>] TJ -ET - - -BT -10.268 1402.696 Td -/F1.0 8 Tf -[<4e6f> 40 <2e203235362c204b> 50 <79> 20 <61696b6b6173616e20526f61642c2054> 120 <616d77> 10 <652054> 120 <6f> 15 <776e73686970> 35 <2c2059> 140 <616e676f6e>] TJ -ET - - -BT -71.904 1388.448 Td -/F1.0 8 Tf -[<54> 120 <656c3a2030392d323538363736363131>] TJ -ET - -0.0 1379.944 m -210.0 1379.944 l -S -0.0 1379.944 m -210.0 1379.944 l -S - -BT -0.0 1367.2 Td -/F1.0 8 Tf -[<52656365697074204e6f3a207177> 10 <65722d32303138303330372d3832>] TJ -ET - - -BT -0.0 1347.2 Td -/F1.0 8 Tf -[<54> 120 <6162> 20 <6c65202d207431>] TJ -ET - - -BT -100.0 1347.2 Td -/F1.0 8 Tf -[<573a2043617368696572>] TJ -ET - - -BT -160.216 1347.2 Td -/F1.0 8 Tf -[<433a2043617368696572>] TJ -ET - - -BT -0.0 1327.2 Td -/F1.0 8 Tf -[<44617465203a2030372d30332d323031382830363a313320504d2d30363a313320504d29>] TJ -ET - -0.0 1312.944 m -210.0 1312.944 l -S - -BT -0.0 1302.2 Td -/F1.0 8 Tf -[<4974656d73>] TJ -ET - - -BT -106.656 1302.2 Td -/F1.0 8 Tf -[<5072> -15 <696365>] TJ -ET - - -BT -138.276 1302.2 Td -/F1.0 8 Tf -[<517479>] TJ -ET - - -BT -187.176 1302.2 Td -/F1.0 8 Tf -[<54> 120 <6f74616c>] TJ -ET - -0.0 1292.944 m -210.0 1292.944 l -S - -BT -0.0 1282.2 Td -/F1.0 8 Tf -[<746573745f6974656d31202d>] TJ -ET - - -BT -0.0 1272.952 Td -/F1.0 8 Tf -[<74657374315f736d616c6c>] TJ -ET - - -BT -98.312 1282.2 Td -/F1.0 8 Tf -[<312c3030302e30>] TJ -ET - - -BT -138.94 1282.2 Td -/F1.0 8 Tf -[<312e30>] TJ -ET - - -BT -177.312 1282.2 Td -/F1.0 8 Tf -[<312c3030302e30>] TJ -ET - -0.0 1264.448 m -210.0 1264.448 l -S - -BT -0.0 1253.704 Td -/F1.0 8 Tf -[<5375622054> 120 <6f74616c>] TJ -ET - - -BT -175.312 1253.704 Td -/F1.0 8 Tf -[<312c3030302e30>] TJ -ET - - -BT -0.0 1239.456 Td -/F1.0 8 Tf -[<4f76> 25 <6572> 10 <616c6c20446973636f756e743a>] TJ -ET - - -BT -181.104 1239.456 Td -/F1.0 8 Tf -[<2820302e302029>] TJ -ET - - -BT -0.0 1225.208 Td -/F1.0 8 Tf -[<536572> -30 <76696365204368617267657320282031302529>] TJ -ET - - -BT -181.984 1225.208 Td -/F1.0 8 Tf -[<3130302e30>] TJ -ET - - -BT -0.0 1210.96 Td -/F1.0 8 Tf -[<436f6d6d65726369616c2054> 120 <6178202820352529>] TJ -ET - - -BT -186.432 1210.96 Td -/F1.0 8 Tf -[<35302e30>] TJ -ET - - -BT -0.0 1195.276 Td -/F2.0 10 Tf -[<4772616e642054> 80 <6f74616c>] TJ -ET - - -BT -168.64 1195.276 Td -/F2.0 10 Tf -[<312c3135302e30>] TJ -ET - -0.0 1185.556 m -210.0 1185.556 l -S - -BT -0.0 1174.812 Td -/F1.0 8 Tf -[<436173682050> 40 <61> 30 <796d656e74>] TJ -ET - - -BT -175.312 1174.812 Td -/F1.0 8 Tf -[<322c3330302e30>] TJ -ET - - -BT -0.0 1160.564 Td -/F1.0 8 Tf -[<4368616e676520416d6f756e74>] TJ -ET - - -BT -175.312 1160.564 Td -/F1.0 8 Tf -[<312c3135302e30>] TJ -ET - - -BT -0.0 1141.316 Td -/F1.0 8 Tf -[<437573746f6d6572204e616d65>] TJ -ET - - -BT -169.064 1141.316 Td -/F1.0 8 Tf -[<57> 50 <414c4b2d494e>] TJ -ET - -0.0 1132.812 m -210.0 1132.812 l -S - -BT -0.0 1122.068 Td -/F1.0 8 Tf -[<54> 120 <6f74616c2046> 30 <6f6f6420446973636f756e7473>] TJ -ET - - -BT -185.552 1122.068 Td -/F1.0 8 Tf -[<28302e3029>] TJ -ET - - -BT -0.0 1112.82 Td -/F1.0 8 Tf -[<54> 120 <6f74616c204265> 30 <76> 25 <6572> 10 <61676520446973636f756e7473>] TJ -ET - - -BT -185.552 1112.82 Td -/F1.0 8 Tf -[<28302e3029>] TJ -ET - - -BT -0.0 1103.572 Td -/F1.0 8 Tf -[<54> 120 <6f74616c2050726f6475637420446973636f756e7473>] TJ -ET - - -BT -185.552 1103.572 Td -/F1.0 8 Tf -[<28302e3029>] TJ -ET - -0.0 1095.068 m -210.0 1095.068 l -S - -BT -0.0 1084.324 Td -/F1.0 8 Tf -[<46> 30 <6f6f64>] TJ -ET - - -BT -175.312 1084.324 Td -/F1.0 8 Tf -[<312c3030302e30>] TJ -ET - - -BT -0.0 1075.076 Td -/F1.0 8 Tf -[<4265> 30 <76> 25 <6572> 10 <616765>] TJ -ET - - -BT -190.88 1075.076 Td -/F1.0 8 Tf -[<302e30>] TJ -ET - - -BT -0.0 1065.828 Td -/F1.0 8 Tf -[<50726f64756374>] TJ -ET - - -BT -190.88 1065.828 Td -/F1.0 8 Tf -[<302e30>] TJ -ET - -0.0 1057.324 m -210.0 1057.324 l -S - -BT -0.0 1045.862 Td -/F1.0 9 Tf -[<53706c69742042696c6c2066> 30 <6f72203020706572736f6e73>] TJ -ET - - -BT -0.0 1031.58 Td -/F1.0 8 Tf -[<416d6f756e7420447565202870657220706572736f6e29>] TJ -ET - - -BT -193.104 1031.58 Td -/F1.0 8 Tf -[<496e66>] TJ -ET - -0.0 1023.076 m -210.0 1023.076 l -S - -BT -0.0 1010.896 Td -/F2.0 10 Tf -[<50> 30 <616964>] TJ -ET - - -BT -102.0 1012.332 Td -/F1.0 8 Tf -[<5468616e6b2059> 140 <6f7521205365652079> 20 <6f7520416761696e>] TJ -ET - -Q - -endstream -endobj -5 0 obj -<< /Type /Page -/Parent 3 0 R -/MediaBox [0 0 210 1450] -/CropBox [0 0 210 1450] -/BleedBox [0 0 210 1450] -/TrimBox [0 0 210 1450] -/ArtBox [0 0 210 1450] -/Contents 4 0 R -/Resources << /ProcSet [/PDF /Text /ImageB /ImageC /ImageI] -/Font << /F1.0 6 0 R -/F2.0 7 0 R ->> ->> ->> -endobj -6 0 obj -<< /Type /Font -/Subtype /Type1 -/BaseFont /Helvetica -/Encoding /WinAnsiEncoding ->> -endobj -7 0 obj -<< /Type /Font -/Subtype /Type1 -/BaseFont /Helvetica-Bold -/Encoding /WinAnsiEncoding ->> -endobj -xref -0 8 -0000000000 65535 f -0000000015 00000 n -0000000109 00000 n -0000000158 00000 n -0000000215 00000 n -0000004279 00000 n -0000004562 00000 n -0000004659 00000 n -trailer -<< /Size 8 -/Root 2 0 R -/Info 1 0 R ->> -startxref -4761 -%%EOF diff --git a/public/receipts/receipt_bill_qwer-20180307-83.pdf b/public/receipts/receipt_bill_qwer-20180307-83.pdf deleted file mode 100644 index ebac5da2..00000000 --- a/public/receipts/receipt_bill_qwer-20180307-83.pdf +++ /dev/null @@ -1,455 +0,0 @@ -%PDF-1.3 -%ÿÿÿÿ -1 0 obj -<< /Creator -/Producer ->> -endobj -2 0 obj -<< /Type /Catalog -/Pages 3 0 R ->> -endobj -3 0 obj -<< /Type /Pages -/Count 1 -/Kids [5 0 R] ->> -endobj -4 0 obj -<< /Length 4003 ->> -stream -q - -BT -48.975 1417.82 Td -/F1.0 10 Tf -[<4f53414b41204f4853484f2854> 120 <616d77> 10 <6529>] TJ -ET - - -BT -10.268 1402.696 Td -/F1.0 8 Tf -[<4e6f> 40 <2e203235362c204b> 50 <79> 20 <61696b6b6173616e20526f61642c2054> 120 <616d77> 10 <652054> 120 <6f> 15 <776e73686970> 35 <2c2059> 140 <616e676f6e>] TJ -ET - - -BT -71.904 1388.448 Td -/F1.0 8 Tf -[<54> 120 <656c3a2030392d323538363736363131>] TJ -ET - -0.0 1379.944 m -210.0 1379.944 l -S -0.0 1379.944 m -210.0 1379.944 l -S - -BT -0.0 1367.2 Td -/F1.0 8 Tf -[<52656365697074204e6f3a207177> 10 <65722d32303138303330372d3833>] TJ -ET - - -BT -0.0 1347.2 Td -/F1.0 8 Tf -[<54> 120 <6162> 20 <6c65202d207431>] TJ -ET - - -BT -100.0 1347.2 Td -/F1.0 8 Tf -[<573a2043617368696572>] TJ -ET - - -BT -160.216 1347.2 Td -/F1.0 8 Tf -[<433a2043617368696572>] TJ -ET - - -BT -0.0 1327.2 Td -/F1.0 8 Tf -[<44617465203a2030372d30332d323031382830363a313720504d2d30363a313720504d29>] TJ -ET - -0.0 1312.944 m -210.0 1312.944 l -S - -BT -0.0 1302.2 Td -/F1.0 8 Tf -[<4974656d73>] TJ -ET - - -BT -106.656 1302.2 Td -/F1.0 8 Tf -[<5072> -15 <696365>] TJ -ET - - -BT -138.276 1302.2 Td -/F1.0 8 Tf -[<517479>] TJ -ET - - -BT -187.176 1302.2 Td -/F1.0 8 Tf -[<54> 120 <6f74616c>] TJ -ET - -0.0 1292.944 m -210.0 1292.944 l -S - -BT -0.0 1282.2 Td -/F1.0 8 Tf -[<746573745f6974656d31202d>] TJ -ET - - -BT -0.0 1272.952 Td -/F1.0 8 Tf -[<74657374315f736d616c6c>] TJ -ET - - -BT -98.312 1282.2 Td -/F1.0 8 Tf -[<312c3030302e30>] TJ -ET - - -BT -138.94 1282.2 Td -/F1.0 8 Tf -[<312e30>] TJ -ET - - -BT -177.312 1282.2 Td -/F1.0 8 Tf -[<312c3030302e30>] TJ -ET - -0.0 1264.448 m -210.0 1264.448 l -S - -BT -0.0 1253.704 Td -/F1.0 8 Tf -[<5375622054> 120 <6f74616c>] TJ -ET - - -BT -175.312 1253.704 Td -/F1.0 8 Tf -[<312c3030302e30>] TJ -ET - - -BT -0.0 1239.456 Td -/F1.0 8 Tf -[<4f76> 25 <6572> 10 <616c6c20446973636f756e743a>] TJ -ET - - -BT -181.104 1239.456 Td -/F1.0 8 Tf -[<2820302e302029>] TJ -ET - - -BT -0.0 1225.208 Td -/F1.0 8 Tf -[<536572> -30 <76696365204368617267657320282031302529>] TJ -ET - - -BT -181.984 1225.208 Td -/F1.0 8 Tf -[<3130302e30>] TJ -ET - - -BT -0.0 1210.96 Td -/F1.0 8 Tf -[<436f6d6d65726369616c2054> 120 <6178202820352529>] TJ -ET - - -BT -186.432 1210.96 Td -/F1.0 8 Tf -[<35302e30>] TJ -ET - - -BT -0.0 1195.276 Td -/F2.0 10 Tf -[<4772616e642054> 80 <6f74616c>] TJ -ET - - -BT -168.64 1195.276 Td -/F2.0 10 Tf -[<312c3135302e30>] TJ -ET - -0.0 1185.556 m -210.0 1185.556 l -S - -BT -0.0 1174.812 Td -/F1.0 8 Tf -[<436173682050> 40 <61> 30 <796d656e74>] TJ -ET - - -BT -175.312 1174.812 Td -/F1.0 8 Tf -[<312c3135302e30>] TJ -ET - - -BT -0.0 1160.564 Td -/F1.0 8 Tf -[<4368616e676520416d6f756e74>] TJ -ET - - -BT -190.88 1160.564 Td -/F1.0 8 Tf -[<302e30>] TJ -ET - - -BT -0.0 1141.316 Td -/F1.0 8 Tf -[<437573746f6d6572204e616d65>] TJ -ET - - -BT -169.064 1141.316 Td -/F1.0 8 Tf -[<57> 50 <414c4b2d494e>] TJ -ET - -0.0 1132.812 m -210.0 1132.812 l -S - -BT -0.0 1122.068 Td -/F1.0 8 Tf -[<54> 120 <6f74616c2046> 30 <6f6f6420446973636f756e7473>] TJ -ET - - -BT -185.552 1122.068 Td -/F1.0 8 Tf -[<28302e3029>] TJ -ET - - -BT -0.0 1112.82 Td -/F1.0 8 Tf -[<54> 120 <6f74616c204265> 30 <76> 25 <6572> 10 <61676520446973636f756e7473>] TJ -ET - - -BT -185.552 1112.82 Td -/F1.0 8 Tf -[<28302e3029>] TJ -ET - - -BT -0.0 1103.572 Td -/F1.0 8 Tf -[<54> 120 <6f74616c2050726f6475637420446973636f756e7473>] TJ -ET - - -BT -185.552 1103.572 Td -/F1.0 8 Tf -[<28302e3029>] TJ -ET - -0.0 1095.068 m -210.0 1095.068 l -S - -BT -0.0 1084.324 Td -/F1.0 8 Tf -[<46> 30 <6f6f64>] TJ -ET - - -BT -175.312 1084.324 Td -/F1.0 8 Tf -[<312c3030302e30>] TJ -ET - - -BT -0.0 1075.076 Td -/F1.0 8 Tf -[<4265> 30 <76> 25 <6572> 10 <616765>] TJ -ET - - -BT -190.88 1075.076 Td -/F1.0 8 Tf -[<302e30>] TJ -ET - - -BT -0.0 1065.828 Td -/F1.0 8 Tf -[<50726f64756374>] TJ -ET - - -BT -190.88 1065.828 Td -/F1.0 8 Tf -[<302e30>] TJ -ET - -0.0 1057.324 m -210.0 1057.324 l -S - -BT -0.0 1045.862 Td -/F1.0 9 Tf -[<53706c69742042696c6c2066> 30 <6f72203020706572736f6e73>] TJ -ET - - -BT -0.0 1031.58 Td -/F1.0 8 Tf -[<416d6f756e7420447565202870657220706572736f6e29>] TJ -ET - - -BT -193.104 1031.58 Td -/F1.0 8 Tf -[<496e66>] TJ -ET - -0.0 1023.076 m -210.0 1023.076 l -S - -BT -0.0 1010.896 Td -/F2.0 10 Tf -[<50> 30 <616964>] TJ -ET - - -BT -102.0 1012.332 Td -/F1.0 8 Tf -[<5468616e6b2059> 140 <6f7521205365652079> 20 <6f7520416761696e>] TJ -ET - -Q - -endstream -endobj -5 0 obj -<< /Type /Page -/Parent 3 0 R -/MediaBox [0 0 210 1450] -/CropBox [0 0 210 1450] -/BleedBox [0 0 210 1450] -/TrimBox [0 0 210 1450] -/ArtBox [0 0 210 1450] -/Contents 4 0 R -/Resources << /ProcSet [/PDF /Text /ImageB /ImageC /ImageI] -/Font << /F1.0 6 0 R -/F2.0 7 0 R ->> ->> ->> -endobj -6 0 obj -<< /Type /Font -/Subtype /Type1 -/BaseFont /Helvetica -/Encoding /WinAnsiEncoding ->> -endobj -7 0 obj -<< /Type /Font -/Subtype /Type1 -/BaseFont /Helvetica-Bold -/Encoding /WinAnsiEncoding ->> -endobj -xref -0 8 -0000000000 65535 f -0000000015 00000 n -0000000109 00000 n -0000000158 00000 n -0000000215 00000 n -0000004270 00000 n -0000004553 00000 n -0000004650 00000 n -trailer -<< /Size 8 -/Root 2 0 R -/Info 1 0 R ->> -startxref -4752 -%%EOF From e3f9ecbc878e6f9d0a7da4ca23efb7695e274690 Mon Sep 17 00:00:00 2001 From: Yan Date: Tue, 20 Mar 2018 11:38:51 +0630 Subject: [PATCH 17/61] add jade print --- app/views/origami/home/show.html.erb | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/app/views/origami/home/show.html.erb b/app/views/origami/home/show.html.erb index 6c38ba99..d36a6715 100755 --- a/app/views/origami/home/show.html.erb +++ b/app/views/origami/home/show.html.erb @@ -715,6 +715,7 @@ $("#first_bill").on('click', function () { var sale_id = $('#sale_id').val(); var ajax_url = "/origami/sale/" + sale_id + "/first_bill"; + var server_mode = $.ajax({ type: "GET", @@ -723,12 +724,17 @@ receipt_no = ($("#receipt_no").html()).trim(); if((receipt_no!=undefined) && (receipt_no!="")) createReceiptNoInFirstBillData(receipt_no,""); + + // For Server Print - from jade + if ($("#server_mode").val() == "cloud") { + code2lab.printFile(result.filepath, result.printer_url); + } // console.log(result); // code2lab.printBill(result.filepath, result.printer_model, result.printer_url); location.reload(); } - }); + }); }); $(".choose_payment").on('click', function () { From 510e3aabec4cd018cea6774c8bc6726c0fa22dd8 Mon Sep 17 00:00:00 2001 From: Yan Date: Tue, 20 Mar 2018 14:32:08 +0630 Subject: [PATCH 18/61] check current user session --- app/controllers/base_crm_controller.rb | 8 ++++++-- app/controllers/base_inventory_controller.rb | 8 ++++++-- app/controllers/base_oqs_controller.rb | 10 +++++++--- app/controllers/base_origami_controller.rb | 8 +++++--- app/controllers/base_report_controller.rb | 8 ++++++++ app/controllers/base_waiter_controller.rb | 16 ++++++++++++---- app/controllers/concerns/login_verification.rb | 6 +++--- app/controllers/home_controller.rb | 13 +++++++++++++ 8 files changed, 60 insertions(+), 17 deletions(-) diff --git a/app/controllers/base_crm_controller.rb b/app/controllers/base_crm_controller.rb index 3b9e0176..65350605 100755 --- a/app/controllers/base_crm_controller.rb +++ b/app/controllers/base_crm_controller.rb @@ -2,6 +2,8 @@ class BaseCrmController < ActionController::Base include LoginVerification layout "CRM" + before_action :check_user + #before_action :check_installation protect_from_forgery with: :exception @@ -22,8 +24,10 @@ class BaseCrmController < ActionController::Base { locale: I18n.locale } end - def current_user - @current_user ||= Employee.find_by_token_session(session[:session_token]) if session[:session_token] + def check_user + if current_user.nil? + redirect_to root_path + end end #Shop Name in Navbor diff --git a/app/controllers/base_inventory_controller.rb b/app/controllers/base_inventory_controller.rb index a88a3abb..ebbd32e3 100755 --- a/app/controllers/base_inventory_controller.rb +++ b/app/controllers/base_inventory_controller.rb @@ -2,6 +2,8 @@ class BaseInventoryController < ActionController::Base include LoginVerification layout "inventory" + before_action :check_user + #before_action :check_installation protect_from_forgery with: :exception @@ -12,8 +14,10 @@ class BaseInventoryController < ActionController::Base redirect_to root_path end - def current_user - @current_user ||= Employee.find_by_token_session(session[:session_token]) if session[:session_token] + def check_user + if current_user.nil? + redirect_to root_path + end end #Shop Name in Navbor diff --git a/app/controllers/base_oqs_controller.rb b/app/controllers/base_oqs_controller.rb index 0f093913..2b621cf1 100755 --- a/app/controllers/base_oqs_controller.rb +++ b/app/controllers/base_oqs_controller.rb @@ -2,6 +2,8 @@ class BaseOqsController < ActionController::Base include LoginVerification layout "OQS" + before_action :check_user + #before_action :check_installation protect_from_forgery with: :exception @@ -21,9 +23,11 @@ class BaseOqsController < ActionController::Base def default_url_options { locale: I18n.locale } end - - def current_user - @current_user ||= Employee.find_by_token_session(session[:session_token]) if session[:session_token] + + def check_user + if current_user.nil? + redirect_to root_path + end end #Shop Name in Navbor diff --git a/app/controllers/base_origami_controller.rb b/app/controllers/base_origami_controller.rb index 8c4f3aaa..e14a6959 100755 --- a/app/controllers/base_origami_controller.rb +++ b/app/controllers/base_origami_controller.rb @@ -2,7 +2,7 @@ class BaseOrigamiController < ActionController::Base include LoginVerification layout "origami" - # before_action :checkin_process + before_action :check_user #before_action :check_installation protect_from_forgery with: :exception @@ -14,8 +14,10 @@ class BaseOrigamiController < ActionController::Base redirect_to origami_dashboard_path end - def current_user - @current_user ||= Employee.find_by_token_session(session[:session_token]) if session[:session_token] + def check_user + if current_user.nil? + redirect_to root_path + end end # def checkin_process diff --git a/app/controllers/base_report_controller.rb b/app/controllers/base_report_controller.rb index e96e97c8..51c250f8 100755 --- a/app/controllers/base_report_controller.rb +++ b/app/controllers/base_report_controller.rb @@ -2,6 +2,8 @@ class BaseReportController < ActionController::Base include LoginVerification layout "application" + before_action :check_user + #before_action :check_installation protect_from_forgery with: :exception @@ -83,6 +85,12 @@ class BaseReportController < ActionController::Base return from, to end + def check_user + if current_user.nil? + redirect_to root_path + end + end + #Shop Name in Navbor def shop_detail @shop = Shop.first diff --git a/app/controllers/base_waiter_controller.rb b/app/controllers/base_waiter_controller.rb index 71303213..94d1cd45 100755 --- a/app/controllers/base_waiter_controller.rb +++ b/app/controllers/base_waiter_controller.rb @@ -2,13 +2,21 @@ class BaseWaiterController < ActionController::Base include LoginVerification layout "waiter" + before_action :check_user + #before_action :check_installation protect_from_forgery with: :exception helper_method :shop_detail - #Shop Name in Navbor - def shop_detail - @shop = Shop.first - end + def check_user + if current_user.nil? + redirect_to root_path + end + end + + #Shop Name in Navbor + def shop_detail + @shop = Shop.first + end end diff --git a/app/controllers/concerns/login_verification.rb b/app/controllers/concerns/login_verification.rb index bb9df067..14b1e2e1 100755 --- a/app/controllers/concerns/login_verification.rb +++ b/app/controllers/concerns/login_verification.rb @@ -33,10 +33,10 @@ module LoginVerification protected # Authenticate the user with token based authentication def authenticate - authenticate_session_token || render_unauthorized + authenticate_session_token || render_unauthorized end - def authenticate_session_token + def authenticate_session_token token = session[:session_token] if (token) #@current_user = User.find_by(api_key: token) @@ -50,7 +50,7 @@ module LoginVerification end end - def render_unauthorized() + def render_unauthorized redirect_to root_path end diff --git a/app/controllers/home_controller.rb b/app/controllers/home_controller.rb index 147b2ee4..f097ba6f 100755 --- a/app/controllers/home_controller.rb +++ b/app/controllers/home_controller.rb @@ -2,8 +2,21 @@ class HomeController < ApplicationController # layout "application", except: [:index, :show] # skip_before_action :authenticate, only: [:index, :show, :create, :update, :destroy] + before_action :check_user, only: :dashboard + helper_method :shop_detail + # Special check for only dashboard + def check_user + if current_user.nil? + redirect_to root_path + end + end + + def current_user + @current_user ||= Employee.find_by_token_session(session[:session_token]) if session[:session_token] + end + def index # @employees = Employee.all_emp_except_waiter.order("name asc") @employees = Employee.all.order("name asc") From f354e32e319762024c807ca12931ad66fe4a5562 Mon Sep 17 00:00:00 2001 From: phyusin Date: Tue, 20 Mar 2018 15:55:00 +0630 Subject: [PATCH 19/61] SQA feedback --- app/controllers/origami/shifts_controller.rb | 2 +- app/models/sale.rb | 22 ++++++++++++++++++++ app/views/origami/shifts/show.html.erb | 10 ++++----- 3 files changed, 28 insertions(+), 6 deletions(-) diff --git a/app/controllers/origami/shifts_controller.rb b/app/controllers/origami/shifts_controller.rb index d0b73f99..acce6c65 100755 --- a/app/controllers/origami/shifts_controller.rb +++ b/app/controllers/origami/shifts_controller.rb @@ -3,7 +3,7 @@ class Origami::ShiftsController < BaseOrigamiController end def show - @type = params[:type] + @cashier_type = params[:type] @shift = ShiftSale.current_open_shift(current_user.id) #for bank integration bank_integration = Lookup.collection_of('bank_integration') diff --git a/app/models/sale.rb b/app/models/sale.rb index 11ddd296..5e7042e5 100755 --- a/app/models/sale.rb +++ b/app/models/sale.rb @@ -371,6 +371,8 @@ class Sale < ApplicationRecord end #compute rounding adjustment # adjust_rounding + sale.rounding_adjustment = compute_adjust_rounding(sale.grand_total) + sale.save! end @@ -552,6 +554,26 @@ class Sale < ApplicationRecord end + def compute_adjust_rounding(grand_total) + shop_details = Shop::ShopDetail + # rounding adjustment + if shop_details.is_rounding_adj + a = grand_total % 25 # Modulus + b = grand_total / 25 # Division + #not calculate rounding if modulus is 0 and division is even + #calculate rounding if modulus is zero or not zero and division are not even + if (a != 0.0 && b%2 != 0.0) || (a==0.0 && b%2 !=0) + new_total = Sale.get_rounding_adjustment(grand_total) + rounding_adjustment = new_total - grand_total + else + rounding_adjustment = 0.00 + end + else + rounding_adjustment = 0.00 + end + return rounding_adjustment + end + #Generate new Receipt No when it is not assigned def generate_receipt_no #shop_code and client_code diff --git a/app/views/origami/shifts/show.html.erb b/app/views/origami/shifts/show.html.erb index 4e42f11b..006763eb 100755 --- a/app/views/origami/shifts/show.html.erb +++ b/app/views/origami/shifts/show.html.erb @@ -58,7 +58,7 @@ \ No newline at end of file From dfb998f9e7e922cc0b1c1cb6eb17575e2309d87c Mon Sep 17 00:00:00 2001 From: Aung Myo Date: Fri, 23 Mar 2018 13:55:07 +0630 Subject: [PATCH 41/61] update paymemt multiple ui --- app/assets/stylesheets/origami.scss | 12 ++++++ app/views/origami/home/show.html.erb | 61 +++++++++++++++------------ app/views/origami/rooms/show.html.erb | 45 +++++++++++++++----- 3 files changed, 81 insertions(+), 37 deletions(-) diff --git a/app/assets/stylesheets/origami.scss b/app/assets/stylesheets/origami.scss index 07c7428f..c417613a 100755 --- a/app/assets/stylesheets/origami.scss +++ b/app/assets/stylesheets/origami.scss @@ -198,6 +198,18 @@ select.form-control { background-color: blue !important; } +.selected-payment { + color: #fff !important; + background-color: blue !important; +} +.payment_btn { + white-space: normal !important; + margin-bottom: 15px; + margin-right: 15px; + color:#fff !important; + # background-color: green !important; +} + /* Reciept Style */ #order-charges-table td { border-top: none !important; diff --git a/app/views/origami/home/show.html.erb b/app/views/origami/home/show.html.erb index 83816151..4922c1df 100755 --- a/app/views/origami/home/show.html.erb +++ b/app/views/origami/home/show.html.erb @@ -528,12 +528,12 @@ @@ -199,7 +201,7 @@
-
+
<%= t("views.right_panel.detail.group_type") %>:<%= @settings_tax_profile.group_type %>
<%= t("views.right_panel.detail.name") %>: <%= @settings_tax_profile.name %>
'+rowCount+'' + item_name+ ' ' + name +'-' + option +'' + item_name+ ' ' + name +' ' + option +'' + qty + '' + parseFloat(total).toFixed(2) @@ -404,22 +406,23 @@ $(function() { +'
'+rowCount+'' + item_name+ ' ' + name +'-' + option +'' + item_name+ ' ' + name +' ' + set_option +'' + qty + '' + parseFloat(total).toFixed(2) @@ -659,7 +662,6 @@ $(function() { attribute_arr = get_selected_attributes('selected-attribute'); option_arr = get_selected_attributes('selected-option'); - if (item_row.length>0) { var instances = jQuery.parseJSON(item_row.attr('data-instances')); @@ -700,7 +702,7 @@ $(function() { var item_data = $(this); item = get_item(item_data); customer_display_view(item,"add"); - show_item_detail(item_data); + show_item_detail(item_data,"add_to_order"); calculate_sub_total(); }); //End add order Click @@ -710,11 +712,11 @@ $(function() { var item_data = $(this); item = get_item(item_data); customer_display_view(item,"add"); - show_item_detail(item_data); + show_item_detail(item_data,"add_icon"); calculate_sub_total(); }); //End Add Icon Click - function show_item_detail(data){ + function show_item_detail(data,click_type){ qty = parseInt(data.attr('data-qty')); append = 0; @@ -726,23 +728,26 @@ $(function() { }else{ instance = "("+data.attr('data-instance')+")"; } - - d_option = data.attr('data-options'); - if (d_option){ - option_name = "-"+data.attr('data-options'); + d_option = data.attr('data-opt'); + if (click_type != "add_icon"){ + option_name = "-"+data.attr('data-options'); + data_option = data.attr('data-options') ; }else{ - option_name = ''; + option_name = ' '; + data_option = '[]'; } + var rowCount = $('.summary-items tbody tr').length+1; var item_row = $('.summary-items tbody tr'); $(item_row).each(function(i){ item_code = $(item_row[i]).attr('data-code'); instance_code = $(item_row[i]).attr('data-instance-code'); - r_option = $(item_row[i]).attr('data-options'); - - if (item_code == data.attr('data-item-code') && instance_code == data.attr('data-instance-code')&&r_option==d_option) { + r_option = $(item_row[i]).attr('data-opt'); +console.log(r_option) +console.log(d_option) + if (item_code == data.attr('data-item-code') && instance_code == data.attr('data-instance-code')&&r_option == d_option) { if (qty > 1) { qty = parseInt($(item_row[i]).children('#item_qty').text()) + qty; }else{ @@ -766,9 +771,10 @@ $(function() { +instance+ "' data-code='"+data.attr('data-item-code')+"' data-instance-code='" +data.attr('data-instance-code')+"' data-attributes='" +data.attr('data-attributes')+"' data-options ='" + +data_option+"' data-opt ='" +data.attr('data-options')+"' data-row ='"+rowCount+ "'>" +''+rowCount+'' + data.attr('data-name')+ ' ' + instance +' ' + option_name +'' + data.attr('data-name')+ ' ' + instance +''+option_name+'' + qty + '' + parseFloat(price).toFixed(2) @@ -822,8 +828,6 @@ $(function() { data: params, dataType: "json", success:function(result){ - console.log(type) - console.log(table_type) if (type == "quick_service") { window.location.href = "/origami/quick_service" }else{ @@ -889,7 +893,7 @@ $(function() { dataType: "json", success:function(result){ if (result.status) { - console.log(result) + if (result.data == null){ swal({ title: "Please Open Shift !", diff --git a/app/controllers/api/orders_controller.rb b/app/controllers/api/orders_controller.rb index 2e9602c8..43e1bd11 100755 --- a/app/controllers/api/orders_controller.rb +++ b/app/controllers/api/orders_controller.rb @@ -67,7 +67,8 @@ class Api::OrdersController < Api::ApiController end } #end extra time - + puts params[:order_items] + puts "ITEM aaaaaaaaaaaaaaaaaaa" # begin @order = Order.new @order.source = params[:order_source] diff --git a/app/controllers/origami/addorders_controller.rb b/app/controllers/origami/addorders_controller.rb index 7dd2b3f0..3a8dea9b 100755 --- a/app/controllers/origami/addorders_controller.rb +++ b/app/controllers/origami/addorders_controller.rb @@ -94,10 +94,10 @@ class Origami::AddordersController < BaseOrigamiController extra_time = Time.at(time) end end - if i["parent_order_item_id"] - items = {"order_item_id": i["order_item_id"],"item_instance_code": i["item_instance_code"],"quantity": i["quantity"],"parent_order_item_id": i["parent_order_item_id"],"options": i["options"]} + if i["parent_order_item_id"]; + items = {"order_item_id": i["order_item_id"],"item_instance_code": i["item_instance_code"],"quantity": i["quantity"],"parent_order_item_id": i["parent_order_item_id"],"options": JSON.parse(i["options"])} else - items = {"order_item_id": i["order_item_id"],"item_instance_code": i["item_instance_code"],"quantity": i["quantity"],"options": i["options"]} + items = {"order_item_id": i["order_item_id"],"item_instance_code": i["item_instance_code"],"quantity": i["quantity"],"options": JSON.parse(i["options"])} end items_arr.push(items) } diff --git a/app/controllers/settings/menus_controller.rb b/app/controllers/settings/menus_controller.rb index 4d7d6026..0a6d87c7 100755 --- a/app/controllers/settings/menus_controller.rb +++ b/app/controllers/settings/menus_controller.rb @@ -7,9 +7,12 @@ class Settings::MenusController < ApplicationController def index @settings_menus = Menu.all.page(params[:page]).per(10) respond_to do |format| - format.html - format.csv { send_data Menu.to_csv } - end + format.html + # format.csv { send_data MenuCsvExport.generate } + +format.csv { send_data Menu.to_csv } +# format.csv { send_data MenuCategory.to_csv } + end end # GET /settings/menus/1 @@ -71,6 +74,11 @@ class Settings::MenusController < ApplicationController # end end + def import + Menu.import(params[:file]) + redirect_to settings_menu_path, notice: "imported" + end + private # Use callbacks to share common setup or constraints between actions. def set_settings_menu diff --git a/app/controllers/transactions/orders_controller.rb b/app/controllers/transactions/orders_controller.rb index 17a117bb..52abf7fd 100755 --- a/app/controllers/transactions/orders_controller.rb +++ b/app/controllers/transactions/orders_controller.rb @@ -21,11 +21,12 @@ class Transactions::OrdersController < ApplicationController @receipt_no = filter @from = from @to = to - + respond_to do |format| - format.html # index.html.erb - format.json { render json: @orders } - end + format.html + format.json { render json: @orders } + # format.csv { send_data OrdersCsvExport.generate } + end end def show diff --git a/app/models/menu.rb b/app/models/menu.rb index 052a7042..12784eea 100755 --- a/app/models/menu.rb +++ b/app/models/menu.rb @@ -33,27 +33,20 @@ class Menu < ApplicationRecord end def self.to_csv - m_attributes = %w{id name is_active valid_days valid_time_from valid_time_to created_by created_at updated_at} + m_attributes = %w{name is_active valid_days valid_time_from valid_time_to created_by created_at updated_at} CSV.generate(headers: true) do |csv| csv << m_attributes menu = Menu.all menu.each do |user| - puts user csv << m_attributes.map{ |attr| user.send(attr)} end end + end - # mc_attributes = %w{id menu_id code name alt_name order_by created_by menu_category_id is_available created_at updated_at} - # CSV.generate(headers: true) do |csv| - # csv << m_attributes - - # csv << mc_attributes - # MenuCategory.all.each do |user| - # puts user - # csv << mc_attributes.map{ |attr| user.send(attr)} - # end - # end - + def self.import(file) + CSV.foreach(file.path, headers:true) do |row| + Menu.create! row.to_hash + end end end \ No newline at end of file diff --git a/app/models/menu_category.rb b/app/models/menu_category.rb index acb06c4f..65477a37 100755 --- a/app/models/menu_category.rb +++ b/app/models/menu_category.rb @@ -1,7 +1,7 @@ class MenuCategory < ApplicationRecord # before_create :generate_menu_category_code - belongs_to :menu + belongs_to :menu , counter_cache: true has_many :children, :class_name => "MenuCategory", foreign_key: "menu_category_id" belongs_to :parent, :class_name => "MenuCategory", foreign_key: "menu_category_id", optional: true has_many :menu_items @@ -83,4 +83,19 @@ class MenuCategory < ApplicationRecord # def generate_menu_category_code # self.code = SeedGenerator.generate_code(self.class.name, "C") # end + + def self.to_csv + + mc_attributes = %w{id menu_id code name alt_name order_by created_by menu_category_id is_available created_at updated_at} + CSV.generate(headers: true) do |csv| + csv << mc_attributes + + csv << mc_attributes + MenuCategory.all.each do |user| + puts user + csv << mc_attributes.map{ |attr| user.send(attr)} + end + end + + end end diff --git a/app/models/order_item.rb b/app/models/order_item.rb index 776bb94c..87d60e63 100755 --- a/app/models/order_item.rb +++ b/app/models/order_item.rb @@ -5,7 +5,8 @@ class OrderItem < ApplicationRecord before_create :generate_custom_id #Associations - belongs_to :order, autosave: true + belongs_to :order, autosave: true + # belongs_to :order, counter_cache: true #Validation validates_presence_of :item_code, :item_name, :qty diff --git a/app/views/origami/addorders/detail.html.erb b/app/views/origami/addorders/detail.html.erb index 6c580f40..4e93e5a7 100755 --- a/app/views/origami/addorders/detail.html.erb +++ b/app/views/origami/addorders/detail.html.erb @@ -375,7 +375,7 @@
<%= order_item.item_name %> <%= order_item.qty %> <%= order_item.price %>
<%= order_item.item_name %> <%= order_item.qty %><%= order_item.price %><%= total %>
From a75d3e08df80cdd96d45fe3d8c597a95e551df26 Mon Sep 17 00:00:00 2001 From: Aung Myo Date: Fri, 23 Mar 2018 16:22:35 +0630 Subject: [PATCH 48/61] update scroll speed --- app/assets/javascripts/custom.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/app/assets/javascripts/custom.js b/app/assets/javascripts/custom.js index 7c4c8301..778de553 100644 --- a/app/assets/javascripts/custom.js +++ b/app/assets/javascripts/custom.js @@ -9,7 +9,8 @@ $(document).ready(function() { color: 'rgba(0,0,0,0.5)', alwaysVisible: false, borderRadius: '0', - railBorderRadius: '0' + railBorderRadius: '0', + touchScrollStep : 25 }); $('#order-detail-slimscroll').slimScroll({ @@ -18,7 +19,8 @@ $(document).ready(function() { color: 'rgba(0,0,0,0.5)', alwaysVisible: false, borderRadius: '0', - railBorderRadius: '0' + railBorderRadius: '0', + touchScrollStep : 25 }); $('#menu-slimscroll').slimScroll({ @@ -27,7 +29,8 @@ $(document).ready(function() { color: 'rgba(0,0,0,0.5)', alwaysVisible: false, borderRadius: '0', - railBorderRadius: '0' + railBorderRadius: '0', + touchScrollStep : 25 }); // $('.delete').click(function(){ From 37f80a8ac69542e6193dfab892df0da81a4c1614 Mon Sep 17 00:00:00 2001 From: Aung Myo Date: Fri, 23 Mar 2018 17:59:28 +0630 Subject: [PATCH 49/61] update sale --- app/models/sale.rb | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/app/models/sale.rb b/app/models/sale.rb index 5fc0c06f..b459f16c 100755 --- a/app/models/sale.rb +++ b/app/models/sale.rb @@ -799,10 +799,13 @@ def self.get_by_shift_sale(from,to,status) end def self.get_item_query() - query = Sale.select("acc.title as account_name,mi.account_id, i.item_instance_code as item_code,i.account_id as account_id, " + - "SUM(i.qty * i.unit_price) as grand_total,SUM(i.qty) as total_item,i.qty as qty," + + query = Sale.select("acc.title as account_name,mi.account_id, + i.item_instance_code as item_code,i.account_id as account_id, " + + "SUM(i.qty * i.unit_price) as grand_total, + SUM(i.qty) as total_item,i.qty as qty," + "i.status as status_type,"+ - " i.unit_price,i.price as price,i.product_name as product_name, mc.name as" + + " i.unit_price,i.price as price,i.product_name as product_name, + mc.name as" + " menu_category_name,mc.id as menu_category_id ") query = query.joins("JOIN sale_items i ON i.sale_id = sales.sale_id" + From 2a88bd4409b99e580cd10d4a1812bb18c367015d Mon Sep 17 00:00:00 2001 From: Aung Myo Date: Fri, 23 Mar 2018 18:02:41 +0630 Subject: [PATCH 50/61] updae session error --- app/controllers/origami/addorders_controller.rb | 2 +- app/controllers/origami/quick_service_controller.rb | 13 ++++++++++++- app/controllers/origami/request_bills_controller.rb | 8 +++++++- 3 files changed, 20 insertions(+), 3 deletions(-) diff --git a/app/controllers/origami/addorders_controller.rb b/app/controllers/origami/addorders_controller.rb index f5bb7d37..0e905724 100755 --- a/app/controllers/origami/addorders_controller.rb +++ b/app/controllers/origami/addorders_controller.rb @@ -1,6 +1,6 @@ class Origami::AddordersController < BaseOrigamiController # before_action :set_dining, only: [:detail] - + def index @tables = Table.all.active.order('zone_id asc').group("zone_id") @rooms = Room.all.active.order('zone_id asc').group("zone_id") diff --git a/app/controllers/origami/quick_service_controller.rb b/app/controllers/origami/quick_service_controller.rb index 44dcfcb8..8abcfcc8 100644 --- a/app/controllers/origami/quick_service_controller.rb +++ b/app/controllers/origami/quick_service_controller.rb @@ -1,6 +1,12 @@ class Origami::QuickServiceController < ApplicationController # before_action :set_dining, only: [:detail] - + before_action :check_user + def check_user + if current_user.nil? + redirect_to root_path + end + end + def index today = DateTime.now day = Date.today.wday @@ -211,6 +217,11 @@ class Origami::QuickServiceController < ApplicationController end end + def check_user + if current_user.nil? + redirect_to root_path + end + end # this can always true def check_order_with_booking(booking) if booking.sale.sale_status == "completed" || booking.sale.sale_status == "new" diff --git a/app/controllers/origami/request_bills_controller.rb b/app/controllers/origami/request_bills_controller.rb index adfe35a6..e2553a83 100755 --- a/app/controllers/origami/request_bills_controller.rb +++ b/app/controllers/origami/request_bills_controller.rb @@ -1,5 +1,11 @@ class Origami::RequestBillsController < ApplicationController - + before_action :check_user + + def check_user + if current_user.nil? + redirect_to root_path + end + end # Print Request Bill and add to sale tables def print @sale = Sale.new From e0fe0ee8ab69dec19a1cb73eac16c30b911d3213 Mon Sep 17 00:00:00 2001 From: phyusin Date: Fri, 23 Mar 2018 18:06:53 +0630 Subject: [PATCH 51/61] dashboard update --- app/controllers/home_controller.rb | 21 +++++--- app/views/home/dashboard.html.erb | 56 +++++++++++++++++++--- app/views/origami/dashboard/index.html.erb | 4 +- config/locales/en.yml | 2 + config/locales/mm.yml | 2 + 5 files changed, 70 insertions(+), 15 deletions(-) diff --git a/app/controllers/home_controller.rb b/app/controllers/home_controller.rb index f097ba6f..da8695d8 100755 --- a/app/controllers/home_controller.rb +++ b/app/controllers/home_controller.rb @@ -80,14 +80,21 @@ class HomeController < ApplicationController end def dashboard - @from, @to = get_date_range_from_params + @from, @to, @from_time, @to_time = get_date_range_from_params @shop = Shop.first today = DateTime.now.strftime('%Y-%m-%d') - @orders = Sale::where("payment_status='new' and sale_status='bill' and DATE_FORMAT(receipt_date,'%Y-%m-%d') = '#{today}'").count() - @sales = Sale::where("payment_status='paid' and sale_status='completed' and DATE_FORMAT(receipt_date,'%Y-%m-%d') = '#{today}'").count() - + if !@from.nil? && !@to.nil? + @orders = Sale::where("payment_status='new' and sale_status='bill' and DATE_FORMAT(receipt_date,'%Y-%m-%d') between '#{@from}' and '#{@to}'").count() + else + @orders = Sale::where("payment_status='new' and sale_status='bill' and DATE_FORMAT(receipt_date,'%Y-%m-%d') = '#{today}'").count() + end + if !@from.nil? && !@to.nil? + @sales = Sale::where("payment_status='paid' and sale_status='completed' and DATE_FORMAT(receipt_date,'%Y-%m-%d') between '#{@from}' and '#{@to}'").count() + else + @sales = Sale::where("payment_status='paid' and sale_status='completed' and DATE_FORMAT(receipt_date,'%Y-%m-%d') = '#{today}'").count() + end @top_products = Sale.top_products(today,@from,@to).sum('i.qty') @bottom_products = Sale.bottom_products(today,@from,@to).sum('i.qty') @hourly_sales = Sale.hourly_sales(today,@from,@to).sum(:grand_total) @@ -190,7 +197,9 @@ class HomeController < ApplicationController def get_date_range_from_params from = params[:from] - to = params[:to] + to = params[:to] + from_time = params[:from_time] + to_time = params[:to_time] if from.present? && to.present? f_date = DateTime.parse(from) @@ -201,7 +210,7 @@ class HomeController < ApplicationController to = t_time.end_of_day.utc.getlocal end - return from, to + return from, to, from_time, to_time end #Shop Name in Navbor diff --git a/app/views/home/dashboard.html.erb b/app/views/home/dashboard.html.erb index aee947c7..6ee68d97 100755 --- a/app/views/home/dashboard.html.erb +++ b/app/views/home/dashboard.html.erb @@ -68,16 +68,26 @@
-
+
- +
-
+
- +
+
+ + + +
+
+ + + +

@@ -340,21 +350,53 @@ $('.btn_generate').on('click',function(){ var from = $("#from").val(); var to = $("#to").val(); + var from_time = $("#from_time").val(); + var to_time = $("#to_time").val(); + + if(check(from,to,from_time,to_time)){ + var params = '?'; + if((from!='' && to!='') && (from_time!='' && to_time!='')){ + params += 'from='+from+'&to='+to+'&from_time='+from_time+'&to_time='+to_time; + }else{ + params += 'from='+from+'&to='+to; + } + window.location.href = '/dashboard'+params; + } + }); + + function check(from,to,from_time,to_time){ + var status = true; if((from=='') && (to=='')){ + status = false; $('#fromErr').html("can't be blank"); $('#toErr').html("can't be blank"); }else if((from!='') && (to=='')){ + status = false; $('#fromErr').html(""); $('#toErr').html("can't be blank"); }else if((from=='') && (to!='')){ + status = false; $('#fromErr').html("can't be blank"); $('#toErr').html(""); }else{ + status = true; $('#fromErr').html(""); $('#toErr').html(""); } - if((from!='') && (to!='')){ - window.location.href = '/dashboard?from='+from+'&to='+to; + + if(((from_time=='') && (to_time=='')) || ((from_time!='') && (to_time!=''))){ + status = true; + $('#from_timeErr').html(""); + $('#to_timeErr').html(""); + }else if((from_time!='') && (to_time=='')){ + status = false; + $('#from_timeErr').html(""); + $('#to_timeErr').html("can't be blank"); + }else if((from_time=='') && (to_time!='')){ + status = false; + $('#from_timeErr').html("can't be blank"); + $('#to_timeErr').html(""); } - }); + return status; + } \ No newline at end of file diff --git a/app/views/origami/dashboard/index.html.erb b/app/views/origami/dashboard/index.html.erb index 5361ac27..228da935 100644 --- a/app/views/origami/dashboard/index.html.erb +++ b/app/views/origami/dashboard/index.html.erb @@ -22,7 +22,7 @@
arrow_forward
-
Quick Service
+
<%= t :quick_service %>
@@ -30,7 +30,7 @@
arrow_forward
-
Cashier
+
<%= t :dine_in_order %>
diff --git a/config/locales/en.yml b/config/locales/en.yml index da68414c..84a7b03a 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -72,6 +72,8 @@ en: payment: "Payment" backend: "Backend" date_time: "DateTime" + dine_in_order: "Dine In Order" + quick_service: "Quick Service" views: btn: diff --git a/config/locales/mm.yml b/config/locales/mm.yml index d3ca2d0f..f18136c4 100644 --- a/config/locales/mm.yml +++ b/config/locales/mm.yml @@ -67,6 +67,8 @@ mm: payment: "ငွေပေးá€á€»á€±á€™á€¾á€¯" backend: "နောက်ကွယ်" date_time: "ရက်စွဲအá€á€»á€­á€”်" + dine_in_order: "Dine In Order" + quick_service: "Quick Service" views: btn: From f9aa3310fa3c6d16a1f2ed1c016eda4e2dfa2bb7 Mon Sep 17 00:00:00 2001 From: phyusin Date: Fri, 23 Mar 2018 19:37:32 +0630 Subject: [PATCH 52/61] check ability in booking --- app/models/ability.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/ability.rb b/app/models/ability.rb index de43d71f..0b1edcc3 100755 --- a/app/models/ability.rb +++ b/app/models/ability.rb @@ -105,7 +105,7 @@ class Ability can :show, :home can :read, Order can :update, Order - can :menage, Booking + can :manage, Booking can :manage, OrderQueueStation can :read, Sale can :update, Sale From ac0ee37136a90039b7a7eed7b3f27c5808eb081f Mon Sep 17 00:00:00 2001 From: Aung Myo Date: Mon, 26 Mar 2018 15:54:24 +0630 Subject: [PATCH 53/61] add foc , void and discount item in sale item report --- .../reports/saleitem_controller.rb | 6 +- app/models/sale.rb | 33 +- .../_shift_sale_report_filter.html.erb | 33 +- app/views/reports/saleitem/index.html.erb | 94 ++--- app/views/reports/saleitem/index.xls.erb | 188 +++++---- .../reports/saleitem/indexbackup.html.erb | 366 ++++++++++++++++++ 6 files changed, 573 insertions(+), 147 deletions(-) create mode 100644 app/views/reports/saleitem/indexbackup.html.erb diff --git a/app/controllers/reports/saleitem_controller.rb b/app/controllers/reports/saleitem_controller.rb index 796b02ad..a731cb44 100755 --- a/app/controllers/reports/saleitem_controller.rb +++ b/app/controllers/reports/saleitem_controller.rb @@ -15,8 +15,10 @@ class Reports::SaleitemController < BaseReportController shift = ShiftSale.where('shift_started_at = ? and shift_closed_at = ? ',shift_sale.shift_started_at, shift_sale.shift_closed_at) end end - @sale_data, @other_charges,@discount_data , @cash_data , @card_data , @credit_data , @foc_data , @grand_total , @change_amount = Sale.get_by_shift_items(shift_sale_range,shift, from, to, Sale::SALE_STATUS_COMPLETED) - + @type = params[:sale_type] + @sale_data, @other_charges,@discount_data , @cash_data , @card_data , @credit_data , @foc_data , @grand_total , @change_amount = Sale.get_by_shift_items(shift_sale_range,shift, from, to, Sale::SALE_STATUS_COMPLETED,@type) +puts @other_charges.to_json +puts "oooooooooooooooooooooooo" @sale_taxes = Sale.get_separate_tax(shift_sale_range,shift,from,to,nil) @account_cate_count = Hash.new {|hash, key| hash[key] = 0} diff --git a/app/models/sale.rb b/app/models/sale.rb index b459f16c..fb422a73 100755 --- a/app/models/sale.rb +++ b/app/models/sale.rb @@ -798,15 +798,27 @@ def self.get_by_shift_sale(from,to,status) return query = query.where("shift_sales.shift_started_at >= ?" + " AND shift_sales.shift_closed_at <= ?", from,to) end -def self.get_item_query() +def self.get_item_query(type) + + if type == "revenue" || type.nil? + sale_type = "i.status IS NULL and i.qty >0 " + elsif type == "all" + sale_type = "" + elsif type == "discount" + sale_type = "i.status = 'Discount'" + elsif type == "foc" + sale_type = "i.status = 'foc' and i.qty > 0" + elsif type == "void" + sale_type = "i.status = 'void' and i.qty > 0" + elsif type == "other" + sale_type = "i.item_instance_code IS NULL" + end query = Sale.select("acc.title as account_name,mi.account_id, i.item_instance_code as item_code,i.account_id as account_id, " + "SUM(i.qty * i.unit_price) as grand_total, SUM(i.qty) as total_item,i.qty as qty," + "i.status as status_type,"+ - " i.unit_price,i.price as price,i.product_name as product_name, - mc.name as" + - " menu_category_name,mc.id as menu_category_id ") + "i.unit_price,i.price as price,i.product_name as product_name,mc.name as " +"menu_category_name,mc.id as menu_category_id ") query = query.joins("JOIN sale_items i ON i.sale_id = sales.sale_id" + " JOIN menu_item_instances mii ON i.item_instance_code = mii.item_instance_code" + @@ -815,7 +827,7 @@ def self.get_item_query() " JOIN menu_categories mc ON mc.id = mi.menu_category_id ") # "JOIN employee_accesses ea ON ea.`employee_id` = sales.cashier_id ") query = query.joins(" JOIN accounts acc ON acc.id = mi.account_id") - # query = query.where("i.item_instance_code IS NOT NULL") + query = query.where("#{sale_type}") query = query.group("acc.title,mi.account_id,mi.menu_category_id,i.product_name,i.unit_price") .order("acc.title desc, mi.account_id desc, mi.menu_category_id desc, i.unit_price asc") end @@ -830,10 +842,15 @@ def self.get_other_charges() query = query.group("i.sale_item_id") end -def self.get_by_shift_items(shift_sale_range, shift, from, to, status) +def self.get_by_shift_items(shift_sale_range, shift, from, to, status,type) # date_type_selection = get_sql_function_for_report_type(report_type) - query = self.get_item_query() - + if type == "other" + other_charges = self.get_other_charges() + query = self.get_item_query(type) + else + query = self.get_item_query(type) + end + discount_query = 0 total_card_amount = 0 total_cash_amount = 0 diff --git a/app/views/reports/saleitem/_shift_sale_report_filter.html.erb b/app/views/reports/saleitem/_shift_sale_report_filter.html.erb index 88f26c1f..75a331e9 100755 --- a/app/views/reports/saleitem/_shift_sale_report_filter.html.erb +++ b/app/views/reports/saleitem/_shift_sale_report_filter.html.erb @@ -18,13 +18,25 @@ - -
+ +
+ + +
+
-
+
@@ -52,7 +64,7 @@ $('#frm_report').attr('action',url) $('#frm_report').submit(); // window.location = url; - }); + }); var item = $('#item').val(); var payment_type = $('#payment_type'); @@ -76,17 +88,18 @@ }); <% if params[:shift_name].to_i > 0%> - shift_id = '<%= params[:shift_name] %>' - local_date = '<%= @shift_from %> - <%= @shift_to %> ' - var shift = $('#shift_name'); - str = ''; - shift.append(str); + shift_id = '<%= params[:shift_name] %>' + local_date = '<%= @shift_from %> - <%= @shift_to %> ' + var shift = $('#shift_name'); + str = ''; + shift.append(str); <% end %> $("#from").val("<%=params[:from] rescue '-'%>"); $("#to").val("<%=params[:to] rescue '-'%>"); $("#sel_period").val(<%=params[:period] rescue '-'%>); - $("#sel_sale_type").val(<%=params[:sale_type] rescue '-'%>); + var sale_type = "<%=params[:sale_type]%>"; + $("#sel_sale_type").val(sale_type); <% if params[:period_type] == 1 || params[:period_type] == "1" %> diff --git a/app/views/reports/saleitem/index.html.erb b/app/views/reports/saleitem/index.html.erb index 3c03dec2..531d289b 100644 --- a/app/views/reports/saleitem/index.html.erb +++ b/app/views/reports/saleitem/index.html.erb @@ -57,8 +57,7 @@ delimiter = "" end %> - <% unless @sale_data.blank? %> - <% acc_arr = Array.new %> + <% acc_arr = Array.new %> <% cate_arr = Array.new %> <% sub_qty = 0 %> @@ -75,24 +74,27 @@ <% total_item_foc = 0 %> <% total_item_dis = 0.0 %> <% total_tax = 0 %> - + <% unless @sale_data.blank? %> <% @sale_data.each do |sale| %> + - <% if sale.status_type == "foc" && sale.grand_total < 0 + <% if !acc_arr.include?(sale.account_id) %>
@@ -151,7 +153,8 @@ <% end %> - <% if @other_charges.present? %> + <% if @type == "other"%> + @@ -191,55 +194,38 @@ <% end %> - - - - - - - - - - - - - - - - - - - - - + <% if @type == "other"%> - <% @sale_taxes.each do |tax| %> - - <% end %> - - - - - - - + + + + + + <% @other_charges.each do |other| %> + <% if other.total_item > 0 + total_qty += other.total_item + end %> + <% grand_total +=other.grand_total%> + + + + + + + + + + + + <% other_sub_total += other.grand_total %> + + <% end %> + + + + + + <%end%>
<%= sale.account_name %>
Other Charges  <%= number_with_precision(grand_total , precision:precision.to_i,delimiter:delimiter)%>
 <%= t("views.right_panel.detail.foc_item") %> <%= t("views.right_panel.detail.amount") %><%= number_with_precision(total_item_foc , precision:precision.to_i,delimiter:delimiter) %>
 <%= t("views.right_panel.detail.item_discount") %> <%= t("views.right_panel.detail.amount") %><%= number_with_precision(total_item_dis , precision:precision.to_i,delimiter:delimiter) %>
 <%= t("views.right_panel.detail.foc_sales") %> - <%= number_with_precision(@foc_data, precision:precision.to_i, delimiter:delimiter) %> -
 <%= t("views.right_panel.detail.discount") %> <%= t("views.right_panel.detail.amount") %> - - <%= number_with_precision(@discount_data , precision: precision.to_i,delimiter: delimiter) %> - -
 Net Amount<%= number_with_precision(grand_total.to_f - @discount_data.to_f , precision:precision.to_i,delimiter:delimiter)%>
Other Charges 
 Other Charges<%= other.item_code rescue '-' %><%= other.product_name rescue '-' %><%= other.total_item rescue '-' %> <%= number_with_precision(other.unit_price , precision:precision.to_i,delimiter:delimiter) rescue '-'%> <%= number_with_precision(other.grand_total , precision:precision.to_i,delimiter:delimiter) rescue '-'%>
 <%= t("views.right_panel.detail.sub_total") %><%= number_with_precision(other_sub_total , precision:precision.to_i,delimiter:delimiter)%>
diff --git a/app/views/reports/saleitem/index.xls.erb b/app/views/reports/saleitem/index.xls.erb index f97edbb8..85c666a5 100755 --- a/app/views/reports/saleitem/index.xls.erb +++ b/app/views/reports/saleitem/index.xls.erb @@ -27,10 +27,22 @@ - <% unless @sale_data.blank? %> - <% acc_arr = Array.new %> + <% if @print_settings.precision.to_i > 0 + precision = @print_settings.precision + else + precision = 0 + end + #check delimiter + if @print_settings.delimiter + delimiter = "," + else + delimiter = "" + end + %> + <% acc_arr = Array.new %> <% cate_arr = Array.new %> + <% sub_qty = 0 %> <% sub_total = 0 %> <% other_sub_total = 0 %> <% count = 0 %> @@ -42,14 +54,29 @@ <% total_amount = 0 %> <% discount = 0 %> <% total_item_foc = 0 %> - <% total_item_dis = 0 %> - + <% total_item_dis = 0.0 %> + <% total_tax = 0 %> + <% unless @sale_data.blank? %> <% @sale_data.each do |sale| %> - - <% if sale.total_item > 0 + + + + <% if !acc_arr.include?(sale.account_id) %> <%= sale.account_name %> @@ -58,7 +85,7 @@ <% @totalByAccount.each do |account, total| %> <% if sale.account_id == account %> - <%= total %> + <%= number_with_precision(total, precision:precision.to_i,delimiter:delimiter) %> <% grand_total += total %> <% end %> <% end %> @@ -77,95 +104,110 @@ <%= sale.item_code rescue '-' %> <%= sale.product_name rescue '-' %> <%= sale.total_item rescue '-' %> - <%= sale.unit_price rescue '-' %> - <%= sale.grand_total rescue '-' %> + <%= number_with_precision(sale.unit_price , precision:precision.to_i,delimiter:delimiter) rescue '-'%> + <%= number_with_precision(sale.grand_total , precision:precision.to_i,delimiter:delimiter) rescue '-'%> - <% @menu_cate_count.each do |key,value| %> - <% if sale.menu_category_id == key %> + <% @menu_cate_count.each do |key,value| %> + <% if sale.account_id == key %> <% count = count + 1 %> <% sub_total += sale.grand_total %> + <% #sub_qty += sale.total_item %> + <% if sale.status_type!="Discount" && (!sale.product_name.include? "FOC") + sub_qty += sale.total_item + end %> + <% if count == value %> -   +   + Total <%= sale.account_name %> Qty + <%= sub_qty %> <%= t("views.right_panel.detail.sub_total") %> - <%= sub_total %> + <%= number_with_precision(sub_total , precision:precision.to_i,delimiter:delimiter)%> - <% if sale.status_type === "foc" - total_item_foc += sale.grand_total - end %> - - <% if sale.status_type === "Discount" - total_item_dis += sale.grand_total - end %> <% sub_total = 0.0%> + <% sub_qty = 0 %> <% count = 0%> <% end %> - <% end %> <% end %> + <% end %> - <% end %> + <% end %> - - Other Charges -   - - - <% @other_charges.each do |other| %> - <% if other.total_item > 0 - total_qty += other.total_item - end %> - <% grand_total +=other.grand_total%> - -   - Other Charges - <%= other.item_code rescue '-' %> - <%= other.product_name rescue '-' %> - <%= other.total_item rescue '-' %> - <%= other.unit_price rescue '-' %> - <%= other.grand_total rescue '-' %> + <% if @type == "other"%> + + + Other Charges +   + - - - <% other_sub_total += other.grand_total %> - - <% end %> - -   - <%= t("views.right_panel.detail.sub_total") %> - <%= other_sub_total %> - + <% @other_charges.each do |other| %> + <% if other.total_item > 0 + total_qty += other.total_item + end %> + <% grand_total +=other.grand_total%> + +   + Other Charges + <%= other.item_code rescue '-' %> + <%= other.product_name rescue '-' %> + <%= other.total_item rescue '-' %> + <%= number_with_precision(other.unit_price , precision:precision.to_i,delimiter:delimiter) rescue '-'%> + <%= number_with_precision(other.grand_total , precision:precision.to_i,delimiter:delimiter) rescue '-'%> + + + + <% other_sub_total += other.grand_total %> + + <% end %> + +   + <%= t("views.right_panel.detail.sub_total") %> + <%= number_with_precision(other_sub_total , precision:precision.to_i,delimiter:delimiter)%> + + <%end%>   <%= t("views.right_panel.detail.total") %> <%= t("views.right_panel.detail.item") %> <%= total_qty%> - <%= t("views.right_panel.detail.net_amount") %> - <%= grand_total%> + <%= t("views.right_panel.detail.total") %> <%= t("views.right_panel.detail.amount") %> + <%= number_with_precision(grand_total , precision:precision.to_i,delimiter:delimiter)%> <% end %> - - -   - <%= t("views.right_panel.detail.foc_item") %> <%= t("views.right_panel.detail.amount") %> - <%= total_item_foc %> - - -   - <%= t("views.right_panel.detail.item_discount") %> <%= t("views.right_panel.detail.amount") %> - <%= total_item_dis %> - - -   - <%= t("views.right_panel.detail.foc_sales") %> - <%= @foc_data %> - - -   - <%= t("views.right_panel.detail.discount") %> <%= t("views.right_panel.detail.amount") %> - <%= @discount_data %> - + <% if @type == "other"%> + + + Other Charges +   + + + <% @other_charges.each do |other| %> + <% if other.total_item > 0 + total_qty += other.total_item + end %> + <% grand_total +=other.grand_total%> + +   + Other Charges + <%= other.item_code rescue '-' %> + <%= other.product_name rescue '-' %> + <%= other.total_item rescue '-' %> + <%= number_with_precision(other.unit_price , precision:precision.to_i,delimiter:delimiter) rescue '-'%> + <%= number_with_precision(other.grand_total , precision:precision.to_i,delimiter:delimiter) rescue '-'%> + + + + <% other_sub_total += other.grand_total %> + + <% end %> + +   + <%= t("views.right_panel.detail.sub_total") %> + <%= number_with_precision(other_sub_total , precision:precision.to_i,delimiter:delimiter)%> + + <%end%> diff --git a/app/views/reports/saleitem/indexbackup.html.erb b/app/views/reports/saleitem/indexbackup.html.erb new file mode 100644 index 00000000..3c03dec2 --- /dev/null +++ b/app/views/reports/saleitem/indexbackup.html.erb @@ -0,0 +1,366 @@ + +
+
+ <%= render :partial=>'shift_sale_report_filter', + :locals=>{ :period_type => true, :shift_name => true, :report_path =>reports_saleitem_index_path} %> + +
+ + + +
+
+
+ + + + + + <% if @shift_from %> + + <% if @shift_data.employee %> + <% cashier_name = !@shift_data.nil? ? @shift_data.employee.name : '-' %> + <% end %> + + + <% end %> + + + + + + + + + + + + <% if @print_settings.precision.to_i > 0 + precision = @print_settings.precision + else + precision = 0 + end + #check delimiter + if @print_settings.delimiter + delimiter = "," + else + delimiter = "" + end + %> + <% unless @sale_data.blank? %> + <% acc_arr = Array.new %> + <% cate_arr = Array.new %> + + <% sub_qty = 0 %> + <% sub_total = 0 %> + <% other_sub_total = 0 %> + <% count = 0 %> + <% total_price = 0 %> + <% cate_count = 0 %> + <% acc_count = 0 %> + <% grand_total = 0 %> + <% total_qty = 0 %> + <% total_amount = 0 %> + <% discount = 0 %> + <% total_item_foc = 0 %> + <% total_item_dis = 0.0 %> + <% total_tax = 0 %> + + <% @sale_data.each do |sale| %> + + <% if sale.status_type != "Discount" && sale.status_type != "foc" + total_qty += sale.total_item + end %> + <% if sale.status_type == "foc" && sale.price > 0 + total_qty += sale.total_item + end %> + + <% if sale.status_type == "foc" && sale.grand_total < 0 + total_item_foc += sale.grand_total*(-1) + end %> + + <% if sale.status_type == "Discount" && sale.grand_total < 0 + total_item_dis += sale.grand_total*(-1) + end %> + + <% if !acc_arr.include?(sale.account_id) %> + + + + + + + <% acc_arr.push(sale.account_id) %> + <% end %> + + + <% if !cate_arr.include?(sale.menu_category_id) %> + + <% cate_arr.push(sale.menu_category_id) %> + <% else %> + + <% end %> + + + + + + + + + <% @menu_cate_count.each do |key,value| %> + <% if sale.account_id == key %> + <% count = count + 1 %> + <% sub_total += sale.grand_total %> + <% #sub_qty += sale.total_item %> + <% if sale.status_type!="Discount" && (!sale.product_name.include? "FOC") + sub_qty += sale.total_item + end %> + + <% if count == value %> + + + + + + + + <% sub_total = 0.0%> + <% sub_qty = 0 %> + <% count = 0%> + <% end %> + <% end %> + <% end %> + + <% end %> + + <% if @other_charges.present? %> + + + + + + <% @other_charges.each do |other| %> + <% if other.total_item > 0 + total_qty += other.total_item + end %> + <% grand_total +=other.grand_total%> + + + + + + + + + + + + <% other_sub_total += other.grand_total %> + + <% end %> + + + + + + <%end%> + + + + + + + + + <% end %> + + + + + + + + + + + + + + + + + + + + + + + <% @sale_taxes.each do |tax| %> + + <% end %> + + + + + + + + +
<%= t("views.right_panel.detail.from_date") %> : <%= @from.utc.getlocal.strftime("%Y-%b-%d") rescue '-' %> - <%= t("views.right_panel.detail.to_date") %> : <%= @to.utc.getlocal.strftime("%Y-%b-%d") rescue '-'%>
<%= t("views.right_panel.detail.shift_name") %> = <%= @shift_from %> - <%= @shift_to %> ( <%= cashier_name %> )
 <%= t("views.right_panel.header.menu_category") %><%= t("views.right_panel.detail.code") %><%= t("views.right_panel.detail.product") %><%= t("views.right_panel.detail.total") %> <%= t("views.right_panel.detail.item") %><%= t("views.right_panel.detail.unit_price") %><%= t("views.right_panel.detail.revenue") %>
<%= sale.account_name %> <%= t("views.right_panel.detail.total_price_by") %> <%= sale.account_name %> + <% @totalByAccount.each do |account, total| %> + <% if sale.account_id == account %> + <%= number_with_precision(total, precision:precision.to_i,delimiter:delimiter) %> + <% grand_total += total %> + <% end %> + <% end %> +
 <%= sale.menu_category_name %> <%= sale.item_code rescue '-' %><%= sale.product_name rescue '-' %><%= sale.total_item rescue '-' %><%= number_with_precision(sale.unit_price , precision:precision.to_i,delimiter:delimiter) rescue '-'%><%= number_with_precision(sale.grand_total , precision:precision.to_i,delimiter:delimiter) rescue '-'%>
 Total <%= sale.account_name %> Qty <%= sub_qty %><%= t("views.right_panel.detail.sub_total") %><%= number_with_precision(sub_total , precision:precision.to_i,delimiter:delimiter)%>
Other Charges 
 Other Charges<%= other.item_code rescue '-' %><%= other.product_name rescue '-' %><%= other.total_item rescue '-' %> <%= number_with_precision(other.unit_price , precision:precision.to_i,delimiter:delimiter) rescue '-'%> <%= number_with_precision(other.grand_total , precision:precision.to_i,delimiter:delimiter) rescue '-'%>
 <%= t("views.right_panel.detail.sub_total") %><%= number_with_precision(other_sub_total , precision:precision.to_i,delimiter:delimiter)%>
 <%= t("views.right_panel.detail.total") %> <%= t("views.right_panel.detail.item") %><%= total_qty%><%= t("views.right_panel.detail.total") %> <%= t("views.right_panel.detail.amount") %><%= number_with_precision(grand_total , precision:precision.to_i,delimiter:delimiter)%>
 <%= t("views.right_panel.detail.foc_item") %> <%= t("views.right_panel.detail.amount") %><%= number_with_precision(total_item_foc , precision:precision.to_i,delimiter:delimiter) %>
 <%= t("views.right_panel.detail.item_discount") %> <%= t("views.right_panel.detail.amount") %><%= number_with_precision(total_item_dis , precision:precision.to_i,delimiter:delimiter) %>
 <%= t("views.right_panel.detail.foc_sales") %> + <%= number_with_precision(@foc_data, precision:precision.to_i, delimiter:delimiter) %> +
 <%= t("views.right_panel.detail.discount") %> <%= t("views.right_panel.detail.amount") %> + + <%= number_with_precision(@discount_data , precision: precision.to_i,delimiter: delimiter) %> + +
 Net Amount<%= number_with_precision(grand_total.to_f - @discount_data.to_f , precision:precision.to_i,delimiter:delimiter)%>
+
+
+
+
+
+ + \ No newline at end of file From 4b78de3f9a5635964c03d3bd8188a2a46cf265da Mon Sep 17 00:00:00 2001 From: phyusin Date: Mon, 26 Mar 2018 16:42:17 +0630 Subject: [PATCH 54/61] add filter in dashboard and Transaction/Sale --- app/controllers/home_controller.rb | 75 +- .../transactions/sales_controller.rb | 93 +- app/models/sale.rb | 850 ++++++++++++++---- app/models/stock_journal.rb | 10 +- app/views/home/dashboard.html.erb | 30 +- app/views/transactions/sales/index.html.erb | 144 ++- 6 files changed, 972 insertions(+), 230 deletions(-) diff --git a/app/controllers/home_controller.rb b/app/controllers/home_controller.rb index da8695d8..d2b0ad36 100755 --- a/app/controllers/home_controller.rb +++ b/app/controllers/home_controller.rb @@ -86,64 +86,72 @@ class HomeController < ApplicationController today = DateTime.now.strftime('%Y-%m-%d') if !@from.nil? && !@to.nil? - @orders = Sale::where("payment_status='new' and sale_status='bill' and DATE_FORMAT(receipt_date,'%Y-%m-%d') between '#{@from}' and '#{@to}'").count() + if !@from_time.nil? && @to_time.nil? + @orders = Sale::where("payment_status='new' and sale_status='bill' and DATE_FORMAT(receipt_date,'%Y-%m-%d') between '#{@from}' and '#{@to}' and DATE_FORMAT(CONVERT_TZ(receipt_date,'+00:00','+06:30'),'%H:%m') between '#{@from_time}' and '#{@to_time}'").count() + else + @orders = Sale::where("payment_status='new' and sale_status='bill' and DATE_FORMAT(receipt_date,'%Y-%m-%d') between '#{@from}' and '#{@to}'").count() + end else @orders = Sale::where("payment_status='new' and sale_status='bill' and DATE_FORMAT(receipt_date,'%Y-%m-%d') = '#{today}'").count() end if !@from.nil? && !@to.nil? - @sales = Sale::where("payment_status='paid' and sale_status='completed' and DATE_FORMAT(receipt_date,'%Y-%m-%d') between '#{@from}' and '#{@to}'").count() + if !@from_time.nil? && @to_time.nil? + @sales = Sale::where("payment_status='paid' and sale_status='completed' and DATE_FORMAT(receipt_date,'%Y-%m-%d') between '#{@from}' and '#{@to}' and DATE_FORMAT(CONVERT_TZ(receipt_date,'+00:00','+06:30'),'%H:%m') between '#{@from_time}' and '#{@to_time}'").count() + else + @sales = Sale::where("payment_status='paid' and sale_status='completed' and DATE_FORMAT(receipt_date,'%Y-%m-%d') between '#{@from}' and '#{@to}'").count() + end else @sales = Sale::where("payment_status='paid' and sale_status='completed' and DATE_FORMAT(receipt_date,'%Y-%m-%d') = '#{today}'").count() end - @top_products = Sale.top_products(today,@from,@to).sum('i.qty') - @bottom_products = Sale.bottom_products(today,@from,@to).sum('i.qty') - @hourly_sales = Sale.hourly_sales(today,@from,@to).sum(:grand_total) + @top_products = Sale.top_products(today,current_user,@from,@to,@from_time,@to_time).sum('i.qty') + @bottom_products = Sale.bottom_products(today,current_user,@from,@to,@from_time,@to_time).sum('i.qty') + @hourly_sales = Sale.hourly_sales(today,current_user,@from,@to,@from_time,@to_time).sum(:grand_total) # .group_by_hour(:created_at, :time_zone => 'Asia/Rangoon',format: '%I:%p') # .sum(:grand_total) - @employee_sales = Sale.employee_sales(today,@from,@to) + @employee_sales = Sale.employee_sales(today,current_user,@from,@to,@from_time,@to_time) .sum('(CASE WHEN sp.payment_method="cash" THEN (sp.payment_amount - sales.amount_changed) ELSE sp.payment_amount END)') - @inventories = StockJournal.inventory_balances(today,@from,@to).sum(:balance) + @inventories = StockJournal.inventory_balances(today,@from,@to,@from_time,@to_time).sum(:balance) - @total_sale = Sale.total_sale(today,current_user,@from,@to) - @total_count = Sale.total_count(today,current_user,@from,@to) - @total_card = Sale.total_card_sale(today,current_user,@from,@to) - @total_credit = Sale.credit_payment(today,current_user,@from,@to) + @total_sale = Sale.total_sale(today,current_user,@from,@to,@from_time,@to_time) + @total_count = Sale.total_count(today,current_user,@from,@to,@from_time,@to_time) + @total_card = Sale.total_card_sale(today,current_user,@from,@to,@from_time,@to_time) + @total_credit = Sale.credit_payment(today,current_user,@from,@to,@from_time,@to_time) @sale_data = Array.new - @total_payment_methods = Sale.total_payment_methods(today,current_user,@from,@to) + @total_payment_methods = Sale.total_payment_methods(today,current_user,@from,@to,@from_time,@to_time) if !@total_payment_methods.nil? @total_payment_methods.each do |payment| - if payment.payment_method == "mpu" || payment.payment_method == "visa" || payment.payment_method == "master" || payment.payment_method == "jcb" - pay = Sale.payment_sale('card', today, current_user,@from,@to) + if payment.payment_method == "mpu" || payment.payment_method == "visa" || payment.payment_method == "master" || payment.payment_method == "jcb" || payment.payment_method == "unionpay" + pay = Sale.payment_sale('card', today, current_user,@from,@to,@from_time,@to_time) @sale_data.push({'card' => pay.payment_amount}) else - pay = Sale.payment_sale(payment.payment_method, today, current_user,@from,@to) + pay = Sale.payment_sale(payment.payment_method, today, current_user,@from,@to,@from_time,@to_time) @sale_data.push({payment.payment_method => pay.payment_amount}) end end end - @summ_sale = Sale.summary_sale_receipt(today,current_user,@from,@to) - @total_customer = Sale.total_customer(today,current_user,@from,@to) - @total_dinein = Sale.total_dinein(today,current_user,@from,@to) - @total_takeaway = Sale.total_takeaway(today,current_user,@from,@to) - @total_other_customer = Sale.total_other_customer(today,current_user,@from,@to) - @total_membership = Sale.total_membership(today,current_user,@from,@to) + @summ_sale = Sale.summary_sale_receipt(today,current_user,@from,@to,@from_time,@to_time) + @total_customer = Sale.total_customer(today,current_user,@from,@to,@from_time,@to_time) + @total_dinein = Sale.total_dinein(today,current_user,@from,@to,@from_time,@to_time) + @total_takeaway = Sale.total_takeaway(today,current_user,@from,@to,@from_time,@to_time) + @total_other_customer = Sale.total_other_customer(today,current_user,@from,@to,@from_time,@to_time) + @total_membership = Sale.total_membership(today,current_user,@from,@to,@from_time,@to_time) - @total_order = Sale.total_order(today,current_user,@from,@to) - @total_accounts = Sale.total_account(today,current_user,@from,@to) + @total_order = Sale.total_order(today,current_user,@from,@to,@from_time,@to_time) + @total_accounts = Sale.total_account(today,current_user,@from,@to,@from_time,@to_time) @account_data = Array.new if !@total_accounts.nil? @total_accounts.each do |account| - acc = Sale.account_data(account.account_id, today,current_user,@from,@to) + acc = Sale.account_data(account.account_id, today,current_user,@from,@to,@from_time,@to_time) if !acc.nil? @account_data.push({account.title => acc.cnt_acc, account.title + '_amount' => acc.total_acc}) end end end - @top_items = Sale.top_items(today,current_user,@from,@to) - @total_foc_items = Sale.total_foc_items(today,current_user,@from,@to) + @top_items = Sale.top_items(today,current_user,@from,@to,@from_time,@to_time) + @total_foc_items = Sale.total_foc_items(today,current_user,@from,@to,@from_time,@to_time) # get printer info @print_settings = PrintSetting.get_precision_delimiter() @@ -202,12 +210,15 @@ class HomeController < ApplicationController to_time = params[:to_time] if from.present? && to.present? - f_date = DateTime.parse(from) - t_date = DateTime.parse(to) - f_time = Time.mktime(f_date.year,f_date.month,f_date.day,f_date.hour,f_date.min,f_date.sec) - t_time = Time.mktime(t_date.year,t_date.month,t_date.day,t_date.hour,t_date.min,t_date.sec) - from = f_time.beginning_of_day.utc.getlocal - to = t_time.end_of_day.utc.getlocal + # f_date = DateTime.parse(from) + # t_date = DateTime.parse(to) + # f_time = Time.mktime(f_date.year,f_date.month,f_date.day,f_date.hour,f_date.min,f_date.sec) + # t_time = Time.mktime(t_date.year,t_date.month,t_date.day,t_date.hour,t_date.min,t_date.sec) + # from = f_time.beginning_of_day.utc.getlocal + # to = t_time.end_of_day.utc.getlocal + + from = DateTime.parse(from).utc.getlocal.strftime('%Y-%m-%d') + to = DateTime.parse(to).utc.getlocal.strftime('%Y-%m-%d') end return from, to, from_time, to_time diff --git a/app/controllers/transactions/sales_controller.rb b/app/controllers/transactions/sales_controller.rb index bae9c353..be370371 100755 --- a/app/controllers/transactions/sales_controller.rb +++ b/app/controllers/transactions/sales_controller.rb @@ -8,14 +8,23 @@ class Transactions::SalesController < ApplicationController def index receipt_no = params[:receipt_no] - from = params[:from] - to = params[:to] + # from = params[:from] + # to = params[:to] + from, to = get_date_range_from_params + @shift = '' + if params[:shift_name].to_i != 0 + @shift = ShiftSale.find(params[:shift_name]) + end if receipt_no.nil? && from.nil? && to.nil? - @sales = Sale.where("NOT sale_status='new'").order("sale_id desc") + if @shift.blank? + @sales = Sale.where("NOT sale_status='new'").order("sale_id desc") + else + @sales = Sale.where("NOT sale_status='new' and shift_sale_id ='#{@shift.id}'").order("sale_id desc") + end @sales = Kaminari.paginate_array(@sales).page(params[:page]).per(20) else - sale = Sale.search(receipt_no,from,to) + sale = Sale.search(receipt_no,from,to,@shift) if sale.count > 0 @sales = sale @sales = Kaminari.paginate_array(@sales).page(params[:page]).per(20) @@ -26,6 +35,12 @@ class Transactions::SalesController < ApplicationController @receipt_no = receipt_no @from = from @to = to + + if @shift.present? + @shift_from = @shift.shift_started_at.nil? ? '-' : @shift.shift_started_at.utc.getlocal.strftime("%e %b %I:%M%p") + @shift_to = @shift.shift_closed_at.nil? ? '-' : @shift.shift_closed_at.utc.getlocal.strftime("%e %b %I:%M%p") + @shift_data = @shift + end # if receipt_no.nil? && search_date.nil? # @sales = Sale.where("NOT sale_status = 'void' " ).order("sale_id desc").limit(500) @@ -48,7 +63,7 @@ class Transactions::SalesController < ApplicationController @sale_audits = [] @sale_item_audits = [] - if !@sales.nil? + if @sales != 0 @sales.each do |sale| sale_audit = SaleAudit.where("(action = 'SALEPAYMENT' or action = 'SALEVOID') and sale_id = ? and remark IS NOT NULL",sale.sale_id) if !sale_audit.nil? @@ -148,6 +163,74 @@ class Transactions::SalesController < ApplicationController end end + # date range + PERIOD = { + "today" => 0, + "yesterday" => 1, + "this_week" => 2, + "last_week" => 3, + "last_7" => 4, + "this_month" => 5, + "last_month" => 6, + "last_30" => 7, + "this_year" => 8, + "last_year" => 9 + } + + def get_date_range_from_params + period_type = params[:period_type] + period = params[:period] + from = params[:from] + to = params[:to] + day_ref = Time.now.utc.getlocal + + if from.present? && to.present? + f_date = DateTime.parse(from) + t_date = DateTime.parse(to) + f_time = Time.mktime(f_date.year,f_date.month,f_date.day,f_date.hour,f_date.min,f_date.sec) + t_time = Time.mktime(t_date.year,t_date.month,t_date.day,t_date.hour,t_date.min,t_date.sec) + from = f_time.beginning_of_day.utc.getlocal + to = t_time.end_of_day.utc.getlocal + else + case period.to_i + when PERIOD["today"] + from = day_ref.beginning_of_day.utc + to = day_ref.end_of_day.utc + + when PERIOD["yesterday"] + from = (day_ref - 1.day).beginning_of_day.utc + to = (day_ref - 1.day).end_of_day.utc + + when PERIOD["this_week"] + from = Time.now.beginning_of_week.utc + to = Time.now.utc + when PERIOD["last_week"] + from = (day_ref - 7.day).beginning_of_week.utc + to = (day_ref - 7.day).end_of_week.utc + when PERIOD["last_7"] + from = (day_ref - 7.day).utc + to = Time.now.utc + when PERIOD["this_month"] + from = Time.now.beginning_of_month.utc + to = Time.now.utc + when PERIOD["last_month"] + from = (day_ref - 1.month).beginning_of_month.utc + to = (day_ref - 1.month).end_of_month.utc + when PERIOD["last_30"] + from = (day_ref - 30.day).utc + to = Time.now.utc + when PERIOD["this_year"] + from = Time.now.beginning_of_year.utc + to = Time.now.utc + when PERIOD["last_year"] + from = (day_ref - 1.year).beginning_of_year.utc + to = (day_ref - 1.year).end_of_year.utc + end + end + + return from, to + end + def check_user if current_user.nil? redirect_to root_path diff --git a/app/models/sale.rb b/app/models/sale.rb index 5fc0c06f..a997e27f 100755 --- a/app/models/sale.rb +++ b/app/models/sale.rb @@ -598,7 +598,7 @@ class Sale < ApplicationRecord end end - def self.search(filter,from,to) + def self.search(filter,from,to,shift) if filter.blank? keyword = '' else @@ -606,10 +606,18 @@ class Sale < ApplicationRecord end if from.present? && to.present? - sale = Sale.where("DATE_FORMAT(receipt_date,'%d-%m-%Y') >= ?" + " AND DATE_FORMAT(receipt_date,'%d-%m-%Y') <= ? and NOT sale_status = 'new' ", from,to) - query = sale.where(keyword) + if shift.blank? + sale = Sale.where("DATE_FORMAT(receipt_date,'%Y-%m-%d') >= ?" + " AND DATE_FORMAT(receipt_date,'%Y-%m-%d') <= ? and NOT sale_status = 'new' ", from,to) + else + sale = Sale.where("DATE_FORMAT(receipt_date,'%Y-%m-%d') >= ?" + " AND DATE_FORMAT(receipt_date,'%Y-%m-%d') <= ? and NOT sale_status = 'new' and shift_sale_id = '#{shift.id}'", from,to) + end + query = sale.where(keyword) else + if shift.blank? where("receipt_no LIKE ? OR cashier_name LIKE ? OR sale_status ='#{filter}'","%#{filter}%","%#{filter}%") + else + where("receipt_no LIKE ? OR cashier_name LIKE ? OR sale_status ='#{filter}' and shift_sale_id = ?","%#{filter}%","%#{filter}%",shift.id) + end end end @@ -1134,88 +1142,319 @@ end return tax end - def self.top_products(today,from,to) + def self.top_products(today,current_user,from,to,from_time,to_time) if !from.nil? && !to.nil? - query = Sale.select("(SUM(i.qty) * i.price) as grand_total,SUM(i.qty) as total_item," + + if current_user.nil? + query = Sale.select("(SUM(i.qty) * i.price) as grand_total,SUM(i.qty) as total_item," + + " i.price as unit_price,mi.name as product_name") + .joins("JOIN sale_items i ON i.sale_id = sales.sale_id JOIN menu_items mi ON i.product_code = mi.item_code") + if !from_time.nil? && !to_time.nil? + query = query.where("(i.qty > 0 and i.price > 0) and DATE_FORMAT(CONVERT_TZ(receipt_date,'+00:00','+06:30'),'%Y-%m-%d') between '#{from}' and '#{to}'"+ + " and DATE_FORMAT(CONVERT_TZ(receipt_date,'+00:00','+06:30'),'%H:%M') between '#{from_time}' and '#{to_time}' and sale_status= 'completed'") + else + query = query.where("(i.qty > 0 and i.price > 0) and DATE_FORMAT(CONVERT_TZ(receipt_date,'+00:00','+06:30'),'%Y-%m-%d') between '#{from}' and '#{to}'"+ + " and sale_status= 'completed'") + end + query = query.group('mi.name') + .order("SUM(i.qty) DESC").limit(20) + else + if current_user.role == 'administrator' || current_user.role == 'manager' + query = Sale.select("(SUM(i.qty) * i.price) as grand_total,SUM(i.qty) as total_item," + " i.price as unit_price,mi.name as product_name") .joins("JOIN sale_items i ON i.sale_id = sales.sale_id JOIN menu_items mi ON i.product_code = mi.item_code") - .where("(i.qty > 0 and i.price > 0) and receipt_date between '#{from}' and '#{to}'"+ - "and sale_status= 'completed'") - .group('mi.name') - .order("SUM(i.qty) DESC").limit(20) + if !from_time.nil? && !to_time.nil? + query = query.where("(i.qty > 0 and i.price > 0) and DATE_FORMAT(CONVERT_TZ(receipt_date,'+00:00','+06:30'),'%Y-%m-%d') between '#{from}' and '#{to}'"+ + " and DATE_FORMAT(CONVERT_TZ(receipt_date,'+00:00','+06:30'),'%H:%M') between '#{from_time}' and '#{to_time}' and sale_status= 'completed'") + else + query = query.where("(i.qty > 0 and i.price > 0) and DATE_FORMAT(CONVERT_TZ(receipt_date,'+00:00','+06:30'),'%Y-%m-%d') between '#{from}' and '#{to}'"+ + " and sale_status= 'completed'") + end + query = query.group('mi.name') + .order("SUM(i.qty) DESC").limit(20) + else + shift = ShiftSale.current_open_shift(current_user.id) + if !shift.nil? + query = Sale.select("(SUM(i.qty) * i.price) as grand_total,SUM(i.qty) as total_item," + + " i.price as unit_price,mi.name as product_name") + .joins("JOIN sale_items i ON i.sale_id = sales.sale_id JOIN menu_items mi ON i.product_code = mi.item_code") + if !from_time.nil? && !to_time.nil? + query = query.where("(i.qty > 0 and i.price > 0) and DATE_FORMAT(CONVERT_TZ(receipt_date,'+00:00','+06:30'),'%Y-%m-%d') between '#{from}' and '#{to}'"+ + " and DATE_FORMAT(CONVERT_TZ(receipt_date,'+00:00','+06:30'),'%H:%M') between '#{from_time}' and '#{to_time}' and sale_status= 'completed' and shift_sale_id='#{shift.id}'") + else + query = query.where("(i.qty > 0 and i.price > 0) and DATE_FORMAT(CONVERT_TZ(receipt_date,'+00:00','+06:30'),'%Y-%m-%d') between '#{from}' and '#{to}'"+ + " and sale_status= 'completed' and shift_sale_id='#{shift.id}'") + end + query = query.group('mi.name') + .order("SUM(i.qty) DESC").limit(20) + end + end + end else - query = Sale.select("(SUM(i.qty) * i.price) as grand_total,SUM(i.qty) as total_item," + + if current_user.nil? + query = Sale.select("(SUM(i.qty) * i.price) as grand_total,SUM(i.qty) as total_item," + " i.price as unit_price,mi.name as product_name") .joins("JOIN sale_items i ON i.sale_id = sales.sale_id JOIN menu_items mi ON i.product_code = mi.item_code") .where("(i.qty > 0 and i.price > 0) and DATE_FORMAT(receipt_date,'%Y-%m-%d') = '#{today}'"+ - "and sale_status= 'completed'") + " and sale_status= 'completed'") .group('mi.name') .order("SUM(i.qty) DESC").limit(20) + else + if current_user.role == 'administrator' || current_user.role == 'manager' + query = Sale.select("(SUM(i.qty) * i.price) as grand_total,SUM(i.qty) as total_item," + + " i.price as unit_price,mi.name as product_name") + .joins("JOIN sale_items i ON i.sale_id = sales.sale_id JOIN menu_items mi ON i.product_code = mi.item_code") + .where("(i.qty > 0 and i.price > 0) and DATE_FORMAT(receipt_date,'%Y-%m-%d') = '#{today}'"+ + " and sale_status= 'completed'") + .group('mi.name') + .order("SUM(i.qty) DESC").limit(20) + else + shift = ShiftSale.current_open_shift(current_user.id) + if !shift.nil? + query = Sale.select("(SUM(i.qty) * i.price) as grand_total,SUM(i.qty) as total_item," + + " i.price as unit_price,mi.name as product_name") + .joins("JOIN sale_items i ON i.sale_id = sales.sale_id JOIN menu_items mi ON i.product_code = mi.item_code") + .where("(i.qty > 0 and i.price > 0) and DATE_FORMAT(receipt_date,'%Y-%m-%d') = '#{today}'"+ + " and sale_status= 'completed' and shift_sale_id='#{shift.id}'") + .group('mi.name') + .order("SUM(i.qty) DESC").limit(20) + end + end + end end end - def self.bottom_products(today,from,to) + def self.bottom_products(today,current_user,from,to,from_time,to_time) if !from.nil? && !to.nil? - query = Sale.select("(SUM(i.qty) * i.price) as grand_total,SUM(i.qty) as total_item," + - " i.price as unit_price,mi.name as product_name") - .joins("JOIN sale_items i ON i.sale_id = sales.sale_id JOIN menu_items mi ON i.product_code = mi.item_code") - .where("(i.qty > 0 and i.price > 0) and receipt_date between '#{from}' and '#{to}'"+ - "and sale_status= 'completed'") - .group('mi.name') + if current_user.nil? + query = Sale.select("(SUM(i.qty) * i.price) as grand_total,SUM(i.qty) as total_item," + + " i.price as unit_price,mi.name as product_name") + .joins("JOIN sale_items i ON i.sale_id = sales.sale_id JOIN menu_items mi ON i.product_code = mi.item_code") + if !from_time.nil? && !to_time.nil? + query = query.where("(i.qty > 0 and i.price > 0) and DATE_FORMAT(CONVERT_TZ(receipt_date,'+00:00','+06:30'),'%Y-%m-%d') between '#{from}' and '#{to}'"+ + " and DATE_FORMAT(CONVERT_TZ(receipt_date,'+00:00','+06:30'),'%H:%M') between '#{from_time}' and '#{to_time}' and sale_status= 'completed'") + else + query = query.where("(i.qty > 0 and i.price > 0) and DATE_FORMAT(CONVERT_TZ(receipt_date,'+00:00','+06:30'),'%Y-%m-%d') between '#{from}' and '#{to}'"+ + " and sale_status= 'completed'") + end + query = query.group('mi.name') .order("SUM(i.qty) ASC").limit(20) + else + if current_user.role == 'administrator' || current_user.role == 'manager' + query = Sale.select("(SUM(i.qty) * i.price) as grand_total,SUM(i.qty) as total_item," + + " i.price as unit_price,mi.name as product_name") + .joins("JOIN sale_items i ON i.sale_id = sales.sale_id JOIN menu_items mi ON i.product_code = mi.item_code") + if !from_time.nil? && !to_time.nil? + query = query.where("(i.qty > 0 and i.price > 0) and DATE_FORMAT(CONVERT_TZ(receipt_date,'+00:00','+06:30'),'%Y-%m-%d') between '#{from}' and '#{to}'"+ + " and DATE_FORMAT(CONVERT_TZ(receipt_date,'+00:00','+06:30'),'%H:%M') between '#{from_time}' and '#{to_time}' and sale_status= 'completed'") + else + query = query.where("(i.qty > 0 and i.price > 0) and DATE_FORMAT(CONVERT_TZ(receipt_date,'+00:00','+06:30'),'%Y-%m-%d') between '#{from}' and '#{to}'"+ + " and sale_status= 'completed'") + end + query = query.group('mi.name') + .order("SUM(i.qty) ASC").limit(20) + else + shift = ShiftSale.current_open_shift(current_user.id) + if !shift.nil? + query = Sale.select("(SUM(i.qty) * i.price) as grand_total,SUM(i.qty) as total_item," + + " i.price as unit_price,mi.name as product_name") + .joins("JOIN sale_items i ON i.sale_id = sales.sale_id JOIN menu_items mi ON i.product_code = mi.item_code") + if !from_time.nil? && !to_time.nil? + query = query.where("(i.qty > 0 and i.price > 0) and DATE_FORMAT(CONVERT_TZ(receipt_date,'+00:00','+06:30'),'%Y-%m-%d') between '#{from}' and '#{to}'"+ + " and DATE_FORMAT(CONVERT_TZ(receipt_date,'+00:00','+06:30'),'%H:%M') between '#{from_time}' and '#{to_time}' and sale_status= 'completed' and shift_sale_id='#{shift.id}'") + else + query = query.where("(i.qty > 0 and i.price > 0) and DATE_FORMAT(CONVERT_TZ(receipt_date,'+00:00','+06:30') between '#{from}' and '#{to}'"+ + " and sale_status= 'completed' and shift_sale_id='#{shift.id}'") + end + query = query.group('mi.name') + .order("SUM(i.qty) ASC").limit(20) + end + end + end else - query = Sale.select("(SUM(i.qty) * i.price) as grand_total,SUM(i.qty) as total_item," + + if current_user.nil? + query = Sale.select("(SUM(i.qty) * i.price) as grand_total,SUM(i.qty) as total_item," + " i.price as unit_price,mi.name as product_name") .joins("JOIN sale_items i ON i.sale_id = sales.sale_id JOIN menu_items mi ON i.product_code = mi.item_code") .where("(i.qty > 0 and i.price > 0) and DATE_FORMAT(receipt_date,'%Y-%m-%d') = '#{today}'"+ "and sale_status= 'completed'") .group('mi.name') .order("SUM(i.qty) ASC").limit(20) + else + if current_user.role == 'administrator' || current_user.role == 'manager' + query = Sale.select("(SUM(i.qty) * i.price) as grand_total,SUM(i.qty) as total_item," + + " i.price as unit_price,mi.name as product_name") + .joins("JOIN sale_items i ON i.sale_id = sales.sale_id JOIN menu_items mi ON i.product_code = mi.item_code") + .where("(i.qty > 0 and i.price > 0) and DATE_FORMAT(receipt_date,'%Y-%m-%d') = '#{today}'"+ + "and sale_status= 'completed'") + .group('mi.name') + .order("SUM(i.qty) ASC").limit(20) + else + shift = ShiftSale.current_open_shift(current_user.id) + if !shift.nil? + query = Sale.select("(SUM(i.qty) * i.price) as grand_total,SUM(i.qty) as total_item," + + " i.price as unit_price,mi.name as product_name") + .joins("JOIN sale_items i ON i.sale_id = sales.sale_id JOIN menu_items mi ON i.product_code = mi.item_code") + .where("(i.qty > 0 and i.price > 0) and DATE_FORMAT(receipt_date,'%Y-%m-%d') = '#{today}'"+ + " and sale_status= 'completed' and shift_sale_id=#{shift.id}") + .group('mi.name') + .order("SUM(i.qty) ASC").limit(20) + end + end + end end end - def self.hourly_sales(today,from,to) + def self.hourly_sales(today,current_user,from,to,from_time,to_time) if !from.nil? && !to.nil? - query= Sale.select("grand_total") - .where('sale_status = "completed" and receipt_date between ? and ?',from,to) - .group("date_format(CONVERT_TZ(receipt_date,'+00:00', 'SYSTEM'), '%I %p')") - .order('receipt_date') + if current_user.nil? + query = Sale.select("grand_total") + if !from_time.nil? && !to_time.nil? + query = query.where('sale_status = "completed" and DATE_FORMAT(CONVERT_TZ(receipt_date,"+00:00","+06:30"),"%Y-%m-%d") between ? and ? and DATE_FORMAT(CONVERT_TZ(receipt_date,"+00:00","+06:30"),"%H:%M") between ? and ?',from,to,from_time,to_time) + else + query = query.where('sale_status = "completed" and DATE_FORMAT(CONVERT_TZ(receipt_date,"+00:00","+06:30"),"%Y-%m-%d") between ? and ?',from,to) + end + query = query.group("date_format(CONVERT_TZ(receipt_date,'+00:00', 'SYSTEM'), '%I %p')") + .order('receipt_date') + else + if current_user.role == 'administrator' || current_user.role == 'manager' + query = Sale.select("grand_total") + if !from_time.nil? && !to_time.nil? + query = query.where('sale_status = "completed" and DATE_FORMAT(CONVERT_TZ(receipt_date,"+00:00","+06:30"),"%Y-%m-%d") between ? and ? and DATE_FORMAT(CONVERT_TZ(receipt_date,"+00:00","+06:30"),"%H:%M") between ? and ?',from,to,from_time,to_time) + else + query = query.where('sale_status = "completed" and DATE_FORMAT(CONVERT_TZ(receipt_date,"+00:00","+06:30"),"%Y-%m-%d") between ? and ?',from,to) + end + query = query.group("date_format(CONVERT_TZ(receipt_date,'+00:00', 'SYSTEM'), '%I %p')") + .order('receipt_date') + else + shift = ShiftSale.current_open_shift(current_user.id) + if !shift.nil? + query = Sale.select("grand_total") + if !from_time.nil? && !to_time.nil? + query = query.where('sale_status = "completed" and DATE_FORMAT(CONVERT_TZ(receipt_date,"+00:00","+06:30"),"%Y-%m-%d") between ? and ? and DATE_FORMAT(CONVERT_TZ(receipt_date,"+00:00","+06:30"),"%H:%M") between ? and ? and shift_sale_id=?',from,to,from_time,to_time,shift.id) + else + query = query.where('sale_status = "completed" and DATE_FORMAT(CONVERT_TZ(receipt_date,"+00:00","+06:30"),"%Y-%m-%d") between ? and ? and shift_sale_id=?',from,to,shift.id) + end + query = query.group("date_format(CONVERT_TZ(receipt_date,'+00:00', 'SYSTEM'), '%I %p')") + .order('receipt_date') + end + end + end else - query= Sale.select("grand_total") + if current_user.nil? + query = Sale.select("grand_total") .where('sale_status = "completed" and DATE_FORMAT(receipt_date,"%Y-%m-%d") = ?',today) .group("date_format(CONVERT_TZ(receipt_date,'+00:00', 'SYSTEM'), '%I %p')") .order('receipt_date') + else + if current_user.role == 'administrator' || current_user.role == 'manager' + query = Sale.select("grand_total") + .where('sale_status = "completed" and DATE_FORMAT(receipt_date,"%Y-%m-%d") = ?',today) + .group("date_format(CONVERT_TZ(receipt_date,'+00:00', 'SYSTEM'), '%I %p')") + .order('receipt_date') + else + shift = ShiftSale.current_open_shift(current_user.id) + if !shift.nil? + query = Sale.select("grand_total") + .where('sale_status = "completed" and DATE_FORMAT(receipt_date,"%Y-%m-%d") = ? and shift_sale_id=?',today,shift.id) + .group("date_format(CONVERT_TZ(receipt_date,'+00:00', 'SYSTEM'), '%I %p')") + .order('receipt_date') + end + end + end end end - def self.employee_sales(today,from,to) + def self.employee_sales(today,current_user,from,to,from_time,to_time) if !from.nil? && !to.nil? - query = Sale.joins("JOIN employees as e on e.id=sales.cashier_id") + if current_user.nil? + query = Sale.joins("JOIN employees as e on e.id=sales.cashier_id") + .joins("JOIN sale_payments as sp on sp.sale_id=sales.sale_id") + if !from_time.nil? && !to_time.nil? + query = query.where("sales.payment_status='paid' and sales.sale_status = 'completed' and DATE_FORMAT(CONVERT_TZ(sales.receipt_date,'+00:00','+06:30'),'%Y-%m-%d') between '#{from}' and '#{to}' and DATE_FORMAT(CONVERT_TZ(sales.receipt_date,'+00:00','+06:30'),'%H:%M') between '#{from_time}' and '#{to_time}'") + else + query = query.where("sales.payment_status='paid' and sales.sale_status = 'completed' and DATE_FORMAT(CONVERT_TZ(sales.receipt_date,'+00:00','+06:30'),'%Y-%m-%d') between '#{from}' and '#{to}'") + end + query = query.group("(CASE WHEN (sp.payment_method='mpu' or sp.payment_method='visa' or sp.payment_method='master' or sp.payment_method='jcb' or sp.payment_method='unionpay') THEN 'card' ELSE sp.payment_method END)","e.name") + .order("e.name") + else + if current_user.role == 'administrator' || current_user.role == 'manager' + query = Sale.joins("JOIN employees as e on e.id=sales.cashier_id") .joins("JOIN sale_payments as sp on sp.sale_id=sales.sale_id") - .where("sales.payment_status='paid' and sales.sale_status = 'completed' and sales.receipt_date between '#{from}' and '#{to}'") - .group("(CASE WHEN (sp.payment_method='mpu' or sp.payment_method='visa' or sp.payment_method='master' or sp.payment_method='jcb' or sp.payment_method='unionpay') THEN 'card' ELSE sp.payment_method END)","e.name") - .order("e.name") + if !from_time.nil? && !to_time.nil? + query = query.where("sales.payment_status='paid' and sales.sale_status = 'completed' and DATE_FORMAT(CONVERT_TZ(sales.receipt_date,'+00:00','+06:30'),'%Y-%m-%d') between '#{from}' and '#{to}' and DATE_FORMAT(CONVERT_TZ(sales.receipt_date,'+00:00','+06:30'),'%H:%M') between '#{from_time}' and '#{to_time}'") + else + query = query.where("sales.payment_status='paid' and sales.sale_status = 'completed' and DATE_FORMAT(CONVERT_TZ(sales.receipt_date,'+00:00','+06:30'),'%Y-%m-%d') between '#{from}' and '#{to}'") + end + query = query.group("(CASE WHEN (sp.payment_method='mpu' or sp.payment_method='visa' or sp.payment_method='master' or sp.payment_method='jcb' or sp.payment_method='unionpay') THEN 'card' ELSE sp.payment_method END)","e.name") + .order("e.name") + else + shift = ShiftSale.current_open_shift(current_user.id) + if !shift.nil? + query = Sale.joins("JOIN employees as e on e.id=sales.cashier_id") + .joins("JOIN sale_payments as sp on sp.sale_id=sales.sale_id") + if !from_time.nil? && !to_time.nil? + query = query.where("sales.payment_status='paid' and sales.sale_status = 'completed' and DATE_FORMAT(CONVERT_TZ(sales.receipt_date,'+00:00','+06:30'),'%Y-%m-%d') between '#{from}' and '#{to}' and DATE_FORMAT(CONVERT_TZ(sales.receipt_date,'+00:00','+06:30'),'%H:%M') between '#{from_time}' and '#{to_time}' and shift_sale_id='#{shift.id}'") + else + query = query.where("sales.payment_status='paid' and sales.sale_status = 'completed' and DATE_FORMAT(CONVERT_TZ(sales.receipt_date,'+00:00','+06:30'),'%Y-%m-%d') between '#{from}' and '#{to}' and shift_sale_id='#{shift.id}'") + end + query = query.group("(CASE WHEN (sp.payment_method='mpu' or sp.payment_method='visa' or sp.payment_method='master' or sp.payment_method='jcb' or sp.payment_method='unionpay') THEN 'card' ELSE sp.payment_method END)","e.name") + .order("e.name") + end + end + end else - query = Sale.joins("JOIN employees as e on e.id=sales.cashier_id") + if current_user.nil? + query = Sale.joins("JOIN employees as e on e.id=sales.cashier_id") .joins("JOIN sale_payments as sp on sp.sale_id=sales.sale_id") .where("sales.payment_status='paid' and sales.sale_status = 'completed' and DATE_FORMAT(sales.receipt_date,'%Y-%m-%d') = '#{today}'") .group("(CASE WHEN (sp.payment_method='mpu' or sp.payment_method='visa' or sp.payment_method='master' or sp.payment_method='jcb' or sp.payment_method='unionpay') THEN 'card' ELSE sp.payment_method END)","e.name") .order("e.name") - end - end - - def self.total_sale(today,current_user=nil,from=nil,to=nil) - if !from.nil? && !to.nil? - if current_user.nil? - total = Sale.where('sale_status = "completed" and receipt_date between ? and ?',from,to).sum("grand_total") else if current_user.role == 'administrator' || current_user.role == 'manager' - total = Sale.where('sale_status = "completed" and receipt_date between ? and ?',from,to).sum("grand_total") + query = Sale.joins("JOIN employees as e on e.id=sales.cashier_id") + .joins("JOIN sale_payments as sp on sp.sale_id=sales.sale_id") + .where("sales.payment_status='paid' and sales.sale_status = 'completed' and DATE_FORMAT(sales.receipt_date,'%Y-%m-%d') = '#{today}'") + .group("(CASE WHEN (sp.payment_method='mpu' or sp.payment_method='visa' or sp.payment_method='master' or sp.payment_method='jcb' or sp.payment_method='unionpay') THEN 'card' ELSE sp.payment_method END)","e.name") + .order("e.name") else shift = ShiftSale.current_open_shift(current_user.id) if !shift.nil? - total = Sale.where('sale_status = "completed" and sales.receipt_date between ? and ? and shift_sale_id=?',from,to,shift.id) + query = Sale.joins("JOIN employees as e on e.id=sales.cashier_id") + .joins("JOIN sale_payments as sp on sp.sale_id=sales.sale_id") + .where("sales.payment_status='paid' and sales.sale_status = 'completed' and DATE_FORMAT(sales.receipt_date,'%Y-%m-%d') = '#{today}' and shift_sale_id='#{shift.id}'") + .group("(CASE WHEN (sp.payment_method='mpu' or sp.payment_method='visa' or sp.payment_method='master' or sp.payment_method='jcb' or sp.payment_method='unionpay') THEN 'card' ELSE sp.payment_method END)","e.name") + .order("e.name") + end + end + end + end + end + + def self.total_sale(today,current_user=nil,from=nil,to=nil,from_time=nil,to_time=nil) + if !from.nil? && !to.nil? + if current_user.nil? + if !from_time.nil? && !to_time.nil? + total = Sale.where('sale_status = "completed" and DATE_FORMAT(CONVERT_TZ(receipt_date,"+00:00","+06:30"),"%Y-%m-%d") between ? and ? and DATE_FORMAT(CONVERT_TZ(receipt_date,"+00:00","+06:30"),"%H:%M") between ? and ?',from,to,from_time,to_time).sum("grand_total") + else + total = Sale.where('sale_status = "completed" and DATE_FORMAT(CONVERT_TZ(receipt_date,"+00:00","+06:30"),"%Y-%m-%d") between ? and ?',from,to).sum("grand_total") + end + else + if current_user.role == 'administrator' || current_user.role == 'manager' + if !from_time.nil? && !to_time.nil? + total = Sale.where('sale_status = "completed" and DATE_FORMAT(CONVERT_TZ(receipt_date,"+00:00","+06:30"),"%Y-%m-%d") between ? and ? and DATE_FORMAT(CONVERT_TZ(receipt_date,"+00:00","+06:30"),"%H:%M") between ? and ?',from,to,from_time,to_time).sum("grand_total") + else + total = Sale.where('sale_status = "completed" and DATE_FORMAT(CONVERT_TZ(receipt_date,"+00:00","+06:30"),"%Y-%m-%d") between ? and ?',from,to).sum("grand_total") + end + else + shift = ShiftSale.current_open_shift(current_user.id) + if !shift.nil? + if !from_time.nil? && !to_time.nil? + total = Sale.where('sale_status = "completed" and DATE_FORMAT(CONVERT_TZ(receipt_date,"+00:00","+06:30"),"%Y-%m-%d") between ? and ? and DATE_FORMAT(CONVERT_TZ(receipt_date,"+00:00","+06:30"),"%H:%M") between ? and ? and shift_sale_id=?',from,to,from_time,to_time,shift.id) .sum("grand_total") + else + total = Sale.where('sale_status = "completed" and DATE_FORMAT(CONVERT_TZ(receipt_date,"+00:00","+06:30"),"%Y-%m-%d") between ? and ? and shift_sale_id=?',from,to,shift.id) + .sum("grand_total") + end end end end @@ -1236,17 +1475,29 @@ end end end - def self.total_count(today,current_user=nil,from=nil,to=nil) + def self.total_count(today,current_user=nil,from=nil,to=nil,from_time=nil,to_time=nil) if !from.nil? && !to.nil? if current_user.nil? - total = Sale.where('sale_status = "completed" and receipt_date between ? and ?',from,to).count + if !from_time.nil? && !to_time.nil? + total = Sale.where('sale_status = "completed" and DATE_FORMAT(CONVERT_TZ(receipt_date, "+00:00", "+06:30"),"%Y-%m-%d") between ? and ? and DATE_FORMAT(CONVERT_TZ(receipt_date, "+00:00", "+06:30"),"%H:%M") between ? and ?',from,to,from_time,to_time).count + else + total = Sale.where('sale_status = "completed" and DATE_FORMAT(CONVERT_TZ(receipt_date, "+00:00", "+06:30"),"%Y-%m-%d") between ? and ?',from,to).count + end else if current_user.role == 'administrator' || current_user.role == 'manager' - total = Sale.where('sale_status = "completed" and receipt_date between ? and ?',from,to).count + if !from_time.nil? && !to_time.nil? + total = Sale.where('sale_status = "completed" and DATE_FORMAT(CONVERT_TZ(receipt_date, "+00:00", "+06:30"),"%Y-%m-%d") between ? and ? and DATE_FORMAT(CONVERT_TZ(receipt_date, "+00:00", "+06:30"),"%H:%M") between ? and ?',from,to,from_time,to_time).count + else + total = Sale.where('sale_status = "completed" and DATE_FORMAT(CONVERT_TZ(receipt_date, "+00:00", "+06:30"),"%Y-%m-%d") between ? and ?',from,to).count + end else shift = ShiftSale.current_open_shift(current_user.id) if !shift.nil? - total = Sale.where('sale_status = "completed" and receipt_date between ? and ? and shift_sale_id = ?',from,to,shift.id).count + if !from_time.nil? && !to_time.nil? + total = Sale.where('sale_status = "completed" and DATE_FORMAT(CONVERT_TZ(receipt_date, "+00:00", "+06:30"),"%Y-%m-%d") between ? and ? and DATE_FORMAT(CONVERT_TZ(receipt_date, "+00:00", "+06:30"),"%H:%M") between ? and ? and shift_sale_id = ?',from,to,from_time,to_time,shift.id).count + else + total = Sale.where('sale_status = "completed" and DATE_FORMAT(CONVERT_TZ(receipt_date, "+00:00", "+06:30"),"%Y-%m-%d") between ? and ? and shift_sale_id = ?',from,to,shift.id).count + end end end end @@ -1266,23 +1517,41 @@ end end end - def self.total_card_sale(today,current_user=nil,from=nil,to=nil) + def self.total_card_sale(today,current_user=nil,from=nil,to=nil,from_time=nil,to_time=nil) if !from.nil? && !to.nil? if current_user.nil? - query = Sale.where('sales.sale_status = "completed" and sales.receipt_date between ? and ? and (sp.payment_method = "mpu" or sp.payment_method = "visa" or sp.payment_method = "master" or sp.payment_method = "jcb" or sp.payment_method = "unionpay")',from,to) - .joins("JOIN sale_payments sp ON sp.sale_id = sales.sale_id") - .sum("sp.payment_amount") - else - if current_user.role == 'administrator' || current_user.role == 'manager' - query = Sale.where('sales.sale_status = "completed" and sales.receipt_date between ? and ? and (sp.payment_method = "mpu" or sp.payment_method = "visa" or sp.payment_method = "master" or sp.payment_method = "jcb" or sp.payment_method = "unionpay")',from,to) + if !from_time.nil? && !to_time.nil? + query = Sale.where('sales.sale_status = "completed" and DATE_FORMAT(CONVERT_TZ(sales.receipt_date,"+00:00","+06:30"),"%Y-%m-%d") between ? and ? and DATE_FORMAT(CONVERT_TZ(sales.receipt_date,"+00:00","+06:30"),"%H:%M") between ? and ? and (sp.payment_method = "mpu" or sp.payment_method = "visa" or sp.payment_method = "master" or sp.payment_method = "jcb" or sp.payment_method = "unionpay")',from,to,from_time,to_time) .joins("JOIN sale_payments sp ON sp.sale_id = sales.sale_id") .sum("sp.payment_amount") else - shift = ShiftSale.current_open_shift(current_user.id) - if !shift.nil? - query = Sale.where('sales.sale_status = "completed" and sales.receipt_date between ? and ? and (sp.payment_method = "mpu" or sp.payment_method = "visa" or sp.payment_method = "master" or sp.payment_method = "jcb" or sp.payment_method = "unionpay") and shift_sale_id=?',from,to,shift.id) + query = Sale.where('sales.sale_status = "completed" and DATE_FORMAT(CONVERT_TZ(sales.receipt_date,"+00:00","+06:30"),"%Y-%m-%d") between ? and ? and (sp.payment_method = "mpu" or sp.payment_method = "visa" or sp.payment_method = "master" or sp.payment_method = "jcb" or sp.payment_method = "unionpay")',from,to) .joins("JOIN sale_payments sp ON sp.sale_id = sales.sale_id") .sum("sp.payment_amount") + end + else + if current_user.role == 'administrator' || current_user.role == 'manager' + if !from_time.nil? && !to_time.nil? + query = Sale.where('sales.sale_status = "completed" and DATE_FORMAT(CONVERT_TZ(sales.receipt_date,"+00:00","+06:30"),"%Y-%m-%d") between ? and ? and DATE_FORMAT(CONVERT_TZ(sales.receipt_date,"+00:00","+06:30"),"%H:%M") between ? and ? and (sp.payment_method = "mpu" or sp.payment_method = "visa" or sp.payment_method = "master" or sp.payment_method = "jcb" or sp.payment_method = "unionpay")',from,to,from_time,to_time) + .joins("JOIN sale_payments sp ON sp.sale_id = sales.sale_id") + .sum("sp.payment_amount") + else + query = Sale.where('sales.sale_status = "completed" and DATE_FORMAT(CONVERT_TZ(sales.receipt_date,"+00:00","+06:30"),"%Y-%m-%d") between ? and ? and (sp.payment_method = "mpu" or sp.payment_method = "visa" or sp.payment_method = "master" or sp.payment_method = "jcb" or sp.payment_method = "unionpay")',from,to) + .joins("JOIN sale_payments sp ON sp.sale_id = sales.sale_id") + .sum("sp.payment_amount") + end + else + shift = ShiftSale.current_open_shift(current_user.id) + if !shift.nil? + if !from_time.nil? && !to_time.nil? + query = Sale.where('sales.sale_status = "completed" and DATE_FORMAT(CONVERT_TZ(sales.receipt_date,"+00:00","+06:30"),"%Y-%m-%d") between ? and ? and DATE_FORMAT(CONVERT_TZ(sales.receipt_date,"+00:00","+06:30"),"%H:%M") between ? and ? and (sp.payment_method = "mpu" or sp.payment_method = "visa" or sp.payment_method = "master" or sp.payment_method = "jcb" or sp.payment_method = "unionpay") and shift_sale_id=?',from,to,from_time,to_time,shift.id) + .joins("JOIN sale_payments sp ON sp.sale_id = sales.sale_id") + .sum("sp.payment_amount") + else + query = Sale.where('sales.sale_status = "completed" and DATE_FORMAT(CONVERT_TZ(sales.receipt_date,"+00:00","+06:30"),"%Y-%m-%d") between ? and ? and (sp.payment_method = "mpu" or sp.payment_method = "visa" or sp.payment_method = "master" or sp.payment_method = "jcb" or sp.payment_method = "unionpay") and shift_sale_id=?',from,to,shift.id) + .joins("JOIN sale_payments sp ON sp.sale_id = sales.sale_id") + .sum("sp.payment_amount") + end end end end @@ -1308,23 +1577,41 @@ end end end - def self.credit_payment(today,current_user=nil,from=nil,to=nil) + def self.credit_payment(today,current_user=nil,from=nil,to=nil,from_time=nil,to_time=nil) if !from.nil? && !to.nil? if current_user.nil? - query = SalePayment.where('s.sale_status = "completed" and payment_method="creditnote" and s.receipt_date between ? and ?',from,to) - .joins("INNER JOIN sales s ON s.sale_id = sale_payments.sale_id") - .sum("payment_amount") - else - if current_user.role == 'administrator' || current_user.role == 'manager' - query = SalePayment.where('s.sale_status = "completed" and payment_method="creditnote" and s.receipt_date between ? and ?',from,to) + if !from_time.nil? && !to_time.nil? + query = SalePayment.where('s.sale_status = "completed" and payment_method="creditnote" and DATE_FORMAT(CONVERT_TZ(s.receipt_date,"+00:00","+06:30"),"%Y-%m-%d") between ? and ? and DATE_FORMAT(CONVERT_TZ(s.receipt_date,"+00:00","+06:30"),"%H:%M") between ? and ?',from,to,from_time,to_time) .joins("INNER JOIN sales s ON s.sale_id = sale_payments.sale_id") .sum("payment_amount") else - shift = ShiftSale.current_open_shift(current_user.id) - if !shift.nil? - query = SalePayment.where('s.sale_status = "completed" and payment_method="creditnote" and s.receipt_date between ? and ? and s.shift_sale_id=?',from,to,shift.id) + query = SalePayment.where('s.sale_status = "completed" and payment_method="creditnote" and DATE_FORMAT(CONVERT_TZ(s.receipt_date,"+00:00","+06:30"),"%Y-%m-%d") between ? and ?',from,to) .joins("INNER JOIN sales s ON s.sale_id = sale_payments.sale_id") .sum("payment_amount") + end + else + if current_user.role == 'administrator' || current_user.role == 'manager' + if !from_time.nil? && !to_time.nil? + query = SalePayment.where('s.sale_status = "completed" and payment_method="creditnote" and DATE_FORMAT(CONVERT_TZ(s.receipt_date,"+00:00","+06:30"),"%Y-%m-%d") between ? and ? and DATE_FORMAT(CONVERT_TZ(s.receipt_date,"+00:00","+06:30"),"%H:%M") between ? and ?',from,to,from_time,to_time) + .joins("INNER JOIN sales s ON s.sale_id = sale_payments.sale_id") + .sum("payment_amount") + else + query = SalePayment.where('s.sale_status = "completed" and payment_method="creditnote" and DATE_FORMAT(CONVERT_TZ(s.receipt_date,"+00:00","+06:30"),"%Y-%m-%d") between ? and ?',from,to) + .joins("INNER JOIN sales s ON s.sale_id = sale_payments.sale_id") + .sum("payment_amount") + end + else + shift = ShiftSale.current_open_shift(current_user.id) + if !shift.nil? + if !from_time.nil? && !to_time.nil? + query = SalePayment.where('s.sale_status = "completed" and payment_method="creditnote" and DATE_FORMAT(CONVERT_TZ(s.receipt_date,"+00:00","+06:30"),"%Y-%m-%d") between ? and ? and DATE_FORMAT(CONVERT_TZ(s.receipt_date,"+00:00","+06:30"),"%H:%M") between ? and ? and s.shift_sale_id=?',from,to,from_time,to_time,shift.id) + .joins("INNER JOIN sales s ON s.sale_id = sale_payments.sale_id") + .sum("payment_amount") + else + query = SalePayment.where('s.sale_status = "completed" and payment_method="creditnote" and DATE_FORMAT(CONVERT_TZ(s.receipt_date,"+00:00","+06:30"),"%Y-%m-%d") between ? and ? and s.shift_sale_id=?',from,to,shift.id) + .joins("INNER JOIN sales s ON s.sale_id = sale_payments.sale_id") + .sum("payment_amount") + end end end end @@ -1350,23 +1637,41 @@ end end end - def self.summary_sale_receipt(today,current_user=nil,from=nil,to=nil) + def self.summary_sale_receipt(today,current_user=nil,from=nil,to=nil,from_time=nil,to_time=nil) if !from.nil? && !to.nil? if current_user.nil? - query = Sale.select('count(sale_id) as total_receipt, (case when sum(total_amount) > 0 then sum(total_amount) else 0.0 end) as total_amount, (case when sum(grand_total) > 0 then sum(grand_total) else 0.0 end) as grand_total, (case when sum(total_discount) > 0 then sum(total_discount) else 0.0 end) as total_discount, (case when sum(total_tax) > 0 then sum(total_tax) else 0.0 end) as total_tax') - .where('sale_status = "completed" and receipt_date between ? and ?',from,to) + if !from_time.nil? && !to_time.nil? + query = Sale.select('count(sale_id) as total_receipt, (case when sum(total_amount) > 0 then sum(total_amount) else 0.0 end) as total_amount, (case when sum(grand_total) > 0 then sum(grand_total) else 0.0 end) as grand_total, (case when sum(total_discount) > 0 then sum(total_discount) else 0.0 end) as total_discount, (case when sum(total_tax) > 0 then sum(total_tax) else 0.0 end) as total_tax') + .where('sale_status = "completed" and DATE_FORMAT(CONVERT_TZ(receipt_date,"+00:00","+06:30"),"%Y-%m-%d") between ? and ? and DATE_FORMAT(CONVERT_TZ(receipt_date,"+00:00","+06:30"),"%H:%M") between ? and ?',from,to,from_time,to_time) .first() + else + query = Sale.select('count(sale_id) as total_receipt, (case when sum(total_amount) > 0 then sum(total_amount) else 0.0 end) as total_amount, (case when sum(grand_total) > 0 then sum(grand_total) else 0.0 end) as grand_total, (case when sum(total_discount) > 0 then sum(total_discount) else 0.0 end) as total_discount, (case when sum(total_tax) > 0 then sum(total_tax) else 0.0 end) as total_tax') + .where('sale_status = "completed" and DATE_FORMAT(CONVERT_TZ(receipt_date,"+00:00","+06:30"),"%Y-%m-%d") between ? and ?',from,to) + .first() + end else if current_user.role == 'administrator' || current_user.role == 'manager' - query = Sale.select('count(sale_id) as total_receipt, (case when sum(total_amount) > 0 then sum(total_amount) else 0.0 end) as total_amount, (case when sum(grand_total) > 0 then sum(grand_total) else 0.0 end) as grand_total, (case when sum(total_discount) > 0 then sum(total_discount) else 0.0 end) as total_discount, (case when sum(total_tax) > 0 then sum(total_tax) else 0.0 end) as total_tax') - .where('sale_status = "completed" and receipt_date between ? and ?',from,to) - .first() + if !from_time.nil? && !to_time.nil? + query = Sale.select('count(sale_id) as total_receipt, (case when sum(total_amount) > 0 then sum(total_amount) else 0.0 end) as total_amount, (case when sum(grand_total) > 0 then sum(grand_total) else 0.0 end) as grand_total, (case when sum(total_discount) > 0 then sum(total_discount) else 0.0 end) as total_discount, (case when sum(total_tax) > 0 then sum(total_tax) else 0.0 end) as total_tax') + .where('sale_status = "completed" and DATE_FORMAT(CONVERT_TZ(receipt_date,"+00:00","+06:30"),"%Y-%m-%d") between ? and ? and DATE_FORMAT(CONVERT_TZ(receipt_date,"+00:00","+06:30"),"%H:%M") between ? and ?',from,to,from_time,to_time) + .first() + else + query = Sale.select('count(sale_id) as total_receipt, (case when sum(total_amount) > 0 then sum(total_amount) else 0.0 end) as total_amount, (case when sum(grand_total) > 0 then sum(grand_total) else 0.0 end) as grand_total, (case when sum(total_discount) > 0 then sum(total_discount) else 0.0 end) as total_discount, (case when sum(total_tax) > 0 then sum(total_tax) else 0.0 end) as total_tax') + .where('sale_status = "completed" and DATE_FORMAT(CONVERT_TZ(receipt_date,"+00:00","+06:30"),"%Y-%m-%d") between ? and ?',from,to) + .first() + end else shift = ShiftSale.current_open_shift(current_user.id) if !shift.nil? - query = Sale.select('count(sale_id) as total_receipt, (case when sum(total_amount) > 0 then sum(total_amount) else 0.0 end) as total_amount, (case when sum(grand_total) > 0 then sum(grand_total) else 0.0 end) as grand_total, (case when sum(total_discount) > 0 then sum(total_discount) else 0.0 end) as total_discount, (case when sum(total_tax) > 0 then sum(total_tax) else 0.0 end) as total_tax') - .where('sale_status = "completed" and receipt_date between ? and ? and shift_sale_id=?',from,to,shift.id) - .first() + if !from_time.nil? && !to_time.nil? + query = Sale.select('count(sale_id) as total_receipt, (case when sum(total_amount) > 0 then sum(total_amount) else 0.0 end) as total_amount, (case when sum(grand_total) > 0 then sum(grand_total) else 0.0 end) as grand_total, (case when sum(total_discount) > 0 then sum(total_discount) else 0.0 end) as total_discount, (case when sum(total_tax) > 0 then sum(total_tax) else 0.0 end) as total_tax') + .where('sale_status = "completed" and DATE_FORMAT(CONVERT_TZ(receipt_date,"+00:00","+06:30"),"%Y-%m-%d") between ? and ? and DATE_FORMAT(CONVERT_TZ(receipt_date,"+00:00","+06:30"),"%H:%M") between ? and ? and shift_sale_id=?',from,to,from_time,to_time,shift.id) + .first() + else + query = Sale.select('count(sale_id) as total_receipt, (case when sum(total_amount) > 0 then sum(total_amount) else 0.0 end) as total_amount, (case when sum(grand_total) > 0 then sum(grand_total) else 0.0 end) as grand_total, (case when sum(total_discount) > 0 then sum(total_discount) else 0.0 end) as total_discount, (case when sum(total_tax) > 0 then sum(total_tax) else 0.0 end) as total_tax') + .where('sale_status = "completed" and DATE_FORMAT(CONVERT_TZ(receipt_date,"+00:00","+06:30"),"%Y-%m-%d") between ? and ? and shift_sale_id=?',from,to,shift.id) + .first() + end end end end @@ -1392,23 +1697,41 @@ end end end - def self.total_payment_methods(today,current_user=nil,from=nil,to=nil) + def self.total_payment_methods(today,current_user=nil,from=nil,to=nil,from_time=nil,to_time=nil) if !from.nil? && !to.nil? if current_user.nil? - query = Sale.select("distinct sp.payment_method") - .where('sales.sale_status = "completed" and sales.receipt_date between ? and ?',from,to) + if !from_time.nil? && !to_time.nil? + query = Sale.select("distinct sp.payment_method") + .where('sales.sale_status = "completed" and DATE_FORMAT(CONVERT_TZ(sales.receipt_date, "+00:00", "+06:30"),"%Y-%m-%d") between ? and ? and DATE_FORMAT(CONVERT_TZ(sales.receipt_date, "+00:00", "+06:30"),"%H:%M") between ? and ?',from,to,from_time,to_time) .joins("JOIN sale_payments as sp ON sp.sale_id = sales.sale_id") + else + query = Sale.select("distinct sp.payment_method") + .where('sales.sale_status = "completed" and DATE_FORMAT(CONVERT_TZ(sales.receipt_date, "+00:00", "+06:30"),"%Y-%m-%d") between ? and ?',from,to) + .joins("JOIN sale_payments as sp ON sp.sale_id = sales.sale_id") + end else if current_user.role == 'administrator' || current_user.role == 'manager' - query = Sale.select("distinct sp.payment_method") - .where('sales.sale_status = "completed" and sales.receipt_date between ? and ?',from,to) + if !from_time.nil? && !to_time.nil? + query = Sale.select("distinct sp.payment_method") + .where('sales.sale_status = "completed" and DATE_FORMAT(CONVERT_TZ(sales.receipt_date, "+00:00", "+06:30"),"%Y-%m-%d") between ? and ? and DATE_FORMAT(CONVERT_TZ(sales.receipt_date, "+00:00", "+06:30"),"%H:%M") between ? and ?',from,to,from_time,to_time) .joins("JOIN sale_payments as sp ON sp.sale_id = sales.sale_id") + else + query = Sale.select("distinct sp.payment_method") + .where('sales.sale_status = "completed" and DATE_FORMAT(CONVERT_TZ(sales.receipt_date, "+00:00", "+06:30"),"%Y-%m-%d") between ? and ?',from,to) + .joins("JOIN sale_payments as sp ON sp.sale_id = sales.sale_id") + end else shift = ShiftSale.current_open_shift(current_user.id) if !shift.nil? - query = Sale.select("distinct sp.payment_method") - .where('sales.sale_status = "completed" and sales.receipt_date between ? and ? and sales.shift_sale_id=?',from,to,shift.id) - .joins("JOIN sale_payments as sp ON sp.sale_id = sales.sale_id") + if !from_time.nil? && !to_time.nil? + query = Sale.select("distinct sp.payment_method") + .where('sales.sale_status = "completed" and DATE_FORMAT(CONVERT_TZ(sales.receipt_date, "+00:00", "+06:30"),"%Y-%m-%d") between ? and ? and DATE_FORMAT(CONVERT_TZ(sales.receipt_date, "+00:00", "+06:30"),"%H:%M") between ? and ? and sales.shift_sale_id=?',from,to,from_time,to_time,shift.id) + .joins("JOIN sale_payments as sp ON sp.sale_id = sales.sale_id") + else + query = Sale.select("distinct sp.payment_method") + .where('sales.sale_status = "completed" and DATE_FORMAT(CONVERT_TZ(sales.receipt_date, "+00:00", "+06:30"),"%Y-%m-%d") between ? and ? and sales.shift_sale_id=?',from,to,shift.id) + .joins("JOIN sale_payments as sp ON sp.sale_id = sales.sale_id") + end end end end @@ -1434,35 +1757,69 @@ end end end - def self.payment_sale(payment_method, today, current_user=nil,from=nil,to=nil) + def self.payment_sale(payment_method, today, current_user=nil,from=nil,to=nil,from_time=nil,to_time=nil) + time_query = '' + if !from_time.nil? && !to_time.nil? + time_query = " and DATE_FORMAT(CONVERT_TZ(sales.receipt_date, '+00:00', '+06:30'),'%H:%M') between '#{from_time}' and '#{to_time}'" + end if !from.nil? && !to.nil? if current_user.nil? - query = Sale.joins("JOIN sale_payments as sp ON sp.sale_id = sales.sale_id") - if payment_method == 'card' - query = query.where('sales.sale_status = "completed" and sales.receipt_date between ? and ? and (sp.payment_method = "mpu" or sp.payment_method = "visa" or sp.payment_method = "master" or sp.payment_method = "jcb" or sp.payment_method = "unionpay")',from,to) - else - query = query.where("sales.sale_status = 'completed' and sp.payment_method = '#{payment_method}' and sales.receipt_date between ? and ?",from,to) - end - query.select("(CASE WHEN sp.payment_method='cash' THEN (SUM(sp.payment_amount) - SUM(sales.amount_changed)) ELSE SUM(sp.payment_amount) END) as payment_amount").first() - else - if current_user.role == 'administrator' || current_user.role == 'manager' + if !from_time.nil? && !to_time.nil? query = Sale.joins("JOIN sale_payments as sp ON sp.sale_id = sales.sale_id") if payment_method == 'card' - query = query.where('sales.sale_status = "completed" and sales.receipt_date between ? and ? and (sp.payment_method = "mpu" or sp.payment_method = "visa" or sp.payment_method = "master" or sp.payment_method = "jcb" or sp.payment_method = "unionpay")',from,to) + query = query.where('sales.sale_status = "completed" and DATE_FORMAT(CONVERT_TZ(sales.receipt_date, "+00:00", "+06:30"),"%Y-%m-%d") between ? and ? and DATE_FORMAT(CONVERT_TZ(sales.receipt_date, "+00:00", "+06:30"),"%H:%M") between ? and ? and (sp.payment_method = "mpu" or sp.payment_method = "visa" or sp.payment_method = "master" or sp.payment_method = "jcb" or sp.payment_method = "unionpay")',from,to,from_time,to_time) else - query = query.where("sales.sale_status = 'completed' and sp.payment_method = '#{payment_method}' and sales.receipt_date between ? and ?",from,to) + query = query.where("sales.sale_status = 'completed' and sp.payment_method = '#{payment_method}' and DATE_FORMAT(CONVERT_TZ(sales.receipt_date, '+00:00', '+06:30'),'%Y-%m-%d') between ? and ? and and DATE_FORMAT(CONVERT_TZ(sales.receipt_date, '+00:00', '+06:30'),'%H:%M') between ? and ?",from,to,from_time,to_time) end query.select("(CASE WHEN sp.payment_method='cash' THEN (SUM(sp.payment_amount) - SUM(sales.amount_changed)) ELSE SUM(sp.payment_amount) END) as payment_amount").first() else - shift = ShiftSale.current_open_shift(current_user.id) - if !shift.nil? + query = Sale.joins("JOIN sale_payments as sp ON sp.sale_id = sales.sale_id") + if payment_method == 'card' + query = query.where('sales.sale_status = "completed" and DATE_FORMAT(CONVERT_TZ(sales.receipt_date, "+00:00", "+06:30"),"%Y-%m-%d") between ? and ? and (sp.payment_method = "mpu" or sp.payment_method = "visa" or sp.payment_method = "master" or sp.payment_method = "jcb" or sp.payment_method = "unionpay")',from,to) + else + query = query.where("sales.sale_status = 'completed' and sp.payment_method = '#{payment_method}' and DATE_FORMAT(CONVERT_TZ(sales.receipt_date, '+00:00', '+06:30'),'%Y-%m-%d') between ? and ?",from,to) + end + query.select("(CASE WHEN sp.payment_method='cash' THEN (SUM(sp.payment_amount) - SUM(sales.amount_changed)) ELSE SUM(sp.payment_amount) END) as payment_amount").first() + end + else + if current_user.role == 'administrator' || current_user.role == 'manager' + if !from_time.nil? && !to_time.nil? query = Sale.joins("JOIN sale_payments as sp ON sp.sale_id = sales.sale_id") if payment_method == 'card' - query = query.where('sales.sale_status = "completed" and sales.receipt_date between ? and ? and (sp.payment_method = "mpu" or sp.payment_method = "visa" or sp.payment_method = "master" or sp.payment_method = "jcb" or sp.payment_method = "unionpay") and sales.shift_sale_id=?',from,to,shift.id) + query = query.where('sales.sale_status = "completed" and DATE_FORMAT(CONVERT_TZ(sales.receipt_date, "+00:00", "+06:30"),"%Y-%m-%d") between ? and ? and DATE_FORMAT(CONVERT_TZ(sales.receipt_date, "+00:00", "+06:30"),"%H:%M") between ? and ? and (sp.payment_method = "mpu" or sp.payment_method = "visa" or sp.payment_method = "master" or sp.payment_method = "jcb" or sp.payment_method = "unionpay")',from,to,from_time,to_time) else - query = query.where("sales.sale_status = 'completed' and sp.payment_method = '#{payment_method}' and sales.receipt_date between ? and ? and sales.shift_sale_id=?",from,to,shift.id) + query = query.where("sales.sale_status = 'completed' and sp.payment_method = '#{payment_method}' and DATE_FORMAT(CONVERT_TZ(sales.receipt_date, '+00:00', '+06:30'),'%Y-%m-%d') between ? and ? and DATE_FORMAT(CONVERT_TZ(sales.receipt_date, '+00:00', '+06:30'),'%H:%M') between ? and ?",from,to,from_time,to_time) end query.select("(CASE WHEN sp.payment_method='cash' THEN (SUM(sp.payment_amount) - SUM(sales.amount_changed)) ELSE SUM(sp.payment_amount) END) as payment_amount").first() + else + query = Sale.joins("JOIN sale_payments as sp ON sp.sale_id = sales.sale_id") + if payment_method == 'card' + query = query.where('sales.sale_status = "completed" and DATE_FORMAT(CONVERT_TZ(sales.receipt_date, "+00:00", "+06:30"),"%Y-%m-%d") between ? and ? and (sp.payment_method = "mpu" or sp.payment_method = "visa" or sp.payment_method = "master" or sp.payment_method = "jcb" or sp.payment_method = "unionpay")',from,to) + else + query = query.where("sales.sale_status = 'completed' and sp.payment_method = '#{payment_method}' and DATE_FORMAT(CONVERT_TZ(sales.receipt_date, '+00:00', '+06:30'),'%Y-%m-%d') between ? and ?",from,to) + end + query.select("(CASE WHEN sp.payment_method='cash' THEN (SUM(sp.payment_amount) - SUM(sales.amount_changed)) ELSE SUM(sp.payment_amount) END) as payment_amount").first() + end + else + shift = ShiftSale.current_open_shift(current_user.id) + if !shift.nil? + if !from_time.nil? && !to_time.nil? + query = Sale.joins("JOIN sale_payments as sp ON sp.sale_id = sales.sale_id") + if payment_method == 'card' + query = query.where('sales.sale_status = "completed" and DATE_FORMAT(CONVERT_TZ(sales.receipt_date, "+00:00", "+06:30"),"%Y-%m-%d") between ? and ? and DATE_FORMAT(CONVERT_TZ(sales.receipt_date, "+00:00", "+06:30"),"%H:%M") between ? and ? and (sp.payment_method = "mpu" or sp.payment_method = "visa" or sp.payment_method = "master" or sp.payment_method = "jcb" or sp.payment_method = "unionpay") and sales.shift_sale_id=?',from,to,from_time,to_time,shift.id) + else + query = query.where("sales.sale_status = 'completed' and sp.payment_method = '#{payment_method}' and DATE_FORMAT(CONVERT_TZ(sales.receipt_date, '+00:00', '+06:30'),'%Y-%m-%d') between ? and ? and DATE_FORMAT(CONVERT_TZ(sales.receipt_date, '+00:00', '+06:30'),'%H:%M') between ? and ? and sales.shift_sale_id=?",from,to,from_time,to_time,shift.id) + end + query.select("(CASE WHEN sp.payment_method='cash' THEN (SUM(sp.payment_amount) - SUM(sales.amount_changed)) ELSE SUM(sp.payment_amount) END) as payment_amount").first() + else + query = Sale.joins("JOIN sale_payments as sp ON sp.sale_id = sales.sale_id") + if payment_method == 'card' + query = query.where('sales.sale_status = "completed" and DATE_FORMAT(CONVERT_TZ(sales.receipt_date, "+00:00", "+06:30"),"%Y-%m-%d") between ? and ? and (sp.payment_method = "mpu" or sp.payment_method = "visa" or sp.payment_method = "master" or sp.payment_method = "jcb" or sp.payment_method = "unionpay") and sales.shift_sale_id=?',from,to,shift.id) + else + query = query.where("sales.sale_status = 'completed' and sp.payment_method = '#{payment_method}' and DATE_FORMAT(CONVERT_TZ(sales.receipt_date, '+00:00', '+06:30'),'%Y-%m-%d') between ? and ? and sales.shift_sale_id=?",from,to,shift.id) + end + query.select("(CASE WHEN sp.payment_method='cash' THEN (SUM(sp.payment_amount) - SUM(sales.amount_changed)) ELSE SUM(sp.payment_amount) END) as payment_amount").first() + end end end end @@ -1500,10 +1857,10 @@ end end end - def self.total_customer(today,current_user=nil,from=nil,to=nil) - dinein_cnt = self.total_dinein(today,current_user,from,to) - takeaway_cnt = self.total_takeaway(today,current_user,from,to) - membership_cnt = self.total_membership(today,current_user,from,to) + def self.total_customer(today,current_user=nil,from=nil,to=nil,from_time=nil,to_time=nil) + dinein_cnt = self.total_dinein(today,current_user,from,to,from_time,to_time) + takeaway_cnt = self.total_takeaway(today,current_user,from,to,from_time,to_time) + membership_cnt = self.total_membership(today,current_user,from,to,from_time,to_time) total_cus = 0 if !dinein_cnt.nil? || !takeaway_cnt.nil? || !membership_cnt.nil? @@ -1513,26 +1870,47 @@ end return total_cus end - def self.total_dinein(today,current_user=nil,from=nil,to=nil) + def self.total_dinein(today,current_user=nil,from=nil,to=nil,from_time=nil,to_time=nil) if !from.nil? && !to.nil? if current_user.nil? - query = Sale.select("count(sales.customer_id) as total_dinein_cus") + if !from_time.nil? && !to_time.nil? + query = Sale.select("count(sales.customer_id) as total_dinein_cus") .joins("JOIN customers as c ON c.customer_id = sales.customer_id") - .where('sales.sale_status = "completed" and sales.receipt_date between ? and ? and c.customer_type = "Dinein" and c.membership_id is null',from,to) + .where('sales.sale_status = "completed" and DATE_FORMAT(CONVERT_TZ(sales.receipt_date,"+00:00","+06:30"),"%Y-%m-%d") between ? and ? and DATE_FORMAT(CONVERT_TZ(sales.receipt_date,"+00:00","+06:30"),"%H:%M") between ? and ? and c.customer_type = "Dinein" and c.membership_id is null',from,to,from_time,to_time) .first() + else + query = Sale.select("count(sales.customer_id) as total_dinein_cus") + .joins("JOIN customers as c ON c.customer_id = sales.customer_id") + .where('sales.sale_status = "completed" and DATE_FORMAT(CONVERT_TZ(sales.receipt_date,"+00:00","+06:30"),"%Y-%m-%d") between ? and ? and c.customer_type = "Dinein" and c.membership_id is null',from,to) + .first() + end else if current_user.role == 'administrator' || current_user.role == 'manager' - query = Sale.select("count(sales.customer_id) as total_dinein_cus") + if !from_time.nil? && !to_time.nil? + query = Sale.select("count(sales.customer_id) as total_dinein_cus") .joins("JOIN customers as c ON c.customer_id = sales.customer_id") - .where('sales.sale_status = "completed" and sales.receipt_date between ? and ? and c.customer_type = "Dinein" and c.membership_id is null',from,to) + .where('sales.sale_status = "completed" and DATE_FORMAT(CONVERT_TZ(sales.receipt_date,"+00:00","+06:30"),"%Y-%m-%d") between ? and ? and DATE_FORMAT(CONVERT_TZ(sales.receipt_date,"+00:00","+06:30"),"%H:%M") between ? and ? and c.customer_type = "Dinein" and c.membership_id is null',from,to,from_time,to_time) .first() + else + query = Sale.select("count(sales.customer_id) as total_dinein_cus") + .joins("JOIN customers as c ON c.customer_id = sales.customer_id") + .where('sales.sale_status = "completed" and DATE_FORMAT(CONVERT_TZ(sales.receipt_date,"+00:00","+06:30"),"%Y-%m-%d") between ? and ? and c.customer_type = "Dinein" and c.membership_id is null',from,to) + .first() + end else shift = ShiftSale.current_open_shift(current_user.id) if !shift.nil? - query = Sale.select("count(sales.customer_id) as total_dinein_cus") + if !from_time.nil? && !to_time.nil? + query = Sale.select("count(sales.customer_id) as total_dinein_cus") .joins("JOIN customers as c ON c.customer_id = sales.customer_id") - .where('sales.sale_status = "completed" and sales.receipt_date between ? and ? and c.customer_type = "Dinein" and c.membership_id is null and sales.shift_sale_id=?',from,to,shift.id) + .where('sales.sale_status = "completed" and DATE_FORMAT(CONVERT_TZ(sales.receipt_date,"+00:00","+06:30"),"%Y-%m-%d") between ? and ? and DATE_FORMAT(CONVERT_TZ(sales.receipt_date,"+00:00","+06:30"),"%H:%M") between ? and ? and c.customer_type = "Dinein" and c.membership_id is null and sales.shift_sale_id=?',from,to,from_time,to_time,shift.id) .first() + else + query = Sale.select("count(sales.customer_id) as total_dinein_cus") + .joins("JOIN customers as c ON c.customer_id = sales.customer_id") + .where('sales.sale_status = "completed" and DATE_FORMAT(CONVERT_TZ(sales.receipt_date,"+00:00","+06:30"),"%Y-%m-%d") between ? and ? and c.customer_type = "Dinein" and c.membership_id is null and sales.shift_sale_id=?',from,to,shift.id) + .first() + end end end end @@ -1561,26 +1939,47 @@ end end end - def self.total_takeaway(today,current_user=nil,from=nil,to=nil) + def self.total_takeaway(today,current_user=nil,from=nil,to=nil,from_time=nil,to_time=nil) if !from.nil? && !to.nil? if current_user.nil? - query = Sale.select("count(sales.customer_id) as total_take_cus") - .joins("JOIN customers as c ON c.customer_id = sales.customer_id") - .where('sales.sale_status = "completed" and sales.receipt_date between ? and ? and c.customer_type = "Takeaway" and c.membership_id is null',from,to) - .first() - else - if current_user.role == 'administrator' || current_user.role == 'manager' + if !from_time.nil? && !to_time.nil? query = Sale.select("count(sales.customer_id) as total_take_cus") .joins("JOIN customers as c ON c.customer_id = sales.customer_id") - .where('sales.sale_status = "completed" and sales.receipt_date between ? and ? and c.customer_type = "Takeaway" and c.membership_id is null',from,to) + .where('sales.sale_status = "completed" and DATE_FORMAT(CONVERT_TZ(sales.receipt_date,"+00:00","+06:30"),"%Y-%m-%d") between ? and ? and DATE_FORMAT(CONVERT_TZsales.receipt_date,"%H:%M") between ? and ? and c.customer_type = "Takeaway" and c.membership_id is null',from,to,from_time,to_time) .first() + else + query = Sale.select("count(sales.customer_id) as total_take_cus") + .joins("JOIN customers as c ON c.customer_id = sales.customer_id") + .where('sales.sale_status = "completed" and DATE_FORMAT(CONVERT_TZ(sales.receipt_date,"+00:00","+06:30"),"%Y-%m-%d") between ? and ? and c.customer_type = "Takeaway" and c.membership_id is null',from,to) + .first() + end + else + if current_user.role == 'administrator' || current_user.role == 'manager' + if !from_time.nil? && !to_time.nil? + query = Sale.select("count(sales.customer_id) as total_take_cus") + .joins("JOIN customers as c ON c.customer_id = sales.customer_id") + .where('sales.sale_status = "completed" and DATE_FORMAT(CONVERT_TZ(sales.receipt_date,"+00:00","+06:30"),"%Y-%m-%d") between ? and ? and DATE_FORMAT(CONVERT_TZ(sales.receipt_date,"+00:00","+06:30"),"%H:%M") between ? and ? and c.customer_type = "Takeaway" and c.membership_id is null',from,to,from_time,to_time) + .first() + else + query = Sale.select("count(sales.customer_id) as total_take_cus") + .joins("JOIN customers as c ON c.customer_id = sales.customer_id") + .where('sales.sale_status = "completed" and DATE_FORMAT(CONVERT_TZ(sales.receipt_date,"+00:00","+06:30"),"%Y-%m-%d") between ? and ? and c.customer_type = "Takeaway" and c.membership_id is null',from,to) + .first() + end else shift = ShiftSale.current_open_shift(current_user.id) if !shift.nil? - query = Sale.select("count(sales.customer_id) as total_take_cus") - .joins("JOIN customers as c ON c.customer_id = sales.customer_id") - .where('sales.sale_status = "completed" and sales.receipt_date between ? and ? and c.customer_type = "Takeaway" and c.membership_id is null and sales.shift_sale_id=?',from,to,shift.id) - .first() + if !from_time.nil? && !to_time.nil? + query = Sale.select("count(sales.customer_id) as total_take_cus") + .joins("JOIN customers as c ON c.customer_id = sales.customer_id") + .where('sales.sale_status = "completed" and DATE_FORMAT(CONVERT_TZ(sales.receipt_date,"+00:00","+06:30"),"%Y-%m-%d") between ? and ? and DATE_FORMAT(CONVERT_TZ(sales.receipt_date,"+00:00","+06:30"),"%H:%M") between ? and ? and c.customer_type = "Takeaway" and c.membership_id is null and sales.shift_sale_id=?',from,to,from_time,to_time,shift.id) + .first() + else + query = Sale.select("count(sales.customer_id) as total_take_cus") + .joins("JOIN customers as c ON c.customer_id = sales.customer_id") + .where('sales.sale_status = "completed" and DATE_FORMAT(CONVERT_TZ(sales.receipt_date,"+00:00","+06:30"),"%Y-%m-%d") between ? and ? and c.customer_type = "Takeaway" and c.membership_id is null and sales.shift_sale_id=?',from,to,shift.id) + .first() + end end end end @@ -1609,26 +2008,43 @@ end end end - def self.total_membership(today,current_user=nil,from=nil,to=nil) + def self.total_membership(today,current_user=nil,from=nil,to=nil,from_time=nil,to_time=nil) if !from.nil? && !to.nil? if current_user.nil? - query = Sale.select("count(distinct sales.customer_id) as total_memb_cus") - .joins("JOIN customers as c ON c.customer_id = sales.customer_id") - .where('sales.sale_status = "completed" and sales.receipt_date between ? and ? and ((c.customer_type = "Dinein" and c.membership_id is not null) or (c.customer_type = "Takeaway" and c.membership_id is not null))',from,to) - .first() - else - if current_user.role == 'administrator' || current_user.role == 'manager' + if !from_time.nil? && !to_time.nil? query = Sale.select("count(distinct sales.customer_id) as total_memb_cus") .joins("JOIN customers as c ON c.customer_id = sales.customer_id") - .where('sales.sale_status = "completed" and sales.receipt_date between ? and ? and ((c.customer_type = "Dinein" and c.membership_id is not null) or (c.customer_type = "Takeaway" and c.membership_id is not null))',from,to) + .where('sales.sale_status = "completed" and DATE_FORMAT(CONVERT_TZ(sales.receipt_date,"+00:00","+06:30"),"%Y-%m-%d") between ? and ? and DATE_FORMAT(CONVERT_TZ(sales.receipt_date,"+00:00","+06:30"),"%H:%M") between ? and ? and ((c.customer_type = "Dinein" and c.membership_id is not null) or (c.customer_type = "Takeaway" and c.membership_id is not null))',from,to,from_time,to_time) .first() + else + query = Sale.select("count(distinct sales.customer_id) as total_memb_cus") + .joins("JOIN customers as c ON c.customer_id = sales.customer_id") + .where('sales.sale_status = "completed" and DATE_FORMAT(CONVERT_TZ(sales.receipt_date,"+00:00","+06:30"),"%Y-%m-%d") between ? and ? and ((c.customer_type = "Dinein" and c.membership_id is not null) or (c.customer_type = "Takeaway" and c.membership_id is not null))',from,to) + .first() + end + else + if current_user.role == 'administrator' || current_user.role == 'manager' + if !from_time.nil? && !to_time.nil? + query = Sale.select("count(distinct sales.customer_id) as total_memb_cus") + .joins("JOIN customers as c ON c.customer_id = sales.customer_id") + .where('sales.sale_status = "completed" and DATE_FORMAT(CONVERT_TZ(sales.receipt_date,"+00:00","+06:30"),"%Y-%m-%d") between ? and ? and DATE_FORMAT(CONVERT_TZ(sales.receipt_date,"+00:00","+06:30"),"%H:%M") between ? and ? and ((c.customer_type = "Dinein" and c.membership_id is not null) or (c.customer_type = "Takeaway" and c.membership_id is not null))',from,to,from_time,to_time) + .first() + else + query = Sale.select("count(distinct sales.customer_id) as total_memb_cus") + .joins("JOIN customers as c ON c.customer_id = sales.customer_id") + .where('sales.sale_status = "completed" and DATE_FORMAT(CONVERT_TZ(sales.receipt_date,"+00:00","+06:30"),"%Y-%m-%d") between ? and ? and ((c.customer_type = "Dinein" and c.membership_id is not null) or (c.customer_type = "Takeaway" and c.membership_id is not null))',from,to) + .first() + end else shift = ShiftSale.current_open_shift(current_user.id) if !shift.nil? query = Sale.select("count(distinct sales.customer_id) as total_memb_cus") .joins("JOIN customers as c ON c.customer_id = sales.customer_id") - .where('sales.sale_status = "completed" and sales.receipt_date between ? and ? and ((c.customer_type = "Dinein" and c.membership_id is not null) or (c.customer_type = "Takeaway" and c.membership_id is not null)) and sales.shift_sale_id=?',from,to,shift.id) - .first() + if !from_time.nil? && !to_time.nil? + query = query.where('sales.sale_status = "completed" and DATE_FORMAT(CONVERT_TZ(sales.receipt_date,"+00:00","+06:30"),"%Y-%m-%d") between ? and ? and DATE_FORMAT(CONVERT_TZ(sales.receipt_date,"+00:00","+06:30"),"%H:%M") between ? and ? and ((c.customer_type = "Dinein" and c.membership_id is not null) or (c.customer_type = "Takeaway" and c.membership_id is not null)) and sales.shift_sale_id=?',from,to,from_time,to_time,shift.id).first() + else + query = query.where('sales.sale_status = "completed" and DATE_FORMAT(CONVERT_TZ(sales.receipt_date,"+00:00","+06:30"),"%Y-%m-%d") between ? and ? and ((c.customer_type = "Dinein" and c.membership_id is not null) or (c.customer_type = "Takeaway" and c.membership_id is not null)) and sales.shift_sale_id=?',from,to,shift.id).first() + end end end end @@ -1657,26 +2073,41 @@ end end end - def self.total_other_customer(today,current_user=nil,from=nil,to=nil) + def self.total_other_customer(today,current_user=nil,from=nil,to=nil,from_time=nil,to_time=nil) if !from.nil? && !to.nil? if current_user.nil? query = Sale.select("count(sales.customer_id) as total_cus") .joins("JOIN customers as c ON c.customer_id = sales.customer_id") - .where('sales.sale_status = "completed" and sales.receipt_date between ? and ? and c.customer_type is null and c.membership_id is null',from,to) - .first() + if !from_time.nil? && !to_time.nil? + query = query.where('sales.sale_status = "completed" and DATE_FORMAT(CONVERT_TZ(sales.receipt_date,"+00:00","+06:30"),"%Y-%m-%d") between ? and ? and DATE_FORMAT(CONVERT_TZ(sales.receipt_date,"+00:00","+06:30"),"%H:%M") between ? and ? and c.customer_type is null and c.membership_id is null',from,to,from_time,to_time) + .first() + else + query = query.where('sales.sale_status = "completed" and DATE_FORMAT(CONVERT_TZ(sales.receipt_date,"+00:00","+06:30"),"%Y-%m-%d") between ? and ? and c.customer_type is null and c.membership_id is null',from,to) + .first() + end else if current_user.role == 'administrator' || current_user.role == 'manager' query = Sale.select("count(sales.customer_id) as total_cus") .joins("JOIN customers as c ON c.customer_id = sales.customer_id") - .where('sales.sale_status = "completed" and sales.receipt_date between ? and ? and c.customer_type is null and c.membership_id is null',from,to) - .first() + if !from_time.nil? && !to_time.nil? + query = query.where('sales.sale_status = "completed" and DATE_FORMAT(CONVERT_TZ(sales.receipt_date,"+00:00","+06:30"),"%Y-%m-%d") between ? and ? and DATE_FORMAT(CONVERT_TZ(sales.receipt_date,"+00:00","+06:30"),"%H:%M") between ? and ? and c.customer_type is null and c.membership_id is null',from,to,from_time,to_time) + .first() + else + query = query.where('sales.sale_status = "completed" and DATE_FORMAT(CONVERT_TZ(sales.receipt_date,"+00:00","+06:30"),"%Y-%m-%d") between ? and ? and c.customer_type is null and c.membership_id is null',from,to) + .first() + end else shift = ShiftSale.current_open_shift(current_user.id) if !shift.nil? query = Sale.select("count(sales.customer_id) as total_cus") .joins("JOIN customers as c ON c.customer_id = sales.customer_id") - .where('sales.sale_status = "completed" and sales.receipt_date between ? and ? and c.customer_type is null and c.membership_id is null and sales.shift_sale_id=?',from,to,shift.id) - .first() + if !from_time.nil? && !to_time.nil? + query = query.where('sales.sale_status = "completed" and DATE_FORMAT(CONVERT_TZ(sales.receipt_date,"+00:00","+06:30"),"%Y-%m-%d") between ? and ? and DATE_FORMAT(CONVERT_TZ(sales.receipt_date,"+00:00","+06:30"),"%H:%M") between ? and ? and c.customer_type is null and c.membership_id is null and sales.shift_sale_id=?',from,to,from_time,to_time,shift.id) + .first() + else + query = query.where('sales.sale_status = "completed" and DATE_FORMAT(CONVERT_TZ(sales.receipt_date,"+00:00","+06:30"),"%Y-%m-%d") between ? and ? and c.customer_type is null and c.membership_id is null and sales.shift_sale_id=?',from,to,shift.id) + .first() + end end end end @@ -1705,29 +2136,44 @@ end end end - def self.total_order(today,current_user=nil,from=nil,to=nil) + def self.total_order(today,current_user=nil,from=nil,to=nil,from_time=nil,to_time=nil) if !from.nil? && !to.nil? if current_user.nil? query = Sale.select("count(distinct a.order_id) as total_order") .joins("JOIN sale_orders as a ON a.sale_id = sales.sale_id") .joins("JOIN orders as b ON b.order_id = a.order_id") - .where('b.status = "billed" and sales.receipt_date between ? and ?',from,to) - .first() + if !from_time.nil? && !to_time.nil? + query = query.where('b.status = "billed" and DATE_FORMAT(CONVERT_TZ(sales.receipt_date,"+00:00","+06:30"),"%Y-%m-%d") between ? and ? and DATE_FORMAT(CONVERT_TZ(sales.receipt_date,"+00:00","+06:30"),"%H:%M") between ? and ?',from,to,from_time,to_time) + .first() + else + query = query.where('b.status = "billed" and DATE_FORMAT(CONVERT_TZ(sales.receipt_date,"+00:00","+06:30"),"%Y-%m-%d") between ? and ?',from,to) + .first() + end else if current_user.role == 'administrator' || current_user.role == 'manager' query = Sale.select("count(distinct a.order_id) as total_order") .joins("JOIN sale_orders as a ON a.sale_id = sales.sale_id") .joins("JOIN orders as b ON b.order_id = a.order_id") - .where('b.status = "billed" and sales.receipt_date between ? and ?',from,to) - .first() + if !from_time.nil? && !to_time.nil? + query = query.where('b.status = "billed" and DATE_FORMAT(CONVERT_TZ(sales.receipt_date,"+00:00","+06:30"),"%Y-%m-%d") between ? and ? and DATE_FORMAT(CONVERT_TZ(sales.receipt_date,"+00:00","+06:30"),"%H:%M") between ? and ?',from,to,from_time,to_time) + .first() + else + query = query.where('b.status = "billed" and DATE_FORMAT(CONVERT_TZ(sales.receipt_date,"+00:00","+06:30"),"%Y-%m-%d") between ? and ?',from,to) + .first() + end else shift = ShiftSale.current_open_shift(current_user.id) if !shift.nil? query = Sale.select("count(distinct a.order_id) as total_order") .joins("JOIN sale_orders as a ON a.sale_id = sales.sale_id") .joins("JOIN orders as b ON b.order_id = a.order_id") - .where('b.status = "billed" and sales.receipt_date between ? and ? and sales.shift_sale_id=?',from,to,shift.id) - .first() + if !from_time.nil? && !to_time.nil? + query = query.where('b.status = "billed" and DATE_FORMAT(CONVERT_TZ(sales.receipt_date,"+00:00","+06:30"),"%Y-%m-%d") between ? and ? and DATE_FORMAT(CONVERT_TZ(sales.receipt_date,"+00:00","+06:30"),"%H:%M") between ? and ? and sales.shift_sale_id=?',from,to,from_time,to_time,shift.id) + .first() + else + query = query.where('b.status = "billed" and DATE_FORMAT(CONVERT_TZ(sales.receipt_date,"+00:00","+06:30"),"%Y-%m-%d") between ? and ? and sales.shift_sale_id=?',from,to,shift.id) + .first() + end end end end @@ -1759,26 +2205,38 @@ end end end - def self.total_account(today,current_user=nil,from=nil,to=nil) + def self.total_account(today,current_user=nil,from=nil,to=nil,from_time=nil,to_time=nil) if !from.nil? && !to.nil? if current_user.nil? query = Sale.select("distinct b.id as account_id, b.title as title") .joins("JOIN sale_items as a ON a.sale_id = sales.sale_id") .joins("JOIN accounts as b ON b.id = a.account_id") - .where('sales.sale_status = "completed" and sales.receipt_date between ? and ?',from,to) + if !from_time.nil? && !to_time.nil? + query = query.where('sales.sale_status = "completed" and DATE_FORMAT(CONVERT_TZ(sales.receipt_date,"+00:00","+06:30"),"%Y-%m-%d") between ? and ? and DATE_FORMAT(CONVERT_TZ(sales.receipt_date,"+00:00","+06:30"),"%Y-%m-%d") between ? and ?',from,to,from_time,to_time) + else + query = query.where('sales.sale_status = "completed" and DATE_FORMAT(CONVERT_TZ(sales.receipt_date,"+00:00","+06:30"),"%Y-%m-%d") between ? and ?',from,to) + end else if current_user.role == 'administrator' || current_user.role == 'manager' query = Sale.select("distinct b.id as account_id, b.title as title") .joins("JOIN sale_items as a ON a.sale_id = sales.sale_id") .joins("JOIN accounts as b ON b.id = a.account_id") - .where('sales.sale_status = "completed" and sales.receipt_date between ? and ?',from,to) + if !from_time.nil? && !to_time.nil? + query = query.where('sales.sale_status = "completed" and DATE_FORMAT(CONVERT_TZ(sales.receipt_date,"+00:00","+06:30"),"%Y-%m-%d") between ? and ? and DATE_FORMAT(CONVERT_TZ(sales.receipt_date,"+00:00","+06:30"),"%H:%M") between ? and ?',from,to,from_time,to_time) + else + query = query.where('sales.sale_status = "completed" and DATE_FORMAT(CONVERT_TZ(sales.receipt_date,"+00:00","+06:30"),"%Y-%m-%d") between ? and ?',from,to) + end else shift = ShiftSale.current_open_shift(current_user.id) if !shift.nil? query = Sale.select("distinct b.id as account_id, b.title as title") .joins("JOIN sale_items as a ON a.sale_id = sales.sale_id") .joins("JOIN accounts as b ON b.id = a.account_id") - .where('sales.sale_status = "completed" and sales.receipt_date between ? and ? and sales.shift_sale_id=?',from,to,shift.id) + if !from_time.nil? && !to_time.nil? + query = query.where('sales.sale_status = "completed" and DATE_FORMAT(CONVERT_TZ(sales.receipt_date,"+00:00","+06:30"),"%Y-%m-%d") between ? and ? and DATE_FORMAT(CONVERT_TZ(sales.receipt_date,"+00:00","+06:30"),"%H:%M") between ? and ? and sales.shift_sale_id=?',from,to,from_time,to_time,shift.id) + else + query = query.where('sales.sale_status = "completed" and DATE_FORMAT(CONVERT_TZ(sales.receipt_date,"+00:00","+06:30"),"%Y-%m-%d") between ? and ? and sales.shift_sale_id=?',from,to,shift.id) + end end end end @@ -1807,26 +2265,41 @@ end end end - def self.account_data(account_id, today, current_user=nil,from=nil,to=nil) + def self.account_data(account_id, today, current_user=nil,from=nil,to=nil,from_time=nil,to_time=nil) if !from.nil? && !to.nil? if current_user.nil? query = Sale.select("count(*) as cnt_acc, SUM(a.price) as total_acc") .joins("JOIN sale_items as a ON a.sale_id = sales.sale_id") - .where("sales.sale_status = 'completed' and a.account_id ='#{account_id}' and sales.receipt_date between ? and ?",from,to) - .first() + if !from_time.nil? && !to_time.nil? + query = query.where("sales.sale_status = 'completed' and a.account_id ='#{account_id}' and DATE_FORMAT(CONVERT_TZ(sales.receipt_date,'+00:00','+06:30'),'%Y-%m-%d') between ? and ? and DATE_FORMAT(CONVERT_TZ(sales.receipt_date,'+00:00','+06:30'),'%H:%M') between ? and ?",from,to,from_time,to_time) + .first() + else + query = query.where("sales.sale_status = 'completed' and a.account_id ='#{account_id}' and DATE_FORMAT(CONVERT_TZ(sales.receipt_date,'+00:00','+06:30'),'%Y-%m-%d') between ? and ?",from,to) + .first() + end else if current_user.role == 'administrator' || current_user.role == 'manager' query = Sale.select("count(*) as cnt_acc, SUM(a.price) as total_acc") .joins("JOIN sale_items as a ON a.sale_id = sales.sale_id") - .where("sales.sale_status = 'completed' and a.account_id ='#{account_id}' and sales.receipt_date between ? and ?",from,to) - .first() + if !from_time.nil? && !to_time.nil? + query = query.where("sales.sale_status = 'completed' and a.account_id ='#{account_id}' and DATE_FORMAT(CONVERT_TZ(sales.receipt_date,'+00:00','+06:30'),'%Y-%m-%d') between ? and ? and DATE_FORMAT(CONVERT_TZ(sales.receipt_date,'+00:00','+06:30'),'%H:%M') between ? and ?",from,to,from_time,to_time) + .first() + else + query = query.where("sales.sale_status = 'completed' and a.account_id ='#{account_id}' and DATE_FORMAT(CONVERT_TZ(sales.receipt_date,'+00:00','+06:30'),'%Y-%m-%d') between ? and ?",from,to) + .first() + end else shift = ShiftSale.current_open_shift(current_user.id) if !shift.nil? query = Sale.select("count(*) as cnt_acc, SUM(a.price) as total_acc") .joins("JOIN sale_items as a ON a.sale_id = sales.sale_id") - .where("sales.sale_status = 'completed' and a.account_id ='#{account_id}' and sales.receipt_date between ? and ? and sales.shift_sale_id=?",from,to,shift.id) - .first() + if !from_time.nil? && !to_time.nil? + query = query.where("sales.sale_status = 'completed' and a.account_id ='#{account_id}' and DATE_FORMAT(CONVERT_TZ(sales.receipt_date,'+00:00','+06:30'),'%Y-%m-%d') between ? and ? and DATE_FORMAT(CONVERT_TZ(sales.receipt_date,'+00:00','+06:30'),'%H:%M') between ? and ? and sales.shift_sale_id=?",from,to,from_time,to_time,shift.id) + .first() + else + query = query.where("sales.sale_status = 'completed' and a.account_id ='#{account_id}' and DATE_FORMAT(CONVERT_TZ(sales.receipt_date,'+00:00','+06:30'),'%Y-%m-%d') between ? and ? and sales.shift_sale_id=?",from,to,shift.id) + .first() + end end end end @@ -1855,32 +2328,44 @@ end end end - def self.top_items(today,current_user=nil,from=nil,to=nil) + def self.top_items(today,current_user=nil,from=nil,to=nil,from_time=nil,to_time=nil) if !from.nil? && !to.nil? if current_user.nil? query = Sale.select("a.product_name as item_name, SUM(a.price) as item_total_price") .joins("JOIN sale_items as a ON a.sale_id = sales.sale_id") - .where("(a.qty > 0 and a.price > 0) and payment_status='paid' and sales.sale_status = 'completed' and sales.receipt_date between ? and ?",from,to) - .group("a.product_code") - .order("SUM(a.qty) DESC") - .first() + if !from_time.nil? && !to_time.nil? + query = query.where("(a.qty > 0 and a.price > 0) and payment_status='paid' and sales.sale_status = 'completed' and DATE_FORMAT(CONVERT_TZ(sales.receipt_date,'+00:00','+06:30'),'%Y-%m-%d') between ? and ? and DATE_FORMAT(CONVERT_TZ(sales.receipt_date,'+00:00','+06:30'),'%H:%M') between ? and ?",from,to,from_time,to_time) + else + query = query.where("(a.qty > 0 and a.price > 0) and payment_status='paid' and sales.sale_status = 'completed' and DATE_FORMAT(CONVERT_TZ(sales.receipt_date,'+00:00','+06:30'),'%Y-%m-%d') between ? and ?",from,to) + end + query = query.group("a.product_code") + .order("SUM(a.qty) DESC") + .first() else if current_user.role == 'administrator' || current_user.role == 'manager' query = Sale.select("a.product_name as item_name, SUM(a.price) as item_total_price") .joins("JOIN sale_items as a ON a.sale_id = sales.sale_id") - .where("(a.qty > 0 and a.price > 0) and payment_status='paid' and sales.sale_status = 'completed' and sales.receipt_date between ? and ?",from,to) - .group("a.product_code") - .order("SUM(a.qty) DESC") - .first() + if !from_time.nil? && !to_time.nil? + query = query.where("(a.qty > 0 and a.price > 0) and payment_status='paid' and sales.sale_status = 'completed' and DATE_FORMAT(CONVERT_TZ(sales.receipt_date,'+00:00','+06:30'),'%Y-%m-%d') between ? and ? and DATE_FORMAT(CONVERT_TZ(sales.receipt_date,'+00:00','+06:30'),'%H:%M') between ? and ?",from,to,from_time,to_time) + else + query = query.where("(a.qty > 0 and a.price > 0) and payment_status='paid' and sales.sale_status = 'completed' and DATE_FORMAT(CONVERT_TZ(sales.receipt_date,'+00:00','+06:30'),'%Y-%m-%d') between ? and ?",from,to) + end + query = query.group("a.product_code") + .order("SUM(a.qty) DESC") + .first() else shift = ShiftSale.current_open_shift(current_user.id) if !shift.nil? query = Sale.select("a.product_name as item_name, SUM(a.price) as item_total_price") .joins("JOIN sale_items as a ON a.sale_id = sales.sale_id") - .where("(a.qty > 0 and a.price > 0) and payment_status='paid' and sales.sale_status = 'completed' and sales.receipt_date between ? and ? and sales.shift_sale_id=?",from,to,shift.id) - .group("a.product_code") - .order("SUM(a.qty) DESC") - .first() + if !from_time.nil? && !to_time.nil? + query = query.where("(a.qty > 0 and a.price > 0) and payment_status='paid' and sales.sale_status = 'completed' and DATE_FORMAT(CONVERT_TZ(sales.receipt_date,'+00:00','+06:30'),'%Y-%m-%d') between ? and ? and DATE_FORMAT(CONVERT_TZ(sales.receipt_date,'+00:00','+06:30'),'%H:%M') between ? and ? and sales.shift_sale_id=?",from,to,from_time,to_time,shift.id) + else + query = query.where("(a.qty > 0 and a.price > 0) and payment_status='paid' and sales.sale_status = 'completed' and DATE_FORMAT(CONVERT_TZ(sales.receipt_date,'+00:00','+06:30'),'%Y-%m-%d') between ? and ? and sales.shift_sale_id=?",from,to,shift.id) + end + query = query.group("a.product_code") + .order("SUM(a.qty) DESC") + .first() end end end @@ -1915,23 +2400,38 @@ end end end - def self.total_foc_items(today,current_user=nil,from=nil,to=nil) + def self.total_foc_items(today,current_user=nil,from=nil,to=nil,from_time=nil,to_time=nil) if !from.nil? && !to.nil? if current_user.nil? query = Sale.joins("JOIN sale_items as a ON a.sale_id = sales.sale_id") - .where("sales.sale_status = 'completed' and a.remark='foc' and a.product_name not like '%FOC%' and sales.receipt_date between ? and ?",from,to) - .sum("a.qty") + if !from_time.nil? && !to_time.nil? + query = query.where("sales.sale_status = 'completed' and a.remark='foc' and a.product_name not like '%FOC%' and DATE_FORMAT(CONVERT_TZ(sales.receipt_date,'+00:00','+06:30'),'%Y-%m-%d') between ? and ? and DATE_FORMAT(CONVERT_TZ(sales.receipt_date,'+00:00','+06:30'),'%H:%M') between ? and ?",from,to,from_time,to_time) + .sum("a.qty") + else + query = query.where("sales.sale_status = 'completed' and a.remark='foc' and a.product_name not like '%FOC%' and DATE_FORMAT(CONVERT_TZ(sales.receipt_date,'+00:00','+06:30'),'%Y-%m-%d') between ? and ?",from,to) + .sum("a.qty") + end else if current_user.role == 'administrator' || current_user.role == 'manager' query = Sale.joins("JOIN sale_items as a ON a.sale_id = sales.sale_id") - .where("sales.sale_status = 'completed' and a.remark='foc' and a.product_name not like '%FOC%' and sales.receipt_date between ? and ?",from,to) - .sum("a.qty") + if !from_time.nil? && !to_time.nil? + query = query.where("sales.sale_status = 'completed' and a.remark='foc' and a.product_name not like '%FOC%' and DATE_FORMAT(CONVERT_TZ(sales.receipt_date,'+00:00','+06:30'),'%Y-%m-%d') between ? and ? and DATE_FORMAT(CONVERT_TZ(sales.receipt_date,'+00:00','+06:30'),'%H:%M') between ? and ?",from,to,from_time,to_time) + .sum("a.qty") + else + query = query.where("sales.sale_status = 'completed' and a.remark='foc' and a.product_name not like '%FOC%' and DATE_FORMAT(CONVERT_TZ(sales.receipt_date,'+00:00','+06:30'),'%Y-%m-%d') between ? and ?",from,to) + .sum("a.qty") + end else shift = ShiftSale.current_open_shift(current_user.id) if !shift.nil? query = Sale.joins("JOIN sale_items as a ON a.sale_id = sales.sale_id") - .where("sales.sale_status = 'completed' and a.remark='foc' and a.product_name not like '%FOC%' and sales.receipt_date between ? and ? and sales.shift_sale_id=?",from,to,shift.id) - .sum("a.qty") + if !from_time.nil? && !to_time.nil? + query = query.where("sales.sale_status = 'completed' and a.remark='foc' and a.product_name not like '%FOC%' and DATE_FORMAT(CONVERT_TZ(sales.receipt_date,'+00:00','+06:30'),'%Y-%m-%d') between ? and ? and DATE_FORMAT(CONVERT_TZ(sales.receipt_date,'+00:00','+06:30'),'%H:%M') between ? and ? and sales.shift_sale_id=?",from,to,from_time,to_time,shift.id) + .sum("a.qty") + else + query = query.where("sales.sale_status = 'completed' and a.remark='foc' and a.product_name not like '%FOC%' and DATE_FORMAT(CONVERT_TZ(sales.receipt_date,'+00:00','+06:30'),'%Y-%m-%d') between ? and ? and sales.shift_sale_id=?",from,to,shift.id) + .sum("a.qty") + end end end end diff --git a/app/models/stock_journal.rb b/app/models/stock_journal.rb index c2a12f4a..f2904b13 100755 --- a/app/models/stock_journal.rb +++ b/app/models/stock_journal.rb @@ -36,12 +36,16 @@ class StockJournal < ApplicationRecord journal.save end - def self.inventory_balances(today,from,to) + def self.inventory_balances(today,from,to,from_time,to_time) if !from.nil? && !to.nil? query = StockJournal.select("mii.item_instance_name as item_instance_name,balance") .joins("join menu_item_instances mii on mii.item_instance_code=stock_journals.item_code") - .where("stock_journals.created_at between '#{from}' and '#{to}'") - .group("mii.item_instance_name") + if !from_time.nil? && !to_time.nil? + query = query.where("DATE_FORMAT(CONVERT_TZ(stock_journals.created_at,'+00:00','+06:30'),'%Y-%m-%d') between '#{from}' and '#{to}'") + else + query = query.where("DATE_FORMAT(CONVERT_TZ(stock_journals.created_at,'+00:00','+06:30'),'%Y-%m-%d') between '#{from}' and '#{to}' and DATE_FORMAT(CONVERT_TZ(stock_journals.created_at,'+00:00','+06:30'),'%H:%M') between '#{from_time}' and '#{to_time}'") + end + query = query.group("mii.item_instance_name") .order("mii.item_instance_name ASC") else query = StockJournal.select("mii.item_instance_name as item_instance_name,balance") diff --git a/app/views/home/dashboard.html.erb b/app/views/home/dashboard.html.erb index 6ee68d97..865202b0 100755 --- a/app/views/home/dashboard.html.erb +++ b/app/views/home/dashboard.html.erb @@ -68,24 +68,46 @@
+ <% + if !@from.nil? + from_date = DateTime.parse(@from).utc.getlocal.strftime("%d-%m-%Y") + else + from_date = Time.now.utc.getlocal.strftime('%d-%m-%Y') + end + if !@to.nil? + to_date = DateTime.parse(@to).utc.getlocal.strftime("%d-%m-%Y") + else + to_date = Time.now.utc.getlocal.strftime('%d-%m-%Y') + end + if !@from_time.nil? + from_time = @from_time + else + from_time = '' + end + if !@to_time.nil? + to_time = @to_time + else + to_time = '' + end + %>
- +
- +
- +
- +
diff --git a/app/views/transactions/sales/index.html.erb b/app/views/transactions/sales/index.html.erb index 5bfc4e61..26fbbcc5 100644 --- a/app/views/transactions/sales/index.html.erb +++ b/app/views/transactions/sales/index.html.erb @@ -17,17 +17,41 @@ <%= form_tag transactions_sales_path, :method => :get do %>
-
+
- +
-
- - + +
+ +
-
+ +
+ + +
+
- + +
+ +
+ +
@@ -98,7 +122,7 @@ <% end %> <% else %> -

There is no data for search....

+

There is no data for search....

<% end %> @@ -116,9 +140,107 @@ From f126d2faf601dcad552025ca0264d5169a9c2504 Mon Sep 17 00:00:00 2001 From: Aung Myo Date: Wed, 28 Mar 2018 09:29:54 +0630 Subject: [PATCH 55/61] update print file.substring for jade --- app/views/origami/home/show.html.erb | 8 ++++---- app/views/origami/payments/show.html.erb | 6 +++--- app/views/origami/rooms/show.html.erb | 4 ++-- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/app/views/origami/home/show.html.erb b/app/views/origami/home/show.html.erb index 4922c1df..7afa2769 100755 --- a/app/views/origami/home/show.html.erb +++ b/app/views/origami/home/show.html.erb @@ -726,9 +726,9 @@ // For Server Print - from jade if ($("#server_mode").val() == "cloud") { - code2lab.printFile(result.filepath, result.printer_url); + code2lab.printFile(result.filepath.substr(6), result.printer_url); } - + // console.log(result); // code2lab.printBill(result.filepath, result.printer_model, result.printer_url); location.reload(); @@ -776,7 +776,7 @@ createReceiptNoInFirstBillData(receipt_no,type); // For Server Print - from jade if ($("#server_mode").val() == "cloud") { - code2lab.printFile(result.filepath, result.printer_url); + code2lab.printFile(result.filepath.substr(6), result.printer_url); } location.reload(); } @@ -942,7 +942,7 @@ success: function (result) { // For Server Print - from jade if ($("#server_mode").val() == "cloud") { - code2lab.printFile(result.filepath, result.printer_url); + code2lab.printFile(result.filepath.substr(6), result.printer_url); } window.location.href = '/origami/'; } diff --git a/app/views/origami/payments/show.html.erb b/app/views/origami/payments/show.html.erb index 001adc53..eb3eefe3 100755 --- a/app/views/origami/payments/show.html.erb +++ b/app/views/origami/payments/show.html.erb @@ -725,7 +725,7 @@ var customer_name = "<%= @customer.name %>"; customer_display_view(null,"reload"); // For Server Print - from jade if ($("#server_mode").val() == "cloud") { - code2lab.printFile(result.filepath, result.printer_url); + code2lab.printFile(result.filepath.substr(6), result.printer_url); } if (cashier_type=="cashier") { window.location.href = '/origami'; @@ -939,7 +939,7 @@ var customer_name = "<%= @customer.name %>"; }, function () { // For Server Print - from jade if ($("#server_mode").val() == "cloud") { - code2lab.printFile(result.filepath, result.printer_url); + code2lab.printFile(result.filepath.substr(6), result.printer_url); } if (cashier_type=="cashier") { window.location.href = '/origami'; @@ -1018,7 +1018,7 @@ var customer_name = "<%= @customer.name %>"; console.log(result); // For Server Print - from jade if ($("#server_mode").val() == "cloud") { - code2lab.printFile(result.filepath, result.printer_url); + code2lab.printFile(result.filepath.substr(6), result.printer_url); } if (cashier_type=="cashier") { window.location.href = '/origami'; diff --git a/app/views/origami/rooms/show.html.erb b/app/views/origami/rooms/show.html.erb index 1b034655..424690ff 100755 --- a/app/views/origami/rooms/show.html.erb +++ b/app/views/origami/rooms/show.html.erb @@ -705,7 +705,7 @@ $("#first_bill").on('click', function(){ createReceiptNoInFirstBillData(receipt_no,""); // For Server Print - from jade if ($("#server_mode").val() == "cloud") { - code2lab.printFile(result.filepath, result.printer_url); + code2lab.printFile(result.filepath.substr(6), result.printer_url); } location.reload(); } @@ -739,7 +739,7 @@ $(".choose_payment").on('click', function () { // For Server Print - from jade if ($("#server_mode").val() == "cloud") { - code2lab.printFile(result.filepath, result.printer_url); + code2lab.printFile(result.filepath.substr(6), result.printer_url); } location.reload(); From 1873633ab27c58e027404d1c7a5c56fe0833620c Mon Sep 17 00:00:00 2001 From: phyusin Date: Wed, 28 Mar 2018 11:07:48 +0630 Subject: [PATCH 56/61] check inventory --- app/controllers/origami/payments_controller.rb | 14 +------------- app/models/inventory_definition.rb | 4 ++-- app/models/stock_journal.rb | 2 +- 3 files changed, 4 insertions(+), 16 deletions(-) diff --git a/app/controllers/origami/payments_controller.rb b/app/controllers/origami/payments_controller.rb index f034aa57..5397c7f0 100755 --- a/app/controllers/origami/payments_controller.rb +++ b/app/controllers/origami/payments_controller.rb @@ -208,19 +208,7 @@ class Origami::PaymentsController < BaseOrigamiController render json: JSON.generate({:status => saleObj.rebate_status, :message => "Can't Rebate coz of Sever Error ", :filename => filename, :receipt_no => sale_receipt_no, :printer_name => printer_name}) - if params[:type] == "quick_service" - booking = Booking.find_by_sale_id(sale_id) - if booking.dining_facility_id.to_i>0 - table_id = booking.dining_facility_id - else - table_id = 0 - end - - booking.booking_orders.each do |order| - Order.pay_process_order_queue(order.order_id,table_id) - end - # end - end + #end end end diff --git a/app/models/inventory_definition.rb b/app/models/inventory_definition.rb index 91823068..4634ff73 100755 --- a/app/models/inventory_definition.rb +++ b/app/models/inventory_definition.rb @@ -12,7 +12,7 @@ class InventoryDefinition < ApplicationRecord end def self.find_product_in_inventory(item) - product = InventoryDefinition.find_by_item_code(item.product_code) + product = InventoryDefinition.find_by_item_code(item.item_instance_code) if product.nil? return false, nil else @@ -21,7 +21,7 @@ class InventoryDefinition < ApplicationRecord end def self.check_balance(item,inventory_definition) # item => saleItemOBj - stock = StockJournal.where('item_code=?', item.product_code).order('created_at desc').take + stock = StockJournal.where('item_code=?', item.item_instance_code).order('created_at desc').take unless stock.nil? modify_balance(item, stock, inventory_definition) else diff --git a/app/models/stock_journal.rb b/app/models/stock_journal.rb index f2904b13..fa4bd285 100755 --- a/app/models/stock_journal.rb +++ b/app/models/stock_journal.rb @@ -8,7 +8,7 @@ class StockJournal < ApplicationRecord balance = calculate_balance(balance, item.qty) journal = StockJournal.new - journal.item_code = item.product_code + journal.item_code = item.item_instance_code journal.inventory_definition_id = inventory_definition.id journal.debit = item.qty journal.balance = balance From 204f622876241bf5221cfbacb0865af2cd588daa Mon Sep 17 00:00:00 2001 From: Aung Myo Date: Wed, 28 Mar 2018 11:10:37 +0630 Subject: [PATCH 57/61] update sale item report --- .../reports/saleitem_controller.rb | 3 +-- .../_shift_sale_report_filter.html.erb | 2 +- app/views/reports/saleitem/index.html.erb | 23 +++++++++++++------ 3 files changed, 18 insertions(+), 10 deletions(-) diff --git a/app/controllers/reports/saleitem_controller.rb b/app/controllers/reports/saleitem_controller.rb index a731cb44..24c812eb 100755 --- a/app/controllers/reports/saleitem_controller.rb +++ b/app/controllers/reports/saleitem_controller.rb @@ -17,8 +17,7 @@ class Reports::SaleitemController < BaseReportController end @type = params[:sale_type] @sale_data, @other_charges,@discount_data , @cash_data , @card_data , @credit_data , @foc_data , @grand_total , @change_amount = Sale.get_by_shift_items(shift_sale_range,shift, from, to, Sale::SALE_STATUS_COMPLETED,@type) -puts @other_charges.to_json -puts "oooooooooooooooooooooooo" + @sale_taxes = Sale.get_separate_tax(shift_sale_range,shift,from,to,nil) @account_cate_count = Hash.new {|hash, key| hash[key] = 0} diff --git a/app/views/reports/saleitem/_shift_sale_report_filter.html.erb b/app/views/reports/saleitem/_shift_sale_report_filter.html.erb index 75a331e9..068a3f58 100755 --- a/app/views/reports/saleitem/_shift_sale_report_filter.html.erb +++ b/app/views/reports/saleitem/_shift_sale_report_filter.html.erb @@ -22,7 +22,7 @@