api/bill_controller edited
This commit is contained in:
681
.idea/workspace.xml
generated
681
.idea/workspace.xml
generated
@@ -2,16 +2,7 @@
|
|||||||
<project version="4">
|
<project version="4">
|
||||||
<component name="ChangeListManager">
|
<component name="ChangeListManager">
|
||||||
<list default="true" id="89ca96af-a0e4-4fe4-b9a3-9969f22d7079" name="Default" comment="">
|
<list default="true" id="89ca96af-a0e4-4fe4-b9a3-9969f22d7079" name="Default" comment="">
|
||||||
<change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/.idea/.generators" />
|
|
||||||
<change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/.idea/.rakeTasks" />
|
|
||||||
<change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/.idea/misc.xml" />
|
|
||||||
<change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/.idea/modules.xml" />
|
|
||||||
<change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/.idea/sxrestaurant.iml" />
|
|
||||||
<change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/.idea/vcs.xml" />
|
|
||||||
<change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/.idea/workspace.xml" />
|
|
||||||
<change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/app/controllers/origami/void_controller.rb" />
|
|
||||||
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/dump.rdb" afterPath="$PROJECT_DIR$/dump.rdb" />
|
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/dump.rdb" afterPath="$PROJECT_DIR$/dump.rdb" />
|
||||||
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/config/routes.rb" afterPath="$PROJECT_DIR$/config/routes.rb" />
|
|
||||||
</list>
|
</list>
|
||||||
<ignored path="$PROJECT_DIR$/.bundle/" />
|
<ignored path="$PROJECT_DIR$/.bundle/" />
|
||||||
<ignored path="$PROJECT_DIR$/components/" />
|
<ignored path="$PROJECT_DIR$/components/" />
|
||||||
@@ -27,21 +18,111 @@
|
|||||||
</component>
|
</component>
|
||||||
<component name="FileEditorManager">
|
<component name="FileEditorManager">
|
||||||
<leaf SIDE_TABS_SIZE_LIMIT_KEY="300">
|
<leaf SIDE_TABS_SIZE_LIMIT_KEY="300">
|
||||||
<file leaf-file-name="booking.rb" pinned="false" current-in-tab="false">
|
<file leaf-file-name="home_controller.rb" pinned="false" current-in-tab="false">
|
||||||
<entry file="file://$PROJECT_DIR$/app/models/booking.rb">
|
<entry file="file://$PROJECT_DIR$/app/controllers/origami/home_controller.rb">
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
<state relative-caret-position="315">
|
<state relative-caret-position="292">
|
||||||
<caret line="21" column="20" lean-forward="false" selection-start-line="21" selection-start-column="20" selection-end-line="21" selection-end-column="20" />
|
<caret line="27" column="42" lean-forward="true" selection-start-line="27" selection-start-column="42" selection-end-line="27" selection-end-column="42" />
|
||||||
<folding />
|
<folding />
|
||||||
</state>
|
</state>
|
||||||
</provider>
|
</provider>
|
||||||
</entry>
|
</entry>
|
||||||
</file>
|
</file>
|
||||||
<file leaf-file-name="home_controller.rb" pinned="false" current-in-tab="false">
|
<file leaf-file-name="show.html.erb" pinned="false" current-in-tab="false">
|
||||||
<entry file="file://$PROJECT_DIR$/app/controllers/origami/home_controller.rb">
|
<entry file="file://$PROJECT_DIR$/app/views/origami/payments/show.html.erb">
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
<state relative-caret-position="387">
|
<state relative-caret-position="399">
|
||||||
<caret line="40" column="40" lean-forward="false" selection-start-line="40" selection-start-column="40" selection-end-line="40" selection-end-column="40" />
|
<caret line="359" column="43" lean-forward="false" selection-start-line="359" selection-start-column="43" selection-end-line="359" selection-end-column="43" />
|
||||||
|
<folding />
|
||||||
|
</state>
|
||||||
|
</provider>
|
||||||
|
</entry>
|
||||||
|
</file>
|
||||||
|
<file leaf-file-name="show.html.erb" pinned="false" current-in-tab="false">
|
||||||
|
<entry file="file://$PROJECT_DIR$/app/views/origami/table_invoices/show.html.erb">
|
||||||
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
|
<state relative-caret-position="2160">
|
||||||
|
<caret line="144" column="16" lean-forward="false" selection-start-line="144" selection-start-column="16" selection-end-line="144" selection-end-column="16" />
|
||||||
|
<folding />
|
||||||
|
</state>
|
||||||
|
</provider>
|
||||||
|
</entry>
|
||||||
|
</file>
|
||||||
|
<file leaf-file-name="index.html.erb" pinned="false" current-in-tab="false">
|
||||||
|
<entry file="file://$PROJECT_DIR$/app/views/origami/home/index.html.erb">
|
||||||
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
|
<state relative-caret-position="420">
|
||||||
|
<caret line="28" column="36" lean-forward="true" selection-start-line="28" selection-start-column="36" selection-end-line="28" selection-end-column="36" />
|
||||||
|
<folding>
|
||||||
|
<element signature="n#style#0;n#div#0;n#div#0;n#div#0;n#div#0;n#div#0;n#!!top" expanded="true" />
|
||||||
|
</folding>
|
||||||
|
</state>
|
||||||
|
</provider>
|
||||||
|
</entry>
|
||||||
|
</file>
|
||||||
|
<file leaf-file-name="void_controller.rb" pinned="false" current-in-tab="false">
|
||||||
|
<entry file="file://$PROJECT_DIR$/app/controllers/origami/void_controller.rb">
|
||||||
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
|
<state relative-caret-position="270">
|
||||||
|
<caret line="18" column="0" lean-forward="false" selection-start-line="18" selection-start-column="0" selection-end-line="18" selection-end-column="0" />
|
||||||
|
<folding />
|
||||||
|
</state>
|
||||||
|
</provider>
|
||||||
|
</entry>
|
||||||
|
</file>
|
||||||
|
<file leaf-file-name="show.html.erb" pinned="false" current-in-tab="false">
|
||||||
|
<entry file="file://$PROJECT_DIR$/app/views/origami/orders/show.html.erb">
|
||||||
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
|
<state relative-caret-position="420">
|
||||||
|
<caret line="28" column="128" lean-forward="false" selection-start-line="28" selection-start-column="128" selection-end-line="28" selection-end-column="128" />
|
||||||
|
<folding>
|
||||||
|
<marker date="1498539948000" expanded="true" signature="3450:4239" ph="do ... end" />
|
||||||
|
<marker date="1498539948000" expanded="true" signature="3598:4131" ph="<%...%>" />
|
||||||
|
<marker date="1498539948000" expanded="true" signature="3714:4114" ph="if ... end" />
|
||||||
|
<marker date="1498539948000" expanded="true" signature="4005:4027" ph="if ... end" />
|
||||||
|
<marker date="1498539948000" expanded="true" signature="4395:6842" ph="..." />
|
||||||
|
<marker date="1498539948000" expanded="true" signature="4419:6833" ph="..." />
|
||||||
|
<marker date="1498539948000" expanded="true" signature="4454:4539" ph="..." />
|
||||||
|
<marker date="1498539948000" expanded="true" signature="4571:6821" ph="..." />
|
||||||
|
<marker date="1498539948000" expanded="true" signature="4609:5000" ph="..." />
|
||||||
|
<marker date="1498539948000" expanded="true" signature="4661:4756" ph="..." />
|
||||||
|
<marker date="1498539948000" expanded="true" signature="4678:4738" ph="..." />
|
||||||
|
<marker date="1498539948000" expanded="true" signature="4713:4734" ph="..." />
|
||||||
|
<marker date="1498539948000" expanded="true" signature="4819:4984" ph="..." />
|
||||||
|
<marker date="1498539948000" expanded="true" signature="5059:5210" ph="..." />
|
||||||
|
<marker date="1498539948000" expanded="true" signature="5111:5193" ph="..." />
|
||||||
|
<marker date="1498539948000" expanded="true" signature="5243:6180" ph="..." />
|
||||||
|
<marker date="1498539948000" expanded="true" signature="5313:6164" ph="..." />
|
||||||
|
<marker date="1498539948000" expanded="true" signature="5334:5545" ph="..." />
|
||||||
|
<marker date="1498539948000" expanded="true" signature="5354:5523" ph="..." />
|
||||||
|
<marker date="1498539948000" expanded="true" signature="5566:6144" ph="..." />
|
||||||
|
<marker date="1498539948000" expanded="true" signature="5583:5749" ph="<%...%>" />
|
||||||
|
<marker date="1498539948000" expanded="true" signature="5817:6041" ph="..." />
|
||||||
|
<marker date="1498539948000" expanded="true" signature="6058:6123" ph="<%...%>" />
|
||||||
|
<marker date="1498539948000" expanded="true" signature="6215:6807" ph="..." />
|
||||||
|
<marker date="1498539948000" expanded="true" signature="6284:6791" ph="..." />
|
||||||
|
<marker date="1498539948000" expanded="true" signature="6302:6491" ph="..." />
|
||||||
|
<marker date="1498539948000" expanded="true" signature="6509:6725" ph="..." />
|
||||||
|
<marker date="1498539948000" expanded="true" signature="6908:7237" ph="..." />
|
||||||
|
<marker date="1498539948000" expanded="true" signature="6999:7127" ph="if ... end" />
|
||||||
|
<marker date="1498539948000" expanded="true" signature="7253:8136" ph="..." />
|
||||||
|
<marker date="1498539948000" expanded="true" signature="7283:7870" ph="{...}" />
|
||||||
|
<marker date="1498539948000" expanded="true" signature="7322:7434" ph="{...}" />
|
||||||
|
<marker date="1498539948000" expanded="true" signature="7471:7574" ph="{...}" />
|
||||||
|
<marker date="1498539948000" expanded="true" signature="7612:7723" ph="{...}" />
|
||||||
|
<marker date="1498539948000" expanded="true" signature="7761:7867" ph="{...}" />
|
||||||
|
<marker date="1498539948000" expanded="true" signature="7905:8012" ph="{...}" />
|
||||||
|
<marker date="1498539948000" expanded="true" signature="8047:8088" ph="{...}" />
|
||||||
|
</folding>
|
||||||
|
</state>
|
||||||
|
</provider>
|
||||||
|
</entry>
|
||||||
|
</file>
|
||||||
|
<file leaf-file-name="show.html.erb" pinned="false" current-in-tab="true">
|
||||||
|
<entry file="file://$PROJECT_DIR$/app/views/origami/sales/show.html.erb">
|
||||||
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
|
<state relative-caret-position="249">
|
||||||
|
<caret line="139" column="30" lean-forward="true" selection-start-line="139" selection-start-column="30" selection-end-line="139" selection-end-column="30" />
|
||||||
<folding />
|
<folding />
|
||||||
</state>
|
</state>
|
||||||
</provider>
|
</provider>
|
||||||
@@ -50,33 +131,8 @@
|
|||||||
<file leaf-file-name="payments_controller.rb" pinned="false" current-in-tab="false">
|
<file leaf-file-name="payments_controller.rb" pinned="false" current-in-tab="false">
|
||||||
<entry file="file://$PROJECT_DIR$/app/controllers/origami/payments_controller.rb">
|
<entry file="file://$PROJECT_DIR$/app/controllers/origami/payments_controller.rb">
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
<state relative-caret-position="266">
|
<state relative-caret-position="150">
|
||||||
<caret line="65" column="35" lean-forward="false" selection-start-line="65" selection-start-column="35" selection-end-line="65" selection-end-column="35" />
|
<caret line="10" column="34" lean-forward="false" selection-start-line="10" selection-start-column="34" selection-end-line="10" selection-end-column="34" />
|
||||||
<folding>
|
|
||||||
<marker date="1498476660000" expanded="true" signature="2556:2593" ph="if ... end" />
|
|
||||||
<marker date="1498476660000" expanded="true" signature="2556:2603" ph="do ... end" />
|
|
||||||
<marker date="1498476660000" expanded="true" signature="2556:2611" ph="if ... end" />
|
|
||||||
<marker date="1498476660000" expanded="true" signature="2556:2617" ph=" ... end" />
|
|
||||||
</folding>
|
|
||||||
</state>
|
|
||||||
</provider>
|
|
||||||
</entry>
|
|
||||||
</file>
|
|
||||||
<file leaf-file-name="void_controller.rb" pinned="false" current-in-tab="true">
|
|
||||||
<entry file="file://$PROJECT_DIR$/app/controllers/origami/void_controller.rb">
|
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
|
||||||
<state relative-caret-position="375">
|
|
||||||
<caret line="25" column="5" lean-forward="true" selection-start-line="25" selection-start-column="5" selection-end-line="25" selection-end-column="5" />
|
|
||||||
<folding />
|
|
||||||
</state>
|
|
||||||
</provider>
|
|
||||||
</entry>
|
|
||||||
</file>
|
|
||||||
<file leaf-file-name="routes.rb" pinned="false" current-in-tab="false">
|
|
||||||
<entry file="file://$PROJECT_DIR$/config/routes.rb">
|
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
|
||||||
<state relative-caret-position="459">
|
|
||||||
<caret line="127" column="25" lean-forward="true" selection-start-line="127" selection-start-column="25" selection-end-line="127" selection-end-column="25" />
|
|
||||||
<folding />
|
<folding />
|
||||||
</state>
|
</state>
|
||||||
</provider>
|
</provider>
|
||||||
@@ -85,8 +141,18 @@
|
|||||||
<file leaf-file-name="show.html.erb" pinned="false" current-in-tab="false">
|
<file leaf-file-name="show.html.erb" pinned="false" current-in-tab="false">
|
||||||
<entry file="file://$PROJECT_DIR$/app/views/origami/home/show.html.erb">
|
<entry file="file://$PROJECT_DIR$/app/views/origami/home/show.html.erb">
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
<state relative-caret-position="920">
|
<state relative-caret-position="30">
|
||||||
<caret line="491" column="0" lean-forward="false" selection-start-line="491" selection-start-column="0" selection-end-line="491" selection-end-column="0" />
|
<caret line="2" column="0" lean-forward="false" selection-start-line="2" selection-start-column="0" selection-end-line="2" selection-end-column="0" />
|
||||||
|
<folding />
|
||||||
|
</state>
|
||||||
|
</provider>
|
||||||
|
</entry>
|
||||||
|
</file>
|
||||||
|
<file leaf-file-name="show.html.erb" pinned="false" current-in-tab="false">
|
||||||
|
<entry file="file://$PROJECT_DIR$/app/views/origami/rooms/show.html.erb">
|
||||||
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
|
<state relative-caret-position="420">
|
||||||
|
<caret line="28" column="128" lean-forward="false" selection-start-line="28" selection-start-column="128" selection-end-line="28" selection-end-column="128" />
|
||||||
<folding />
|
<folding />
|
||||||
</state>
|
</state>
|
||||||
</provider>
|
</provider>
|
||||||
@@ -97,6 +163,8 @@
|
|||||||
<component name="FindInProjectRecents">
|
<component name="FindInProjectRecents">
|
||||||
<findStrings>
|
<findStrings>
|
||||||
<find>origami</find>
|
<find>origami</find>
|
||||||
|
<find>table_invoice</find>
|
||||||
|
<find>sale_id</find>
|
||||||
</findStrings>
|
</findStrings>
|
||||||
</component>
|
</component>
|
||||||
<component name="Git.Settings">
|
<component name="Git.Settings">
|
||||||
@@ -105,11 +173,17 @@
|
|||||||
<component name="IdeDocumentHistory">
|
<component name="IdeDocumentHistory">
|
||||||
<option name="CHANGED_PATHS">
|
<option name="CHANGED_PATHS">
|
||||||
<list>
|
<list>
|
||||||
<option value="$PROJECT_DIR$/app/views/origami/orders/show.html.erb" />
|
|
||||||
<option value="$PROJECT_DIR$/app/controllers/origami/home_controller.rb" />
|
|
||||||
<option value="$PROJECT_DIR$/app/views/origami/home/show.html.erb" />
|
|
||||||
<option value="$PROJECT_DIR$/config/routes.rb" />
|
<option value="$PROJECT_DIR$/config/routes.rb" />
|
||||||
|
<option value="$PROJECT_DIR$/app/views/origami/table_invoices/show.html.erb" />
|
||||||
|
<option value="$PROJECT_DIR$/app/controllers/origami/table_invoices_controller.rb" />
|
||||||
<option value="$PROJECT_DIR$/app/controllers/origami/void_controller.rb" />
|
<option value="$PROJECT_DIR$/app/controllers/origami/void_controller.rb" />
|
||||||
|
<option value="$PROJECT_DIR$/app/controllers/origami/home_controller.rb" />
|
||||||
|
<option value="$PROJECT_DIR$/app/views/origami/payments/show.html.erb" />
|
||||||
|
<option value="$PROJECT_DIR$/app/views/origami/home/show.html.erb" />
|
||||||
|
<option value="$PROJECT_DIR$/app/views/origami/home/index.html.erb" />
|
||||||
|
<option value="$PROJECT_DIR$/app/views/origami/rooms/show.html.erb" />
|
||||||
|
<option value="$PROJECT_DIR$/app/views/origami/orders/show.html.erb" />
|
||||||
|
<option value="$PROJECT_DIR$/app/views/origami/sales/show.html.erb" />
|
||||||
</list>
|
</list>
|
||||||
</option>
|
</option>
|
||||||
</component>
|
</component>
|
||||||
@@ -168,6 +242,264 @@
|
|||||||
<option name="myItemId" value="" />
|
<option name="myItemId" value="" />
|
||||||
<option name="myItemType" value="" />
|
<option name="myItemType" value="" />
|
||||||
</PATH_ELEMENT>
|
</PATH_ELEMENT>
|
||||||
|
<PATH_ELEMENT USER_OBJECT="views">
|
||||||
|
<option name="myItemId" value="" />
|
||||||
|
<option name="myItemType" value="" />
|
||||||
|
</PATH_ELEMENT>
|
||||||
|
<PATH_ELEMENT USER_OBJECT="transactions">
|
||||||
|
<option name="myItemId" value="" />
|
||||||
|
<option name="myItemType" value="" />
|
||||||
|
</PATH_ELEMENT>
|
||||||
|
</PATH>
|
||||||
|
<PATH>
|
||||||
|
<PATH_ELEMENT USER_OBJECT="Root">
|
||||||
|
<option name="myItemId" value="" />
|
||||||
|
<option name="myItemType" value="" />
|
||||||
|
</PATH_ELEMENT>
|
||||||
|
<PATH_ELEMENT USER_OBJECT="sxrestaurant">
|
||||||
|
<option name="myItemId" value="" />
|
||||||
|
<option name="myItemType" value="" />
|
||||||
|
</PATH_ELEMENT>
|
||||||
|
<PATH_ELEMENT USER_OBJECT="app">
|
||||||
|
<option name="myItemId" value="" />
|
||||||
|
<option name="myItemType" value="" />
|
||||||
|
</PATH_ELEMENT>
|
||||||
|
<PATH_ELEMENT USER_OBJECT="views">
|
||||||
|
<option name="myItemId" value="" />
|
||||||
|
<option name="myItemType" value="" />
|
||||||
|
</PATH_ELEMENT>
|
||||||
|
</PATH>
|
||||||
|
<PATH>
|
||||||
|
<PATH_ELEMENT USER_OBJECT="Root">
|
||||||
|
<option name="myItemId" value="" />
|
||||||
|
<option name="myItemType" value="" />
|
||||||
|
</PATH_ELEMENT>
|
||||||
|
<PATH_ELEMENT USER_OBJECT="sxrestaurant">
|
||||||
|
<option name="myItemId" value="" />
|
||||||
|
<option name="myItemType" value="" />
|
||||||
|
</PATH_ELEMENT>
|
||||||
|
<PATH_ELEMENT USER_OBJECT="app">
|
||||||
|
<option name="myItemId" value="" />
|
||||||
|
<option name="myItemType" value="" />
|
||||||
|
</PATH_ELEMENT>
|
||||||
|
<PATH_ELEMENT USER_OBJECT="views">
|
||||||
|
<option name="myItemId" value="" />
|
||||||
|
<option name="myItemType" value="" />
|
||||||
|
</PATH_ELEMENT>
|
||||||
|
<PATH_ELEMENT USER_OBJECT="reports">
|
||||||
|
<option name="myItemId" value="" />
|
||||||
|
<option name="myItemType" value="" />
|
||||||
|
</PATH_ELEMENT>
|
||||||
|
</PATH>
|
||||||
|
<PATH>
|
||||||
|
<PATH_ELEMENT USER_OBJECT="Root">
|
||||||
|
<option name="myItemId" value="" />
|
||||||
|
<option name="myItemType" value="" />
|
||||||
|
</PATH_ELEMENT>
|
||||||
|
<PATH_ELEMENT USER_OBJECT="sxrestaurant">
|
||||||
|
<option name="myItemId" value="" />
|
||||||
|
<option name="myItemType" value="" />
|
||||||
|
</PATH_ELEMENT>
|
||||||
|
<PATH_ELEMENT USER_OBJECT="app">
|
||||||
|
<option name="myItemId" value="" />
|
||||||
|
<option name="myItemType" value="" />
|
||||||
|
</PATH_ELEMENT>
|
||||||
|
<PATH_ELEMENT USER_OBJECT="views">
|
||||||
|
<option name="myItemId" value="" />
|
||||||
|
<option name="myItemType" value="" />
|
||||||
|
</PATH_ELEMENT>
|
||||||
|
<PATH_ELEMENT USER_OBJECT="origami">
|
||||||
|
<option name="myItemId" value="" />
|
||||||
|
<option name="myItemType" value="" />
|
||||||
|
</PATH_ELEMENT>
|
||||||
|
</PATH>
|
||||||
|
<PATH>
|
||||||
|
<PATH_ELEMENT USER_OBJECT="Root">
|
||||||
|
<option name="myItemId" value="" />
|
||||||
|
<option name="myItemType" value="" />
|
||||||
|
</PATH_ELEMENT>
|
||||||
|
<PATH_ELEMENT USER_OBJECT="sxrestaurant">
|
||||||
|
<option name="myItemId" value="" />
|
||||||
|
<option name="myItemType" value="" />
|
||||||
|
</PATH_ELEMENT>
|
||||||
|
<PATH_ELEMENT USER_OBJECT="app">
|
||||||
|
<option name="myItemId" value="" />
|
||||||
|
<option name="myItemType" value="" />
|
||||||
|
</PATH_ELEMENT>
|
||||||
|
<PATH_ELEMENT USER_OBJECT="views">
|
||||||
|
<option name="myItemId" value="" />
|
||||||
|
<option name="myItemType" value="" />
|
||||||
|
</PATH_ELEMENT>
|
||||||
|
<PATH_ELEMENT USER_OBJECT="origami">
|
||||||
|
<option name="myItemId" value="" />
|
||||||
|
<option name="myItemType" value="" />
|
||||||
|
</PATH_ELEMENT>
|
||||||
|
<PATH_ELEMENT USER_OBJECT="table_invoices">
|
||||||
|
<option name="myItemId" value="" />
|
||||||
|
<option name="myItemType" value="" />
|
||||||
|
</PATH_ELEMENT>
|
||||||
|
</PATH>
|
||||||
|
<PATH>
|
||||||
|
<PATH_ELEMENT USER_OBJECT="Root">
|
||||||
|
<option name="myItemId" value="" />
|
||||||
|
<option name="myItemType" value="" />
|
||||||
|
</PATH_ELEMENT>
|
||||||
|
<PATH_ELEMENT USER_OBJECT="sxrestaurant">
|
||||||
|
<option name="myItemId" value="" />
|
||||||
|
<option name="myItemType" value="" />
|
||||||
|
</PATH_ELEMENT>
|
||||||
|
<PATH_ELEMENT USER_OBJECT="app">
|
||||||
|
<option name="myItemId" value="" />
|
||||||
|
<option name="myItemType" value="" />
|
||||||
|
</PATH_ELEMENT>
|
||||||
|
<PATH_ELEMENT USER_OBJECT="views">
|
||||||
|
<option name="myItemId" value="" />
|
||||||
|
<option name="myItemType" value="" />
|
||||||
|
</PATH_ELEMENT>
|
||||||
|
<PATH_ELEMENT USER_OBJECT="origami">
|
||||||
|
<option name="myItemId" value="" />
|
||||||
|
<option name="myItemType" value="" />
|
||||||
|
</PATH_ELEMENT>
|
||||||
|
<PATH_ELEMENT USER_OBJECT="sales">
|
||||||
|
<option name="myItemId" value="" />
|
||||||
|
<option name="myItemType" value="" />
|
||||||
|
</PATH_ELEMENT>
|
||||||
|
</PATH>
|
||||||
|
<PATH>
|
||||||
|
<PATH_ELEMENT USER_OBJECT="Root">
|
||||||
|
<option name="myItemId" value="" />
|
||||||
|
<option name="myItemType" value="" />
|
||||||
|
</PATH_ELEMENT>
|
||||||
|
<PATH_ELEMENT USER_OBJECT="sxrestaurant">
|
||||||
|
<option name="myItemId" value="" />
|
||||||
|
<option name="myItemType" value="" />
|
||||||
|
</PATH_ELEMENT>
|
||||||
|
<PATH_ELEMENT USER_OBJECT="app">
|
||||||
|
<option name="myItemId" value="" />
|
||||||
|
<option name="myItemType" value="" />
|
||||||
|
</PATH_ELEMENT>
|
||||||
|
<PATH_ELEMENT USER_OBJECT="views">
|
||||||
|
<option name="myItemId" value="" />
|
||||||
|
<option name="myItemType" value="" />
|
||||||
|
</PATH_ELEMENT>
|
||||||
|
<PATH_ELEMENT USER_OBJECT="origami">
|
||||||
|
<option name="myItemId" value="" />
|
||||||
|
<option name="myItemType" value="" />
|
||||||
|
</PATH_ELEMENT>
|
||||||
|
<PATH_ELEMENT USER_OBJECT="rooms">
|
||||||
|
<option name="myItemId" value="" />
|
||||||
|
<option name="myItemType" value="" />
|
||||||
|
</PATH_ELEMENT>
|
||||||
|
</PATH>
|
||||||
|
<PATH>
|
||||||
|
<PATH_ELEMENT USER_OBJECT="Root">
|
||||||
|
<option name="myItemId" value="" />
|
||||||
|
<option name="myItemType" value="" />
|
||||||
|
</PATH_ELEMENT>
|
||||||
|
<PATH_ELEMENT USER_OBJECT="sxrestaurant">
|
||||||
|
<option name="myItemId" value="" />
|
||||||
|
<option name="myItemType" value="" />
|
||||||
|
</PATH_ELEMENT>
|
||||||
|
<PATH_ELEMENT USER_OBJECT="app">
|
||||||
|
<option name="myItemId" value="" />
|
||||||
|
<option name="myItemType" value="" />
|
||||||
|
</PATH_ELEMENT>
|
||||||
|
<PATH_ELEMENT USER_OBJECT="views">
|
||||||
|
<option name="myItemId" value="" />
|
||||||
|
<option name="myItemType" value="" />
|
||||||
|
</PATH_ELEMENT>
|
||||||
|
<PATH_ELEMENT USER_OBJECT="origami">
|
||||||
|
<option name="myItemId" value="" />
|
||||||
|
<option name="myItemType" value="" />
|
||||||
|
</PATH_ELEMENT>
|
||||||
|
<PATH_ELEMENT USER_OBJECT="payments">
|
||||||
|
<option name="myItemId" value="" />
|
||||||
|
<option name="myItemType" value="" />
|
||||||
|
</PATH_ELEMENT>
|
||||||
|
</PATH>
|
||||||
|
<PATH>
|
||||||
|
<PATH_ELEMENT USER_OBJECT="Root">
|
||||||
|
<option name="myItemId" value="" />
|
||||||
|
<option name="myItemType" value="" />
|
||||||
|
</PATH_ELEMENT>
|
||||||
|
<PATH_ELEMENT USER_OBJECT="sxrestaurant">
|
||||||
|
<option name="myItemId" value="" />
|
||||||
|
<option name="myItemType" value="" />
|
||||||
|
</PATH_ELEMENT>
|
||||||
|
<PATH_ELEMENT USER_OBJECT="app">
|
||||||
|
<option name="myItemId" value="" />
|
||||||
|
<option name="myItemType" value="" />
|
||||||
|
</PATH_ELEMENT>
|
||||||
|
<PATH_ELEMENT USER_OBJECT="views">
|
||||||
|
<option name="myItemId" value="" />
|
||||||
|
<option name="myItemType" value="" />
|
||||||
|
</PATH_ELEMENT>
|
||||||
|
<PATH_ELEMENT USER_OBJECT="origami">
|
||||||
|
<option name="myItemId" value="" />
|
||||||
|
<option name="myItemType" value="" />
|
||||||
|
</PATH_ELEMENT>
|
||||||
|
<PATH_ELEMENT USER_OBJECT="orders">
|
||||||
|
<option name="myItemId" value="" />
|
||||||
|
<option name="myItemType" value="" />
|
||||||
|
</PATH_ELEMENT>
|
||||||
|
</PATH>
|
||||||
|
<PATH>
|
||||||
|
<PATH_ELEMENT USER_OBJECT="Root">
|
||||||
|
<option name="myItemId" value="" />
|
||||||
|
<option name="myItemType" value="" />
|
||||||
|
</PATH_ELEMENT>
|
||||||
|
<PATH_ELEMENT USER_OBJECT="sxrestaurant">
|
||||||
|
<option name="myItemId" value="" />
|
||||||
|
<option name="myItemType" value="" />
|
||||||
|
</PATH_ELEMENT>
|
||||||
|
<PATH_ELEMENT USER_OBJECT="app">
|
||||||
|
<option name="myItemId" value="" />
|
||||||
|
<option name="myItemType" value="" />
|
||||||
|
</PATH_ELEMENT>
|
||||||
|
<PATH_ELEMENT USER_OBJECT="views">
|
||||||
|
<option name="myItemId" value="" />
|
||||||
|
<option name="myItemType" value="" />
|
||||||
|
</PATH_ELEMENT>
|
||||||
|
<PATH_ELEMENT USER_OBJECT="origami">
|
||||||
|
<option name="myItemId" value="" />
|
||||||
|
<option name="myItemType" value="" />
|
||||||
|
</PATH_ELEMENT>
|
||||||
|
<PATH_ELEMENT USER_OBJECT="home">
|
||||||
|
<option name="myItemId" value="" />
|
||||||
|
<option name="myItemType" value="" />
|
||||||
|
</PATH_ELEMENT>
|
||||||
|
</PATH>
|
||||||
|
<PATH>
|
||||||
|
<PATH_ELEMENT USER_OBJECT="Root">
|
||||||
|
<option name="myItemId" value="" />
|
||||||
|
<option name="myItemType" value="" />
|
||||||
|
</PATH_ELEMENT>
|
||||||
|
<PATH_ELEMENT USER_OBJECT="sxrestaurant">
|
||||||
|
<option name="myItemId" value="" />
|
||||||
|
<option name="myItemType" value="" />
|
||||||
|
</PATH_ELEMENT>
|
||||||
|
<PATH_ELEMENT USER_OBJECT="app">
|
||||||
|
<option name="myItemId" value="" />
|
||||||
|
<option name="myItemType" value="" />
|
||||||
|
</PATH_ELEMENT>
|
||||||
|
</PATH>
|
||||||
|
<PATH>
|
||||||
|
<PATH_ELEMENT USER_OBJECT="Root">
|
||||||
|
<option name="myItemId" value="" />
|
||||||
|
<option name="myItemType" value="" />
|
||||||
|
</PATH_ELEMENT>
|
||||||
|
<PATH_ELEMENT USER_OBJECT="sxrestaurant">
|
||||||
|
<option name="myItemId" value="" />
|
||||||
|
<option name="myItemType" value="" />
|
||||||
|
</PATH_ELEMENT>
|
||||||
|
<PATH_ELEMENT USER_OBJECT="app">
|
||||||
|
<option name="myItemId" value="" />
|
||||||
|
<option name="myItemType" value="" />
|
||||||
|
</PATH_ELEMENT>
|
||||||
|
<PATH_ELEMENT USER_OBJECT="models">
|
||||||
|
<option name="myItemId" value="" />
|
||||||
|
<option name="myItemType" value="" />
|
||||||
|
</PATH_ELEMENT>
|
||||||
</PATH>
|
</PATH>
|
||||||
<PATH>
|
<PATH>
|
||||||
<PATH_ELEMENT USER_OBJECT="Root">
|
<PATH_ELEMENT USER_OBJECT="Root">
|
||||||
@@ -209,6 +541,28 @@
|
|||||||
<option name="myItemType" value="" />
|
<option name="myItemType" value="" />
|
||||||
</PATH_ELEMENT>
|
</PATH_ELEMENT>
|
||||||
</PATH>
|
</PATH>
|
||||||
|
<PATH>
|
||||||
|
<PATH_ELEMENT USER_OBJECT="Root">
|
||||||
|
<option name="myItemId" value="" />
|
||||||
|
<option name="myItemType" value="" />
|
||||||
|
</PATH_ELEMENT>
|
||||||
|
<PATH_ELEMENT USER_OBJECT="sxrestaurant">
|
||||||
|
<option name="myItemId" value="" />
|
||||||
|
<option name="myItemType" value="" />
|
||||||
|
</PATH_ELEMENT>
|
||||||
|
<PATH_ELEMENT USER_OBJECT="app">
|
||||||
|
<option name="myItemId" value="" />
|
||||||
|
<option name="myItemType" value="" />
|
||||||
|
</PATH_ELEMENT>
|
||||||
|
<PATH_ELEMENT USER_OBJECT="controllers">
|
||||||
|
<option name="myItemId" value="" />
|
||||||
|
<option name="myItemType" value="" />
|
||||||
|
</PATH_ELEMENT>
|
||||||
|
<PATH_ELEMENT USER_OBJECT="api">
|
||||||
|
<option name="myItemId" value="" />
|
||||||
|
<option name="myItemType" value="" />
|
||||||
|
</PATH_ELEMENT>
|
||||||
|
</PATH>
|
||||||
</subPane>
|
</subPane>
|
||||||
</pane>
|
</pane>
|
||||||
<pane id="Scratches" />
|
<pane id="Scratches" />
|
||||||
@@ -553,12 +907,12 @@
|
|||||||
<option name="presentableId" value="Default" />
|
<option name="presentableId" value="Default" />
|
||||||
<updated>1498458293643</updated>
|
<updated>1498458293643</updated>
|
||||||
<workItem from="1498458295318" duration="2552000" />
|
<workItem from="1498458295318" duration="2552000" />
|
||||||
<workItem from="1498465879846" duration="9435000" />
|
<workItem from="1498465879846" duration="18792000" />
|
||||||
</task>
|
</task>
|
||||||
<servers />
|
<servers />
|
||||||
</component>
|
</component>
|
||||||
<component name="TimeTrackingManager">
|
<component name="TimeTrackingManager">
|
||||||
<option name="totallyTimeSpent" value="11987000" />
|
<option name="totallyTimeSpent" value="21344000" />
|
||||||
</component>
|
</component>
|
||||||
<component name="ToolWindowManager">
|
<component name="ToolWindowManager">
|
||||||
<frame x="0" y="22" width="1440" height="833" extended-state="6" />
|
<frame x="0" y="22" width="1440" height="833" extended-state="6" />
|
||||||
@@ -672,38 +1026,6 @@
|
|||||||
</state>
|
</state>
|
||||||
</provider>
|
</provider>
|
||||||
</entry>
|
</entry>
|
||||||
<entry file="file://$PROJECT_DIR$/app/views/origami/sales/show.html.erb">
|
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
|
||||||
<state relative-caret-position="0">
|
|
||||||
<caret line="0" column="0" lean-forward="false" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
|
|
||||||
<folding />
|
|
||||||
</state>
|
|
||||||
</provider>
|
|
||||||
</entry>
|
|
||||||
<entry file="file://$PROJECT_DIR$/app/views/origami/orders/show.html.erb">
|
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
|
||||||
<state relative-caret-position="-609">
|
|
||||||
<caret line="135" column="51" lean-forward="true" selection-start-line="135" selection-start-column="51" selection-end-line="135" selection-end-column="51" />
|
|
||||||
<folding />
|
|
||||||
</state>
|
|
||||||
</provider>
|
|
||||||
</entry>
|
|
||||||
<entry file="file://$PROJECT_DIR$/app/views/origami/home/index.html.erb">
|
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
|
||||||
<state relative-caret-position="-171">
|
|
||||||
<caret line="0" column="0" lean-forward="false" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
|
|
||||||
<folding />
|
|
||||||
</state>
|
|
||||||
</provider>
|
|
||||||
</entry>
|
|
||||||
<entry file="file://$PROJECT_DIR$/app/models/sale_payment.rb">
|
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
|
||||||
<state relative-caret-position="5">
|
|
||||||
<caret line="10" column="6" lean-forward="false" selection-start-line="10" selection-start-column="6" selection-end-line="10" selection-end-column="6" />
|
|
||||||
<folding />
|
|
||||||
</state>
|
|
||||||
</provider>
|
|
||||||
</entry>
|
|
||||||
<entry file="file://$PROJECT_DIR$/app/controllers/origami/master_controller.rb">
|
<entry file="file://$PROJECT_DIR$/app/controllers/origami/master_controller.rb">
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
<state relative-caret-position="0">
|
<state relative-caret-position="0">
|
||||||
@@ -712,22 +1034,6 @@
|
|||||||
</state>
|
</state>
|
||||||
</provider>
|
</provider>
|
||||||
</entry>
|
</entry>
|
||||||
<entry file="file://$PROJECT_DIR$/app/controllers/origami/sales_controller.rb">
|
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
|
||||||
<state relative-caret-position="510">
|
|
||||||
<caret line="34" column="35" lean-forward="true" selection-start-line="34" selection-start-column="35" selection-end-line="34" selection-end-column="35" />
|
|
||||||
<folding />
|
|
||||||
</state>
|
|
||||||
</provider>
|
|
||||||
</entry>
|
|
||||||
<entry file="file://$PROJECT_DIR$/app/models/sale_audit.rb">
|
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
|
||||||
<state relative-caret-position="268">
|
|
||||||
<caret line="57" column="11" lean-forward="false" selection-start-line="57" selection-start-column="11" selection-end-line="57" selection-end-column="11" />
|
|
||||||
<folding />
|
|
||||||
</state>
|
|
||||||
</provider>
|
|
||||||
</entry>
|
|
||||||
<entry file="file://$PROJECT_DIR$/app/models/dining_facility.rb">
|
<entry file="file://$PROJECT_DIR$/app/models/dining_facility.rb">
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
<state relative-caret-position="285">
|
<state relative-caret-position="285">
|
||||||
@@ -760,16 +1066,27 @@
|
|||||||
</state>
|
</state>
|
||||||
</provider>
|
</provider>
|
||||||
</entry>
|
</entry>
|
||||||
<entry file="file://$PROJECT_DIR$/app/controllers/origami/payments_controller.rb">
|
<entry file="file://$PROJECT_DIR$/app/models/printer/receipt_printer.rb">
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
<state relative-caret-position="266">
|
<state relative-caret-position="327">
|
||||||
<caret line="65" column="35" lean-forward="false" selection-start-line="65" selection-start-column="35" selection-end-line="65" selection-end-column="35" />
|
<caret line="74" column="38" lean-forward="true" selection-start-line="74" selection-start-column="38" selection-end-line="74" selection-end-column="38" />
|
||||||
<folding>
|
<folding />
|
||||||
<marker date="1498476660000" expanded="true" signature="2556:2593" ph="if ... end" />
|
</state>
|
||||||
<marker date="1498476660000" expanded="true" signature="2556:2603" ph="do ... end" />
|
</provider>
|
||||||
<marker date="1498476660000" expanded="true" signature="2556:2611" ph="if ... end" />
|
</entry>
|
||||||
<marker date="1498476660000" expanded="true" signature="2556:2617" ph=" ... end" />
|
<entry file="file://$PROJECT_DIR$/app/controllers/origami/request_bills_controller.rb">
|
||||||
</folding>
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
|
<state relative-caret-position="180">
|
||||||
|
<caret line="12" column="35" lean-forward="true" selection-start-line="12" selection-start-column="35" selection-end-line="12" selection-end-column="35" />
|
||||||
|
<folding />
|
||||||
|
</state>
|
||||||
|
</provider>
|
||||||
|
</entry>
|
||||||
|
<entry file="file://$PROJECT_DIR$/app/controllers/api/bill_controller.rb">
|
||||||
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
|
<state relative-caret-position="330">
|
||||||
|
<caret line="22" column="29" lean-forward="false" selection-start-line="22" selection-start-column="29" selection-end-line="22" selection-end-column="29" />
|
||||||
|
<folding />
|
||||||
</state>
|
</state>
|
||||||
</provider>
|
</provider>
|
||||||
</entry>
|
</entry>
|
||||||
@@ -781,34 +1098,162 @@
|
|||||||
</state>
|
</state>
|
||||||
</provider>
|
</provider>
|
||||||
</entry>
|
</entry>
|
||||||
<entry file="file://$PROJECT_DIR$/app/controllers/origami/home_controller.rb">
|
<entry file="file://$PROJECT_DIR$/app/controllers/origami/sales_controller.rb">
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
<state relative-caret-position="387">
|
<state relative-caret-position="0">
|
||||||
<caret line="40" column="40" lean-forward="false" selection-start-line="40" selection-start-column="40" selection-end-line="40" selection-end-column="40" />
|
<caret line="0" column="0" lean-forward="false" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
|
||||||
<folding />
|
<folding />
|
||||||
</state>
|
</state>
|
||||||
</provider>
|
</provider>
|
||||||
</entry>
|
</entry>
|
||||||
<entry file="file://$PROJECT_DIR$/app/views/origami/home/show.html.erb">
|
<entry file="file://$PROJECT_DIR$/app/controllers/origami/table_invoices_controller.rb">
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
<state relative-caret-position="920">
|
<state relative-caret-position="255">
|
||||||
<caret line="491" column="0" lean-forward="false" selection-start-line="491" selection-start-column="0" selection-end-line="491" selection-end-column="0" />
|
<caret line="17" column="7" lean-forward="true" selection-start-line="17" selection-start-column="7" selection-end-line="17" selection-end-column="7" />
|
||||||
<folding />
|
<folding />
|
||||||
</state>
|
</state>
|
||||||
</provider>
|
</provider>
|
||||||
</entry>
|
</entry>
|
||||||
<entry file="file://$PROJECT_DIR$/config/routes.rb">
|
<entry file="file://$PROJECT_DIR$/config/routes.rb">
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
<state relative-caret-position="459">
|
<state relative-caret-position="550">
|
||||||
<caret line="127" column="25" lean-forward="true" selection-start-line="127" selection-start-column="25" selection-end-line="127" selection-end-column="25" />
|
<caret line="120" column="47" lean-forward="false" selection-start-line="120" selection-start-column="47" selection-end-line="120" selection-end-column="47" />
|
||||||
|
<folding />
|
||||||
|
</state>
|
||||||
|
</provider>
|
||||||
|
</entry>
|
||||||
|
<entry file="file://$PROJECT_DIR$/app/controllers/origami/payments_controller.rb">
|
||||||
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
|
<state relative-caret-position="150">
|
||||||
|
<caret line="10" column="34" lean-forward="false" selection-start-line="10" selection-start-column="34" selection-end-line="10" selection-end-column="34" />
|
||||||
|
<folding />
|
||||||
|
</state>
|
||||||
|
</provider>
|
||||||
|
</entry>
|
||||||
|
<entry file="file://$PROJECT_DIR$/app/models/sale_payment.rb">
|
||||||
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
|
<state relative-caret-position="411">
|
||||||
|
<caret line="60" column="34" lean-forward="false" selection-start-line="60" selection-start-column="34" selection-end-line="60" selection-end-column="34" />
|
||||||
|
<folding />
|
||||||
|
</state>
|
||||||
|
</provider>
|
||||||
|
</entry>
|
||||||
|
<entry file="file://$PROJECT_DIR$/app/models/sale_audit.rb">
|
||||||
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
|
<state relative-caret-position="432">
|
||||||
|
<caret line="57" column="11" lean-forward="false" selection-start-line="57" selection-start-column="11" selection-end-line="57" selection-end-column="11" />
|
||||||
<folding />
|
<folding />
|
||||||
</state>
|
</state>
|
||||||
</provider>
|
</provider>
|
||||||
</entry>
|
</entry>
|
||||||
<entry file="file://$PROJECT_DIR$/app/controllers/origami/void_controller.rb">
|
<entry file="file://$PROJECT_DIR$/app/controllers/origami/void_controller.rb">
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
<state relative-caret-position="375">
|
<state relative-caret-position="270">
|
||||||
<caret line="25" column="5" lean-forward="true" selection-start-line="25" selection-start-column="5" selection-end-line="25" selection-end-column="5" />
|
<caret line="18" column="0" lean-forward="false" selection-start-line="18" selection-start-column="0" selection-end-line="18" selection-end-column="0" />
|
||||||
|
<folding />
|
||||||
|
</state>
|
||||||
|
</provider>
|
||||||
|
</entry>
|
||||||
|
<entry file="file://$PROJECT_DIR$/app/controllers/origami/home_controller.rb">
|
||||||
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
|
<state relative-caret-position="292">
|
||||||
|
<caret line="27" column="42" lean-forward="true" selection-start-line="27" selection-start-column="42" selection-end-line="27" selection-end-column="42" />
|
||||||
|
<folding />
|
||||||
|
</state>
|
||||||
|
</provider>
|
||||||
|
</entry>
|
||||||
|
<entry file="file://$PROJECT_DIR$/app/views/origami/payments/show.html.erb">
|
||||||
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
|
<state relative-caret-position="399">
|
||||||
|
<caret line="359" column="43" lean-forward="false" selection-start-line="359" selection-start-column="43" selection-end-line="359" selection-end-column="43" />
|
||||||
|
<folding />
|
||||||
|
</state>
|
||||||
|
</provider>
|
||||||
|
</entry>
|
||||||
|
<entry file="file://$PROJECT_DIR$/app/views/origami/home/index.html.erb">
|
||||||
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
|
<state relative-caret-position="420">
|
||||||
|
<caret line="28" column="36" lean-forward="true" selection-start-line="28" selection-start-column="36" selection-end-line="28" selection-end-column="36" />
|
||||||
|
<folding>
|
||||||
|
<element signature="n#style#0;n#div#0;n#div#0;n#div#0;n#div#0;n#div#0;n#!!top" expanded="true" />
|
||||||
|
</folding>
|
||||||
|
</state>
|
||||||
|
</provider>
|
||||||
|
</entry>
|
||||||
|
<entry file="file://$PROJECT_DIR$/app/views/origami/table_invoices/show.html.erb">
|
||||||
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
|
<state relative-caret-position="2160">
|
||||||
|
<caret line="144" column="16" lean-forward="false" selection-start-line="144" selection-start-column="16" selection-end-line="144" selection-end-column="16" />
|
||||||
|
<folding />
|
||||||
|
</state>
|
||||||
|
</provider>
|
||||||
|
</entry>
|
||||||
|
<entry file="file://$PROJECT_DIR$/app/views/origami/home/show.html.erb">
|
||||||
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
|
<state relative-caret-position="30">
|
||||||
|
<caret line="2" column="0" lean-forward="false" selection-start-line="2" selection-start-column="0" selection-end-line="2" selection-end-column="0" />
|
||||||
|
<folding />
|
||||||
|
</state>
|
||||||
|
</provider>
|
||||||
|
</entry>
|
||||||
|
<entry file="file://$PROJECT_DIR$/app/views/origami/rooms/show.html.erb">
|
||||||
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
|
<state relative-caret-position="420">
|
||||||
|
<caret line="28" column="128" lean-forward="false" selection-start-line="28" selection-start-column="128" selection-end-line="28" selection-end-column="128" />
|
||||||
|
<folding />
|
||||||
|
</state>
|
||||||
|
</provider>
|
||||||
|
</entry>
|
||||||
|
<entry file="file://$PROJECT_DIR$/app/views/origami/orders/show.html.erb">
|
||||||
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
|
<state relative-caret-position="420">
|
||||||
|
<caret line="28" column="128" lean-forward="false" selection-start-line="28" selection-start-column="128" selection-end-line="28" selection-end-column="128" />
|
||||||
|
<folding>
|
||||||
|
<marker date="1498539948000" expanded="true" signature="3450:4239" ph="do ... end" />
|
||||||
|
<marker date="1498539948000" expanded="true" signature="3598:4131" ph="<%...%>" />
|
||||||
|
<marker date="1498539948000" expanded="true" signature="3714:4114" ph="if ... end" />
|
||||||
|
<marker date="1498539948000" expanded="true" signature="4005:4027" ph="if ... end" />
|
||||||
|
<marker date="1498539948000" expanded="true" signature="4395:6842" ph="..." />
|
||||||
|
<marker date="1498539948000" expanded="true" signature="4419:6833" ph="..." />
|
||||||
|
<marker date="1498539948000" expanded="true" signature="4454:4539" ph="..." />
|
||||||
|
<marker date="1498539948000" expanded="true" signature="4571:6821" ph="..." />
|
||||||
|
<marker date="1498539948000" expanded="true" signature="4609:5000" ph="..." />
|
||||||
|
<marker date="1498539948000" expanded="true" signature="4661:4756" ph="..." />
|
||||||
|
<marker date="1498539948000" expanded="true" signature="4678:4738" ph="..." />
|
||||||
|
<marker date="1498539948000" expanded="true" signature="4713:4734" ph="..." />
|
||||||
|
<marker date="1498539948000" expanded="true" signature="4819:4984" ph="..." />
|
||||||
|
<marker date="1498539948000" expanded="true" signature="5059:5210" ph="..." />
|
||||||
|
<marker date="1498539948000" expanded="true" signature="5111:5193" ph="..." />
|
||||||
|
<marker date="1498539948000" expanded="true" signature="5243:6180" ph="..." />
|
||||||
|
<marker date="1498539948000" expanded="true" signature="5313:6164" ph="..." />
|
||||||
|
<marker date="1498539948000" expanded="true" signature="5334:5545" ph="..." />
|
||||||
|
<marker date="1498539948000" expanded="true" signature="5354:5523" ph="..." />
|
||||||
|
<marker date="1498539948000" expanded="true" signature="5566:6144" ph="..." />
|
||||||
|
<marker date="1498539948000" expanded="true" signature="5583:5749" ph="<%...%>" />
|
||||||
|
<marker date="1498539948000" expanded="true" signature="5817:6041" ph="..." />
|
||||||
|
<marker date="1498539948000" expanded="true" signature="6058:6123" ph="<%...%>" />
|
||||||
|
<marker date="1498539948000" expanded="true" signature="6215:6807" ph="..." />
|
||||||
|
<marker date="1498539948000" expanded="true" signature="6284:6791" ph="..." />
|
||||||
|
<marker date="1498539948000" expanded="true" signature="6302:6491" ph="..." />
|
||||||
|
<marker date="1498539948000" expanded="true" signature="6509:6725" ph="..." />
|
||||||
|
<marker date="1498539948000" expanded="true" signature="6908:7237" ph="..." />
|
||||||
|
<marker date="1498539948000" expanded="true" signature="6999:7127" ph="if ... end" />
|
||||||
|
<marker date="1498539948000" expanded="true" signature="7253:8136" ph="..." />
|
||||||
|
<marker date="1498539948000" expanded="true" signature="7283:7870" ph="{...}" />
|
||||||
|
<marker date="1498539948000" expanded="true" signature="7322:7434" ph="{...}" />
|
||||||
|
<marker date="1498539948000" expanded="true" signature="7471:7574" ph="{...}" />
|
||||||
|
<marker date="1498539948000" expanded="true" signature="7612:7723" ph="{...}" />
|
||||||
|
<marker date="1498539948000" expanded="true" signature="7761:7867" ph="{...}" />
|
||||||
|
<marker date="1498539948000" expanded="true" signature="7905:8012" ph="{...}" />
|
||||||
|
<marker date="1498539948000" expanded="true" signature="8047:8088" ph="{...}" />
|
||||||
|
</folding>
|
||||||
|
</state>
|
||||||
|
</provider>
|
||||||
|
</entry>
|
||||||
|
<entry file="file://$PROJECT_DIR$/app/views/origami/sales/show.html.erb">
|
||||||
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
|
<state relative-caret-position="249">
|
||||||
|
<caret line="139" column="30" lean-forward="true" selection-start-line="139" selection-start-column="30" selection-end-line="139" selection-end-column="30" />
|
||||||
<folding />
|
<folding />
|
||||||
</state>
|
</state>
|
||||||
</provider>
|
</provider>
|
||||||
|
|||||||
5
Gemfile
5
Gemfile
@@ -9,10 +9,13 @@ end
|
|||||||
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
|
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
|
||||||
gem 'rails', '~> 5.1.0'
|
gem 'rails', '~> 5.1.0'
|
||||||
# Use mysql as the database for Active Record
|
# Use mysql as the database for Active Record
|
||||||
|
|
||||||
|
#gem 'mysql2', '>= 0.3.18', '< 0.5'
|
||||||
|
gem 'pg'
|
||||||
gem 'mysql2', '>= 0.3.18', '< 0.5'
|
gem 'mysql2', '>= 0.3.18', '< 0.5'
|
||||||
|
|
||||||
#Use PosgreSQL
|
#Use PosgreSQL
|
||||||
gem 'pg'
|
|
||||||
|
|
||||||
# redis server for cable
|
# redis server for cable
|
||||||
# gem 'redis', '~> 3.0'
|
# gem 'redis', '~> 3.0'
|
||||||
|
|||||||
3
app/assets/javascripts/reports/dailysale.coffee
Normal file
3
app/assets/javascripts/reports/dailysale.coffee
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
# Place all the behaviors and hooks related to the matching controller here.
|
||||||
|
# All this logic will automatically be available in application.js.
|
||||||
|
# You can use CoffeeScript in this file: http://coffeescript.org/
|
||||||
3
app/assets/javascripts/reports/saleitem.coffee
Normal file
3
app/assets/javascripts/reports/saleitem.coffee
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
# Place all the behaviors and hooks related to the matching controller here.
|
||||||
|
# All this logic will automatically be available in application.js.
|
||||||
|
# You can use CoffeeScript in this file: http://coffeescript.org/
|
||||||
3
app/assets/javascripts/reports/shiftsale.coffee
Normal file
3
app/assets/javascripts/reports/shiftsale.coffee
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
# Place all the behaviors and hooks related to the matching controller here.
|
||||||
|
# All this logic will automatically be available in application.js.
|
||||||
|
# You can use CoffeeScript in this file: http://coffeescript.org/
|
||||||
@@ -13,27 +13,43 @@
|
|||||||
|
|
||||||
.selected-item {
|
.selected-item {
|
||||||
color: #fff !important;
|
color: #fff !important;
|
||||||
background-color: #ccc !important;
|
background-color: #7a62d3 !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
.assign {
|
.assign {
|
||||||
color: #fff !important;
|
color: #fff !important;
|
||||||
background-color: red;
|
background-color: #009900;
|
||||||
}
|
}
|
||||||
.assign .text-muted{
|
.assign .text-muted{
|
||||||
color: #fff !important;
|
color: #fff !important;
|
||||||
}
|
}
|
||||||
|
.normal{
|
||||||
|
color: #fff !important;
|
||||||
|
background-color: #54A5AF;
|
||||||
|
}
|
||||||
|
.cancel {
|
||||||
|
color: #fff !important;
|
||||||
|
background-color: #FF0000;
|
||||||
|
}
|
||||||
.red{
|
.red{
|
||||||
color: #fff !important;
|
color: #fff !important;
|
||||||
background-color: red;
|
background-color: red;
|
||||||
}
|
}
|
||||||
.green{
|
.green{
|
||||||
color: #fff !important;
|
color: #fff !important;
|
||||||
background-color: green;
|
background-color: #009900;
|
||||||
}
|
}
|
||||||
.required abbr{
|
.required abbr{
|
||||||
color: red !important;
|
color: red !important;
|
||||||
}
|
}
|
||||||
.jconfirm-box-container{
|
.jconfirm-box-container{
|
||||||
margin-left:-40px !important
|
margin-left:-40px !important
|
||||||
|
}
|
||||||
|
.card-columns {
|
||||||
|
@include media-breakpoint-only(lg) {
|
||||||
|
column-count: 5;
|
||||||
|
}
|
||||||
|
@include media-breakpoint-only(xl) {
|
||||||
|
column-count: 5;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -1,3 +1,3 @@
|
|||||||
// Place all the styles related to the reports/dailysales controller here.
|
// Place all the styles related to the cash_mgmt controller here.
|
||||||
// They will automatically be included in application.css.
|
// They will automatically be included in application.css.
|
||||||
// You can use Sass (SCSS) here: http://sass-lang.com/
|
// You can use Sass (SCSS) here: http://sass-lang.com/
|
||||||
@@ -72,6 +72,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.action-btn {
|
.action-btn {
|
||||||
|
white-space: normal !important;
|
||||||
height: 60px;
|
height: 60px;
|
||||||
margin-bottom: 5px;
|
margin-bottom: 5px;
|
||||||
}
|
}
|
||||||
@@ -168,6 +169,8 @@
|
|||||||
background-color: blue
|
background-color: blue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* End Colors */
|
||||||
|
|
||||||
.left{
|
.left{
|
||||||
margin-left:1px;
|
margin-left:1px;
|
||||||
}
|
}
|
||||||
@@ -175,6 +178,7 @@
|
|||||||
.bottom{
|
.bottom{
|
||||||
margin-bottom: 1px;
|
margin-bottom: 1px;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*----- Reset -----*/
|
/*----- Reset -----*/
|
||||||
|
|
||||||
select.form-control {
|
select.form-control {
|
||||||
@@ -197,6 +201,7 @@ tr.discount-item-row:hover {
|
|||||||
.required abbr{
|
.required abbr{
|
||||||
color: red !important;
|
color: red !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Jquery Confirm */
|
/* Jquery Confirm */
|
||||||
|
|
||||||
.jconfirm-box-container{
|
.jconfirm-box-container{
|
||||||
|
|||||||
@@ -1,3 +1,3 @@
|
|||||||
// Place all the styles related to the reports/sale_items controller here.
|
// Place all the styles related to the origami/shifts controller here.
|
||||||
// They will automatically be included in application.css.
|
// They will automatically be included in application.css.
|
||||||
// You can use Sass (SCSS) here: http://sass-lang.com/
|
// You can use Sass (SCSS) here: http://sass-lang.com/
|
||||||
3
app/assets/stylesheets/reports/dailysale.scss
Normal file
3
app/assets/stylesheets/reports/dailysale.scss
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
// Place all the styles related to the reports/dailysale controller here.
|
||||||
|
// They will automatically be included in application.css.
|
||||||
|
// You can use Sass (SCSS) here: http://sass-lang.com/
|
||||||
3
app/assets/stylesheets/reports/saleitem.scss
Normal file
3
app/assets/stylesheets/reports/saleitem.scss
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
// Place all the styles related to the reports/saleitem controller here.
|
||||||
|
// They will automatically be included in application.css.
|
||||||
|
// You can use Sass (SCSS) here: http://sass-lang.com/
|
||||||
3
app/assets/stylesheets/reports/shiftsale.scss
Normal file
3
app/assets/stylesheets/reports/shiftsale.scss
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
// Place all the styles related to the reports/shiftsale controller here.
|
||||||
|
// They will automatically be included in application.css.
|
||||||
|
// You can use Sass (SCSS) here: http://sass-lang.com/
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
class Api::ApiController < ActionController::API
|
class Api::ApiController < ActionController::API
|
||||||
include TokenVerification
|
include TokenVerification
|
||||||
helper_method :current_token, :current_login_employee
|
helper_method :current_token, :current_login_employee, :get_cashier
|
||||||
|
|
||||||
|
|
||||||
private
|
private
|
||||||
@@ -13,6 +13,11 @@ class Api::ApiController < ActionController::API
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Get current Cashier
|
||||||
|
def get_cashier
|
||||||
|
@cashier = Employee.where("role = 'cashier' AND token_session <> ''")
|
||||||
|
end
|
||||||
|
|
||||||
def current_login_employee
|
def current_login_employee
|
||||||
@employee = Employee.find_by_token_session(current_token)
|
@employee = Employee.find_by_token_session(current_token)
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -13,37 +13,54 @@ class Api::BillController < Api::ApiController
|
|||||||
if booking
|
if booking
|
||||||
if booking.sale_id.nil?
|
if booking.sale_id.nil?
|
||||||
@sale = Sale.new
|
@sale = Sale.new
|
||||||
@status, @sale_id = @sale.generate_invoice_from_booking(params[:booking_id], current_login_employee)
|
@status, @sale_id = @sale.generate_invoice_from_booking(params[:booking_id], current_login_employee, get_cashier)
|
||||||
else
|
else
|
||||||
@status = true
|
@status = true
|
||||||
@sale_id = booking.sale_id
|
@sale_id = booking.sale_id
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
elsif (params[:order_id])
|
elsif (params[:order_id])
|
||||||
@sale = Sale.new
|
@sale = Sale.new
|
||||||
@status, @sale_id = @sale.generate_invoice_from_order(params[:order_id], current_login_employee)
|
@status, @sale_id = @sale.generate_invoice_from_order(params[:order_id], current_login_employee, get_cashier)
|
||||||
end
|
end
|
||||||
|
<<<<<<< HEAD
|
||||||
|
|
||||||
@sale_data = Sale.find_by_sale_id(@sale_id)
|
@sale_data = Sale.find_by_sale_id(@sale_id)
|
||||||
@sale_items = SaleItem.where("sale_id=?",@sale_id)
|
@sale_items = SaleItem.where("sale_id=?",@sale_id)
|
||||||
|
=======
|
||||||
|
|
||||||
unique_code = "ReceiptBillPdf"
|
# Not Use for these printed bill cannot give customer
|
||||||
#shop detail
|
# @sale_data = Sale.find_by_sale_id(@sale_id)
|
||||||
shop_details = Shop.find(1)
|
# @sale_items = SaleItem.where("sale_id=?",@sale_id)
|
||||||
|
|
||||||
|
# unique_code = "ReceiptBillPdf"
|
||||||
|
# #shop detail
|
||||||
|
# shop_details = Shop.find(1)
|
||||||
|
|
||||||
|
# customer= Customer.find(@sale_data.customer_id)
|
||||||
|
# # get member information
|
||||||
|
# member_info = Customer.get_member_account(customer)
|
||||||
|
|
||||||
|
|
||||||
|
# # get printer info
|
||||||
|
# print_settings=PrintSetting.find_by_unique_code(unique_code)
|
||||||
|
>>>>>>> 18094f5a71174d84305cfefd3a39db8123b65cff
|
||||||
|
|
||||||
|
# # Calculate Price by accounts
|
||||||
|
# item_price_by_accounts = SaleItem.calculate_price_by_accounts(@sale_items)
|
||||||
|
|
||||||
|
<<<<<<< HEAD
|
||||||
customer= Customer.find(@sale_data.customer_id)
|
customer= Customer.find(@sale_data.customer_id)
|
||||||
# get member information
|
# get member information
|
||||||
member_info = Customer.get_member_account(customer)
|
member_info = Customer.get_member_account(customer)
|
||||||
|
=======
|
||||||
|
>>>>>>> 18094f5a71174d84305cfefd3a39db8123b65cff
|
||||||
|
|
||||||
# get printer info
|
# printer = Printer::ReceiptPrinter.new(print_settings)
|
||||||
print_settings=PrintSetting.find_by_unique_code(unique_code)
|
# printer.print_receipt_bill(print_settings,@sale_items,@sale_data,customer.name, item_price_by_accounts, member_info, shop_details)
|
||||||
|
|
||||||
# Calculate Price by accounts
|
|
||||||
item_price_by_accounts = SaleItem.calculate_price_by_accounts(@sale_items)
|
|
||||||
|
|
||||||
printer = Printer::ReceiptPrinter.new(print_settings)
|
|
||||||
printer.print_receipt_bill(print_settings,@sale_items,@sale_data,customer.name, item_price_by_accounts, member_info, shop_details)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -67,43 +67,75 @@ class Api::OrdersController < Api::ApiController
|
|||||||
if booking
|
if booking
|
||||||
if booking.dining_facility_id.to_i == params[:table_id].to_i && booking.booking_status != 'moved'
|
if booking.dining_facility_id.to_i == params[:table_id].to_i && booking.booking_status != 'moved'
|
||||||
if !booking.sale_id.nil?
|
if !booking.sale_id.nil?
|
||||||
check_order_with_booking(booking)
|
sale_status = check_order_with_booking(booking)
|
||||||
|
# puts "WWwwWWWWWWww"
|
||||||
|
# puts sale_status
|
||||||
|
if sale_status
|
||||||
|
return return_json_status_with_code(400, "bill requested")
|
||||||
|
end
|
||||||
else
|
else
|
||||||
@order.new_booking = false
|
@order.new_booking = false
|
||||||
@order.booking_id = params[:booking_id]
|
@order.booking_id = params[:booking_id]
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
check_order_with_table(params[:table_id])
|
sale_status = check_order_with_table(params[:table_id])
|
||||||
|
# puts "OOOOOOOOO"
|
||||||
|
# puts sale_status
|
||||||
|
if sale_status
|
||||||
|
return return_json_status_with_code(400, "bill requested")
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end #booking exists
|
end #booking exists
|
||||||
else
|
else
|
||||||
check_order_with_table(params[:table_id])
|
sale_status = check_order_with_table(params[:table_id])
|
||||||
end
|
# puts "MMMMMMMM"
|
||||||
|
# puts sale_status
|
||||||
|
if sale_status
|
||||||
|
# return false , @message = "bill requested"
|
||||||
|
return return_json_status_with_code(400, "bill requested")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
@status, @booking = @order.generate
|
@status, @booking = @order.generate
|
||||||
|
end
|
||||||
|
|
||||||
|
# render json for http status code
|
||||||
|
def return_json_status_with_code(code, msg)
|
||||||
|
render status: code, json: {
|
||||||
|
message: msg,
|
||||||
|
booking_id: booking_id
|
||||||
|
}.to_json
|
||||||
end
|
end
|
||||||
|
|
||||||
def check_order_with_table(table_id)
|
def check_order_with_table(table_id)
|
||||||
table = DiningFacility.find(table_id)
|
table = DiningFacility.find(table_id)
|
||||||
if table
|
if table
|
||||||
booking = table.get_current_booking
|
booking = table.get_current_booking
|
||||||
|
# puts booking
|
||||||
if booking
|
if booking
|
||||||
if booking.sale.sale_status == "completed" || booking.sale.sale_status == "billed"
|
if !booking.sale_id.nil?
|
||||||
|
if booking.sale.sale_status == "completed" || booking.sale.sale_status == "new"
|
||||||
@order.new_booking = true
|
@order.new_booking = true
|
||||||
else
|
return false
|
||||||
|
end
|
||||||
|
else
|
||||||
@order.new_booking = false
|
@order.new_booking = false
|
||||||
@order.booking_id = booking.booking_id
|
@order.booking_id = booking.booking_id
|
||||||
|
return false
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# this can always true
|
||||||
def check_order_with_booking(booking)
|
def check_order_with_booking(booking)
|
||||||
if booking.sale.sale_status == "completed" || booking.sale.sale_status == "billed"
|
if booking.sale.sale_status == "completed" || booking.sale.sale_status == "new"
|
||||||
@order.new_booking = true
|
@order.new_booking = true
|
||||||
|
return false
|
||||||
else
|
else
|
||||||
@order.new_booking = false
|
@order.new_booking = false
|
||||||
@order.booking_id = params[:booking_id]
|
@order.booking_id = params[:booking_id]
|
||||||
|
return false
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
# Description
|
# Description
|
||||||
|
|||||||
@@ -7,12 +7,11 @@ class BaseOrigamiController < ActionController::Base
|
|||||||
|
|
||||||
rescue_from CanCan::AccessDenied do |exception|
|
rescue_from CanCan::AccessDenied do |exception|
|
||||||
flash[:warning] = exception.message
|
flash[:warning] = exception.message
|
||||||
redirect_to root_path
|
redirect_to origami_root_path
|
||||||
end
|
end
|
||||||
|
|
||||||
def current_user
|
def current_user
|
||||||
@current_user ||= Employee.find_by_token_session(session[:session_token]) if session[:session_token]
|
@current_user ||= Employee.find_by_token_session(session[:session_token]) if session[:session_token]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -6,12 +6,12 @@ class Crm::CustomersController < BaseCrmController
|
|||||||
# GET /crm/customers.json
|
# GET /crm/customers.json
|
||||||
def index
|
def index
|
||||||
filter = params[:filter]
|
filter = params[:filter]
|
||||||
|
|
||||||
if filter.nil?
|
if filter.nil?
|
||||||
@crm_customers = Customer.all
|
@crm_customers = Customer.all
|
||||||
else
|
else
|
||||||
@crm_customers = Customer.search(filter)
|
@crm_customers = Customer.search(filter)
|
||||||
|
|
||||||
end
|
end
|
||||||
#@crm_customers = Customer.all
|
#@crm_customers = Customer.all
|
||||||
@crm_customers = Kaminari.paginate_array(@crm_customers).page(params[:page]).per(50)
|
@crm_customers = Kaminari.paginate_array(@crm_customers).page(params[:page]).per(50)
|
||||||
@@ -32,7 +32,7 @@ class Crm::CustomersController < BaseCrmController
|
|||||||
def show
|
def show
|
||||||
@orders = Order.where("customer_id=?", params[:id])
|
@orders = Order.where("customer_id=?", params[:id])
|
||||||
@sales = Sale.where("customer_id=?", params[:id])
|
@sales = Sale.where("customer_id=?", params[:id])
|
||||||
|
|
||||||
if @orders
|
if @orders
|
||||||
@order_items = []
|
@order_items = []
|
||||||
@orders.each do |order|
|
@orders.each do |order|
|
||||||
@@ -70,7 +70,7 @@ class Crm::CustomersController < BaseCrmController
|
|||||||
def create
|
def create
|
||||||
|
|
||||||
@crm_customers = Customer.new(customer_params)
|
@crm_customers = Customer.new(customer_params)
|
||||||
|
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
if @crm_customers.save
|
if @crm_customers.save
|
||||||
name = customer_params[:name]
|
name = customer_params[:name]
|
||||||
@@ -81,7 +81,7 @@ class Crm::CustomersController < BaseCrmController
|
|||||||
nrc = customer_params[:nrc_no]
|
nrc = customer_params[:nrc_no]
|
||||||
card_no = customer_params[:card_no]
|
card_no = customer_params[:card_no]
|
||||||
member_group_id = params[:member_group_id]
|
member_group_id = params[:member_group_id]
|
||||||
|
|
||||||
if !member_group_id.nil?
|
if !member_group_id.nil?
|
||||||
membership = MembershipSetting.find_by_membership_type("paypar_url")
|
membership = MembershipSetting.find_by_membership_type("paypar_url")
|
||||||
memberaction = MembershipAction.find_by_membership_type("create_membership_customer")
|
memberaction = MembershipAction.find_by_membership_type("create_membership_customer")
|
||||||
@@ -90,7 +90,7 @@ class Crm::CustomersController < BaseCrmController
|
|||||||
url = membership.gateway_url.to_s + memberaction.gateway_url.to_s
|
url = membership.gateway_url.to_s + memberaction.gateway_url.to_s
|
||||||
|
|
||||||
begin
|
begin
|
||||||
response = HTTParty.post(url,
|
response = HTTParty.post(url,
|
||||||
:body => {name: name,phone: phone,email: email,
|
:body => {name: name,phone: phone,email: email,
|
||||||
dob: dob,address: address,nrc:nrc,card_no:card_no,
|
dob: dob,address: address,nrc:nrc,card_no:card_no,
|
||||||
member_group_id: member_group_id,
|
member_group_id: member_group_id,
|
||||||
@@ -103,18 +103,24 @@ class Crm::CustomersController < BaseCrmController
|
|||||||
)
|
)
|
||||||
rescue Net::OpenTimeout
|
rescue Net::OpenTimeout
|
||||||
response = { status: false }
|
response = { status: false }
|
||||||
|
|
||||||
|
rescue OpenURI::HTTPError
|
||||||
|
response = { status: false}
|
||||||
|
|
||||||
|
rescue SocketError
|
||||||
|
response = { status: false}
|
||||||
end
|
end
|
||||||
|
|
||||||
if response["status"] == true
|
if response["status"] == true
|
||||||
|
|
||||||
customer = Customer.find(@crm_customers.customer_id)
|
customer = Customer.find(@crm_customers.customer_id)
|
||||||
status = customer.update_attributes(membership_id: response["customer_datas"]["id"],membership_type:member_group_id )
|
status = customer.update_attributes(membership_id: response["customer_datas"]["id"],membership_type:member_group_id )
|
||||||
|
|
||||||
if params[:sale_id]
|
if params[:sale_id]
|
||||||
format.html { redirect_to '/origami/'+params[:sale_id]+'/customers', notice: 'Customer was successfully created.' }
|
format.html { redirect_to '/origami/'+params[:sale_id]+'/customers', notice: 'Customer was successfully created.' }
|
||||||
else
|
else
|
||||||
format.html { redirect_to crm_customers_path, notice: 'Customer was successfully created'}
|
format.html { redirect_to crm_customers_path, notice: 'Customer was successfully created'}
|
||||||
end
|
end
|
||||||
# format.json { render :index, status: :created, location: @crm_customers }
|
# format.json { render :index, status: :created, location: @crm_customers }
|
||||||
else
|
else
|
||||||
# @crm_customers.destroy
|
# @crm_customers.destroy
|
||||||
@@ -129,7 +135,7 @@ class Crm::CustomersController < BaseCrmController
|
|||||||
|
|
||||||
if params[:sale_id]
|
if params[:sale_id]
|
||||||
flash[:errors] = @crm_customers.errors
|
flash[:errors] = @crm_customers.errors
|
||||||
format.html { redirect_to '/origami/'+params[:sale_id]+'/customers'}
|
format.html { redirect_to '/origami/'+params[:sale_id]+'/customers'}
|
||||||
format.json { render json: @crm_customers.errors, status: :unprocessable_entity }
|
format.json { render json: @crm_customers.errors, status: :unprocessable_entity }
|
||||||
else
|
else
|
||||||
flash[:errors] = @crm_customers.errors
|
flash[:errors] = @crm_customers.errors
|
||||||
@@ -166,7 +172,7 @@ end
|
|||||||
url = membership.gateway_url.to_s + memberaction.gateway_url.to_s
|
url = membership.gateway_url.to_s + memberaction.gateway_url.to_s
|
||||||
|
|
||||||
begin
|
begin
|
||||||
response = HTTParty.post(url,
|
response = HTTParty.post(url,
|
||||||
:body => { name: name,phone: phone,email: email,
|
:body => { name: name,phone: phone,email: email,
|
||||||
dob: dob,address: address,nrc:nrc,
|
dob: dob,address: address,nrc:nrc,
|
||||||
card_no:card_no,member_group_id: member_group_id,
|
card_no:card_no,member_group_id: member_group_id,
|
||||||
@@ -176,16 +182,22 @@ end
|
|||||||
'Accept' => 'application/json'
|
'Accept' => 'application/json'
|
||||||
},
|
},
|
||||||
:timeout => 10
|
:timeout => 10
|
||||||
)
|
)
|
||||||
rescue Net::OpenTimeout
|
rescue Net::OpenTimeout
|
||||||
response = { status: false }
|
response = { status: false }
|
||||||
|
|
||||||
|
rescue OpenURI::HTTPError
|
||||||
|
response = { status: false}
|
||||||
|
|
||||||
|
rescue SocketError
|
||||||
|
response = { status: false}
|
||||||
end
|
end
|
||||||
|
|
||||||
if response["status"] == true
|
if response["status"] == true
|
||||||
|
|
||||||
customer = Customer.find(@crm_customer.customer_id)
|
customer = Customer.find(@crm_customer.customer_id)
|
||||||
status = customer.update_attributes(membership_id: response["customer_datas"]["id"],membership_type:member_group_id )
|
status = customer.update_attributes(membership_id: response["customer_datas"]["id"],membership_type:member_group_id )
|
||||||
|
|
||||||
format.html { redirect_to crm_customers_path, notice: 'Customer was successfully updated'}
|
format.html { redirect_to crm_customers_path, notice: 'Customer was successfully updated'}
|
||||||
else
|
else
|
||||||
format.html { redirect_to crm_customers_path, notice: response["message"] }
|
format.html { redirect_to crm_customers_path, notice: response["message"] }
|
||||||
@@ -199,7 +211,7 @@ end
|
|||||||
auth_token = memberaction.auth_token.to_s
|
auth_token = memberaction.auth_token.to_s
|
||||||
url = membership.gateway_url.to_s + memberaction.gateway_url.to_s
|
url = membership.gateway_url.to_s + memberaction.gateway_url.to_s
|
||||||
begin
|
begin
|
||||||
response = HTTParty.post(url,
|
response = HTTParty.post(url,
|
||||||
:body => {name: name,phone: phone,email: email,
|
:body => {name: name,phone: phone,email: email,
|
||||||
dob: dob,address: address,nrc:nrc,card_no:card_no,
|
dob: dob,address: address,nrc:nrc,card_no:card_no,
|
||||||
id: id,member_group_id:member_group_id,merchant_uid:merchant_uid,auth_token:auth_token}.to_json,
|
id: id,member_group_id:member_group_id,merchant_uid:merchant_uid,auth_token:auth_token}.to_json,
|
||||||
@@ -211,6 +223,12 @@ end
|
|||||||
)
|
)
|
||||||
rescue Net::OpenTimeout
|
rescue Net::OpenTimeout
|
||||||
response = { status: false }
|
response = { status: false }
|
||||||
|
|
||||||
|
rescue OpenURI::HTTPError
|
||||||
|
response = { status: false}
|
||||||
|
|
||||||
|
rescue SocketError
|
||||||
|
response = { status: false}
|
||||||
end
|
end
|
||||||
|
|
||||||
if response["status"] == true
|
if response["status"] == true
|
||||||
@@ -219,8 +237,8 @@ end
|
|||||||
else
|
else
|
||||||
format.html { redirect_to crm_customers_path, notice: response["message"] }
|
format.html { redirect_to crm_customers_path, notice: response["message"] }
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
else
|
else
|
||||||
|
|
||||||
@@ -251,7 +269,7 @@ end
|
|||||||
# Never trust parameters from the scary internet, only allow the white list through.
|
# Never trust parameters from the scary internet, only allow the white list through.
|
||||||
def customer_params
|
def customer_params
|
||||||
|
|
||||||
params.require(:customer).permit(:name, :company, :contact_no, :email,
|
params.require(:customer).permit(:name, :company, :contact_no, :email,
|
||||||
:date_of_birth,:salutation,:gender,:nrc_no,:address,:card_no)
|
:date_of_birth,:salutation,:gender,:nrc_no,:address,:card_no)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -96,6 +96,17 @@ class Crm::DiningQueuesController < BaseCrmController
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def cancel_queue
|
||||||
|
queue = DiningQueue.find(params[:id])
|
||||||
|
|
||||||
|
status = queue.update_attributes(id: params[:id],status:"Cancel")
|
||||||
|
|
||||||
|
if status == true
|
||||||
|
render json: JSON.generate({:status => true , notice: 'Dining queue was successfully canceled .'})
|
||||||
|
else
|
||||||
|
render json: JSON.generate({:status => false, :error_message => "Record not found"})
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
# Use callbacks to share common setup or constraints between actions.
|
# Use callbacks to share common setup or constraints between actions.
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ class HomeController < ApplicationController
|
|||||||
skip_before_action :authenticate, only: [:index, :show, :create, :update, :destroy]
|
skip_before_action :authenticate, only: [:index, :show, :create, :update, :destroy]
|
||||||
|
|
||||||
def index
|
def index
|
||||||
@employees = Employee.all.order("name asc")
|
@employees = Employee.all_emp_except_waiter.order("name asc")
|
||||||
@login_form = LoginForm.new()
|
@login_form = LoginForm.new()
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -19,7 +19,7 @@ class HomeController < ApplicationController
|
|||||||
|
|
||||||
if @employee != nil
|
if @employee != nil
|
||||||
session[:session_token] = @employee.token_session
|
session[:session_token] = @employee.token_session
|
||||||
redirect_to origami_root_path
|
route_by_role(@employee)
|
||||||
else
|
else
|
||||||
render :show, flash[:notice] => "Invalid PIN for Employee. Please try again!"
|
render :show, flash[:notice] => "Invalid PIN for Employee. Please try again!"
|
||||||
end
|
end
|
||||||
@@ -37,7 +37,7 @@ class HomeController < ApplicationController
|
|||||||
redirect_to dashboard_path
|
redirect_to dashboard_path
|
||||||
elsif @employee.role == "cashier"
|
elsif @employee.role == "cashier"
|
||||||
session[:session_token] = @employee.token_session
|
session[:session_token] = @employee.token_session
|
||||||
redirect_to origami_root_path
|
route_by_role(@employee)
|
||||||
elsif @employee.role == "manager"
|
elsif @employee.role == "manager"
|
||||||
session[:session_token] = @employee.token_session
|
session[:session_token] = @employee.token_session
|
||||||
redirect_to dashboard_path
|
redirect_to dashboard_path
|
||||||
@@ -74,4 +74,25 @@ class HomeController < ApplicationController
|
|||||||
def settings_home_params
|
def settings_home_params
|
||||||
params.require(:login_form).permit(:emp_id, :password)
|
params.require(:login_form).permit(:emp_id, :password)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def route_by_role(employee)
|
||||||
|
if employee.role == "administrator"
|
||||||
|
redirect_to dashboard_path
|
||||||
|
elsif employee.role == "cashier"
|
||||||
|
#check if cashier has existing open cashier
|
||||||
|
shift = ShiftSale.current_open_shift(employee.id)
|
||||||
|
if !shift.nil?
|
||||||
|
redirect_to origami_root_path
|
||||||
|
else
|
||||||
|
redirect_to new_origami_shift_path
|
||||||
|
end
|
||||||
|
elsif employee.role == "manager"
|
||||||
|
redirect_to oqs_root_path
|
||||||
|
elsif employee.role == "waiter"
|
||||||
|
redirect_to oqs_root_path
|
||||||
|
elsif employee.role == "crm"
|
||||||
|
redirect_to crm_root_path
|
||||||
|
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ class Oqs::PrintController < ApplicationController
|
|||||||
# print when complete click
|
# print when complete click
|
||||||
print_settings = PrintSetting.find_by_unique_code(unique_code)
|
print_settings = PrintSetting.find_by_unique_code(unique_code)
|
||||||
order_queue_printer = Printer::OrderQueuePrinter.new(print_settings)
|
order_queue_printer = Printer::OrderQueuePrinter.new(print_settings)
|
||||||
order_queue_printer.print_order_item(oqs, assigned_item.order_id, assigned_item.item_code, print_status, options )
|
order_queue_printer.print_order_item(print_settings,oqs, assigned_item.order_id, assigned_item.item_code, print_status, options )
|
||||||
|
|
||||||
# update print status for completed same order items
|
# update print status for completed same order items
|
||||||
assigned_items.each do |ai|
|
assigned_items.each do |ai|
|
||||||
@@ -46,7 +46,7 @@ class Oqs::PrintController < ApplicationController
|
|||||||
# print when complete click
|
# print when complete click
|
||||||
print_settings = PrintSetting.find_by_unique_code(unique_code)
|
print_settings = PrintSetting.find_by_unique_code(unique_code)
|
||||||
order_queue_printer = Printer::OrderQueuePrinter.new(print_settings)
|
order_queue_printer = Printer::OrderQueuePrinter.new(print_settings)
|
||||||
order_queue_printer.print_booking_summary(oqs, booking.booking_id, print_status)
|
order_queue_printer.print_booking_summary(print_settings,oqs, booking.booking_id, print_status)
|
||||||
|
|
||||||
# update print status for completed same order items
|
# update print status for completed same order items
|
||||||
assigned_items.each do |ai|
|
assigned_items.each do |ai|
|
||||||
|
|||||||
18
app/controllers/origami/cash_ins_controller.rb
Normal file
18
app/controllers/origami/cash_ins_controller.rb
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
class Origami::CashInsController < BaseOrigamiController
|
||||||
|
|
||||||
|
def new
|
||||||
|
end
|
||||||
|
|
||||||
|
def create
|
||||||
|
reference = params[:reference]
|
||||||
|
remark = params[:remark]
|
||||||
|
amount = params[:amount]
|
||||||
|
payment_method = params[:payment_method]
|
||||||
|
payment_method_reference = params[:payment_method_reference]
|
||||||
|
p_jour = PaymentJournal.new
|
||||||
|
p_jour.cash_in(reference, remark, amount, payment_method, payment_method_reference, current_user.id)
|
||||||
|
shift = ShiftSale.current_open_shift(current_user.id)
|
||||||
|
shift.cash_in = shift.cash_in + amount.to_i
|
||||||
|
shift.save
|
||||||
|
end
|
||||||
|
end
|
||||||
10
app/controllers/origami/cash_mgmt_controller.rb
Normal file
10
app/controllers/origami/cash_mgmt_controller.rb
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
class Origami::CashMgmtController < ApplicationController
|
||||||
|
def index
|
||||||
|
end
|
||||||
|
|
||||||
|
def new
|
||||||
|
end
|
||||||
|
|
||||||
|
def create
|
||||||
|
end
|
||||||
|
end
|
||||||
16
app/controllers/origami/cash_outs_controller.rb
Normal file
16
app/controllers/origami/cash_outs_controller.rb
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
class Origami::CashOutsController < BaseOrigamiController
|
||||||
|
|
||||||
|
def new
|
||||||
|
end
|
||||||
|
|
||||||
|
def create
|
||||||
|
reference = params[:reference]
|
||||||
|
remark = params[:remark]
|
||||||
|
amount = params[:amount]
|
||||||
|
p_jour = PaymentJournal.new
|
||||||
|
p_jour.cash_out(reference, remark, amount, current_user.id)
|
||||||
|
shift = ShiftSale.current_open_shift(current_user.id)
|
||||||
|
shift.cash_out = shift.cash_out + amount.to_i
|
||||||
|
shift.save
|
||||||
|
end
|
||||||
|
end
|
||||||
@@ -29,7 +29,6 @@ class Origami::DiscountsController < BaseOrigamiController
|
|||||||
if discount_items.length > 0
|
if discount_items.length > 0
|
||||||
#save sale item for discount
|
#save sale item for discount
|
||||||
discount_items.each do |di|
|
discount_items.each do |di|
|
||||||
puts di
|
|
||||||
origin_sale_item = SaleItem.find(di["id"])
|
origin_sale_item = SaleItem.find(di["id"])
|
||||||
sale_item = SaleItem.new
|
sale_item = SaleItem.new
|
||||||
|
|
||||||
@@ -53,6 +52,59 @@ class Origami::DiscountsController < BaseOrigamiController
|
|||||||
render :json => dining.to_json
|
render :json => dining.to_json
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Remove selected discount Items
|
||||||
|
def remove_discount_items
|
||||||
|
sale_id = params[:sale_id]
|
||||||
|
discount_items = JSON.parse(params[:discount_items])
|
||||||
|
if Sale.exists?(sale_id)
|
||||||
|
sale = Sale.find(sale_id)
|
||||||
|
table_id = sale.bookings[0].dining_facility_id
|
||||||
|
table_type = DiningFacility.find(table_id).type
|
||||||
|
|
||||||
|
if discount_items.length > 0
|
||||||
|
#destroy sale item for discount
|
||||||
|
discount_items.each do |di|
|
||||||
|
sale_item = SaleItem.find(di["id"])
|
||||||
|
sale.total_amount = (sale.total_amount + sale_item.price.abs)
|
||||||
|
sale_item.destroy
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
sale.grand_total = (sale.total_amount - sale.total_discount) + sale.total_tax;
|
||||||
|
sale.save
|
||||||
|
end
|
||||||
|
|
||||||
|
dining = {:table_id => table_id, :table_type => table_type }
|
||||||
|
|
||||||
|
render :json => dining.to_json
|
||||||
|
end
|
||||||
|
|
||||||
|
# Remove all discount Items
|
||||||
|
def remove_all_discount
|
||||||
|
sale_id = params[:id]
|
||||||
|
|
||||||
|
if Sale.exists?(sale_id)
|
||||||
|
sale = Sale.find(sale_id)
|
||||||
|
table_id = sale.bookings[0].dining_facility_id
|
||||||
|
table_type = DiningFacility.find(table_id).type
|
||||||
|
|
||||||
|
#destroy all discount sale item
|
||||||
|
sale.sale_items.each do |si|
|
||||||
|
if si.remark == "Discount" && si.price < 0
|
||||||
|
sale.total_amount = (sale.total_amount + si.price.abs)
|
||||||
|
si.destroy
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
sale.grand_total = (sale.total_amount - sale.total_discount) + sale.total_tax;
|
||||||
|
sale.save
|
||||||
|
end
|
||||||
|
|
||||||
|
dining = {:table_id => table_id, :table_type => table_type }
|
||||||
|
|
||||||
|
render :json => dining.to_json
|
||||||
|
end
|
||||||
|
|
||||||
#discount for selected order
|
#discount for selected order
|
||||||
# def create
|
# def create
|
||||||
# sale_id = params[:sale_id]
|
# sale_id = params[:sale_id]
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ class Origami::HomeController < BaseOrigamiController
|
|||||||
@rooms = Room.all.active.order('status desc')
|
@rooms = Room.all.active.order('status desc')
|
||||||
@complete = Sale.all
|
@complete = Sale.all
|
||||||
@orders = Order.all.order('date desc')
|
@orders = Order.all.order('date desc')
|
||||||
|
# @shift = ShiftSale.current_open_shift(current_user.id)
|
||||||
end
|
end
|
||||||
|
|
||||||
# origami table detail
|
# origami table detail
|
||||||
|
|||||||
@@ -19,9 +19,9 @@ class Origami::HomeController < BaseOrigamiController
|
|||||||
@orders = Order.get_orders()
|
@orders = Order.get_orders()
|
||||||
end
|
end
|
||||||
|
|
||||||
def item_show
|
# def item_show
|
||||||
selection(params[:booking_id],1)
|
# selection(params[:booking_id],1)
|
||||||
end
|
# end
|
||||||
|
|
||||||
def selection(selected_id, is_ajax)
|
def selection(selected_id, is_ajax)
|
||||||
str = []
|
str = []
|
||||||
@@ -37,8 +37,8 @@ class Origami::HomeController < BaseOrigamiController
|
|||||||
@order_details = OrderItem.get_order_items_details(params[:booking_id])
|
@order_details = OrderItem.get_order_items_details(params[:booking_id])
|
||||||
@order_details.each do |ord_detail|
|
@order_details.each do |ord_detail|
|
||||||
str.push(ord_detail)
|
str.push(ord_detail)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if is_ajax == 1
|
if is_ajax == 1
|
||||||
render :json => str.to_json
|
render :json => str.to_json
|
||||||
|
|||||||
48
app/controllers/origami/other_charges_controller.rb
Normal file
48
app/controllers/origami/other_charges_controller.rb
Normal file
@@ -0,0 +1,48 @@
|
|||||||
|
class Origami::OtherChargesController < BaseOrigamiController
|
||||||
|
authorize_resource :class => false
|
||||||
|
|
||||||
|
def index
|
||||||
|
sale_id = params[:sale_id]
|
||||||
|
if Sale.exists?(sale_id)
|
||||||
|
@sale_data = Sale.find(sale_id)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def create
|
||||||
|
sale_id = params[:sale_id]
|
||||||
|
other_charges_items = JSON.parse(params[:other_charges_items])
|
||||||
|
sub_total = params[:sub_total]
|
||||||
|
|
||||||
|
if Sale.exists?(sale_id)
|
||||||
|
sale = Sale.find(sale_id)
|
||||||
|
table_id = sale.bookings[0].dining_facility_id
|
||||||
|
table_type = DiningFacility.find(table_id).type
|
||||||
|
sale.total_amount = sub_total.to_f
|
||||||
|
sale.grand_total = sub_total.to_f + sale.total_tax;
|
||||||
|
sale.save
|
||||||
|
if other_charges_items.length > 0
|
||||||
|
#save sale item for discount
|
||||||
|
other_charges_items.each do |di|
|
||||||
|
# origin_sale_item = SaleItem.find(di["id"])
|
||||||
|
sale_item = SaleItem.new
|
||||||
|
|
||||||
|
sale_item.sale_id = sale_id
|
||||||
|
sale_item.product_code = "Other Charges"
|
||||||
|
sale_item.product_name = di["name"]
|
||||||
|
sale_item.remark = "Other Charges"
|
||||||
|
|
||||||
|
sale_item.qty = 1
|
||||||
|
sale_item.unit_price = di["price"]
|
||||||
|
sale_item.taxable_price = di["price"]
|
||||||
|
sale_item.is_taxable = 0
|
||||||
|
|
||||||
|
sale_item.price = di["price"]
|
||||||
|
sale_item.save
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
dining = {:table_id => table_id, :table_type => table_type }
|
||||||
|
render :json => dining.to_json
|
||||||
|
end
|
||||||
|
end
|
||||||
@@ -4,6 +4,39 @@ class Origami::PaymentsController < BaseOrigamiController
|
|||||||
def index
|
def index
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def first_bill
|
||||||
|
sale_id = params[:sale_id] # sale_id
|
||||||
|
sale_data = Sale.find_by_sale_id(sale_id)
|
||||||
|
sale_items = SaleItem.where("sale_id=?",sale_id)
|
||||||
|
|
||||||
|
new_total = Sale.get_rounding_adjustment(sale_data.grand_total)
|
||||||
|
rounding_adj = sale_data.grand_total - new_total
|
||||||
|
|
||||||
|
sale_data.update_attributes(grand_total: new_total,rounding_adjustment:rounding_adj)
|
||||||
|
# Print for First Bill to Customer
|
||||||
|
|
||||||
|
unique_code = "ReceiptBillPdf"
|
||||||
|
#shop detail
|
||||||
|
shop_details = Shop.find(1)
|
||||||
|
# customer= Customer.where('customer_id=' +.customer_id)
|
||||||
|
customer= Customer.find(sale_data.customer_id)
|
||||||
|
# get member information
|
||||||
|
member_info = Customer.get_member_account(customer)
|
||||||
|
# get printer info
|
||||||
|
print_settings=PrintSetting.find_by_unique_code(unique_code)
|
||||||
|
|
||||||
|
# find order id by sale id
|
||||||
|
# sale_order = SaleOrder.find_by_sale_id(@sale_data.sale_id)
|
||||||
|
|
||||||
|
# Calculate price_by_accounts
|
||||||
|
item_price_by_accounts = SaleItem.calculate_price_by_accounts(sale_items)
|
||||||
|
discount_price_by_accounts = SaleItem.get_discount_price_by_accounts(sale_items)
|
||||||
|
|
||||||
|
printer = Printer::ReceiptPrinter.new(print_settings)
|
||||||
|
|
||||||
|
printer.print_receipt_bill(print_settings,sale_items,sale_data,customer.name, item_price_by_accounts, discount_price_by_accounts, member_info, shop_details)
|
||||||
|
end
|
||||||
|
|
||||||
def create
|
def create
|
||||||
cash = params[:cash]
|
cash = params[:cash]
|
||||||
sale_id = params[:sale_id]
|
sale_id = params[:sale_id]
|
||||||
@@ -26,9 +59,10 @@ class Origami::PaymentsController < BaseOrigamiController
|
|||||||
print_settings=PrintSetting.find_by_unique_code(unique_code)
|
print_settings=PrintSetting.find_by_unique_code(unique_code)
|
||||||
# Calculate Food and Beverage Total
|
# Calculate Food and Beverage Total
|
||||||
item_price_by_accounts = SaleItem.calculate_price_by_accounts(saleObj.sale_items)
|
item_price_by_accounts = SaleItem.calculate_price_by_accounts(saleObj.sale_items)
|
||||||
|
discount_price_by_accounts = SaleItem.get_discount_price_by_accounts(saleObj.sale_items)
|
||||||
|
|
||||||
printer = Printer::ReceiptPrinter.new(print_settings)
|
printer = Printer::ReceiptPrinter.new(print_settings)
|
||||||
printer.print_receipt_bill(print_settings,saleObj.sale_items,saleObj,customer.name, item_price_by_accounts, member_info,rebate_amount,shop_details)
|
printer.print_receipt_bill(print_settings,saleObj.sale_items,saleObj,customer.name, item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount,shop_details)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -104,10 +138,9 @@ class Origami::PaymentsController < BaseOrigamiController
|
|||||||
|
|
||||||
# Calculate price_by_accounts
|
# Calculate price_by_accounts
|
||||||
item_price_by_accounts = SaleItem.calculate_price_by_accounts(saleObj.sale_items)
|
item_price_by_accounts = SaleItem.calculate_price_by_accounts(saleObj.sale_items)
|
||||||
|
discount_price_by_accounts = SaleItem.get_discount_price_by_accounts(saleObj.sale_items)
|
||||||
|
|
||||||
printer = Printer::ReceiptPrinter.new(print_settings)
|
printer = Printer::ReceiptPrinter.new(print_settings)
|
||||||
printer.print_receipt_bill(print_settings,saleObj.sale_items,saleObj,customer.name, item_price_by_accounts, member_info,rebate_amount,shop_details)
|
printer.print_receipt_bill(print_settings,saleObj.sale_items,saleObj,customer.name, item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount,shop_details)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -10,9 +10,9 @@ class Origami::RequestBillsController < BaseOrigamiController
|
|||||||
check_booking = Booking.find_by_booking_id(bk_order.booking_id)
|
check_booking = Booking.find_by_booking_id(bk_order.booking_id)
|
||||||
if check_booking.sale_id.nil?
|
if check_booking.sale_id.nil?
|
||||||
# Create Sale if it doesn't exist
|
# Create Sale if it doesn't exist
|
||||||
puts "current_login_employee"
|
# puts "current_login_employee"
|
||||||
puts current_login_employee.name
|
# puts current_login_employee.name
|
||||||
@status, @sale_id = @sale.generate_invoice_from_booking(check_booking.id,current_login_employee)
|
@status, @sale_id = @sale.generate_invoice_from_booking(check_booking.id,current_login_employee, cashier = nil)
|
||||||
@sale_data = Sale.find_by_sale_id(@sale_id)
|
@sale_data = Sale.find_by_sale_id(@sale_id)
|
||||||
@sale_items = SaleItem.where("sale_id=?",@sale_id)
|
@sale_items = SaleItem.where("sale_id=?",@sale_id)
|
||||||
else
|
else
|
||||||
@@ -20,26 +20,26 @@ class Origami::RequestBillsController < BaseOrigamiController
|
|||||||
@sale_items = SaleItem.where("sale_id=?",@sale_data.sale_id)
|
@sale_items = SaleItem.where("sale_id=?",@sale_data.sale_id)
|
||||||
end
|
end
|
||||||
|
|
||||||
unique_code = "ReceiptBillPdf"
|
# Not Use for these printed bill cannot give customer
|
||||||
#shop detail
|
# unique_code = "ReceiptBillPdf"
|
||||||
shop_details = Shop.find(1)
|
# #shop detail
|
||||||
# customer= Customer.where('customer_id=' +.customer_id)
|
# shop_details = Shop.find(1)
|
||||||
customer= Customer.find(@sale_data.customer_id)
|
# # customer= Customer.where('customer_id=' +.customer_id)
|
||||||
# get member information
|
# customer= Customer.find(@sale_data.customer_id)
|
||||||
member_info = Customer.get_member_account(customer)
|
# # get member information
|
||||||
# get printer info
|
# member_info = Customer.get_member_account(customer)
|
||||||
print_settings=PrintSetting.find_by_unique_code(unique_code)
|
# # get printer info
|
||||||
|
# print_settings=PrintSetting.find_by_unique_code(unique_code)
|
||||||
|
|
||||||
# find order id by sale id
|
# # find order id by sale id
|
||||||
# sale_order = SaleOrder.find_by_sale_id(@sale_data.sale_id)
|
# # sale_order = SaleOrder.find_by_sale_id(@sale_data.sale_id)
|
||||||
|
|
||||||
# Calculate price_by_accounts
|
# # Calculate price_by_accounts
|
||||||
item_price_by_accounts = SaleItem.calculate_price_by_accounts(@sale_items)
|
# item_price_by_accounts = SaleItem.calculate_price_by_accounts(@sale_items)
|
||||||
|
|
||||||
printer = Printer::ReceiptPrinter.new(print_settings)
|
# printer = Printer::ReceiptPrinter.new(print_settings)
|
||||||
|
|
||||||
printer.print_receipt_bill(print_settings,@sale_items,@sale_data,customer.name, item_price_by_accounts,member_info,shop_details)
|
|
||||||
# redirect_to origami_path(@sale_data.sale_id)
|
|
||||||
|
|
||||||
|
# printer.print_receipt_bill(print_settings,@sale_items,@sale_data,customer.name, item_price_by_accounts,member_info,shop_details)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
class Origami::SaleEditController < BaseOrigamiController
|
class Origami::SaleEditController < BaseOrigamiController
|
||||||
|
authorize_resource :class => false
|
||||||
# Index for sale item void OR edit
|
# Index for sale item void OR edit
|
||||||
def edit
|
def edit
|
||||||
sale_id = params[:sale_id]
|
sale_id = params[:sale_id]
|
||||||
@@ -18,6 +18,7 @@ class Origami::SaleEditController < BaseOrigamiController
|
|||||||
@newsaleitem.save
|
@newsaleitem.save
|
||||||
@newsaleitem.qty = saleitemObj.qty * -1
|
@newsaleitem.qty = saleitemObj.qty * -1
|
||||||
@newsaleitem.price = saleitemObj.price * -1
|
@newsaleitem.price = saleitemObj.price * -1
|
||||||
|
@newsaleitem.is_taxable = 0
|
||||||
@newsaleitem.product_name = saleitemObj.product_name + " - void"
|
@newsaleitem.product_name = saleitemObj.product_name + " - void"
|
||||||
@newsaleitem.save
|
@newsaleitem.save
|
||||||
end
|
end
|
||||||
|
|||||||
36
app/controllers/origami/shifts_controller.rb
Normal file
36
app/controllers/origami/shifts_controller.rb
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
class Origami::ShiftsController < BaseOrigamiController
|
||||||
|
|
||||||
|
def index
|
||||||
|
end
|
||||||
|
|
||||||
|
def show
|
||||||
|
puts current_user.id
|
||||||
|
@shift = ShiftSale.current_open_shift(current_user.id)
|
||||||
|
end
|
||||||
|
|
||||||
|
def new
|
||||||
|
@float = Lookup.where('lookup_type=?','float_value')
|
||||||
|
@terminal = CashierTerminal.all
|
||||||
|
end
|
||||||
|
|
||||||
|
def create
|
||||||
|
opening_balance = params[:opening_balance]
|
||||||
|
@shift = ShiftSale.new
|
||||||
|
@shift.create(opening_balance,current_user)
|
||||||
|
end
|
||||||
|
|
||||||
|
def update_shift
|
||||||
|
closing_balance = params[:closing_balance]
|
||||||
|
shift_id = params[:shift_id]
|
||||||
|
@shift = ShiftSale.find_by_id(shift_id)
|
||||||
|
if @shift
|
||||||
|
@shift.shift_closed_at = DateTime.now.utc
|
||||||
|
@shift.closing_balance = closing_balance.to_f
|
||||||
|
@shift.save
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
def edit
|
||||||
|
end
|
||||||
|
end
|
||||||
@@ -25,7 +25,7 @@ class Origami::TableInvoicesController < BaseOrigamiController
|
|||||||
else
|
else
|
||||||
sale = Sale.find(booking.sale_id)
|
sale = Sale.find(booking.sale_id)
|
||||||
|
|
||||||
if sale.sale_status != "completed"
|
if sale.sale_status != "completed" && sale.sale_status != 'void'
|
||||||
@sale_array.push(sale)
|
@sale_array.push(sale)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
class Origami::VoidController < BaseOrigamiController
|
class Origami::VoidController < BaseOrigamiController
|
||||||
|
authorize_resource :class => false
|
||||||
def overall_void
|
def overall_void
|
||||||
|
|
||||||
sale_id = params[:sale_id]
|
sale_id = params[:sale_id]
|
||||||
@@ -9,6 +9,14 @@ class Origami::VoidController < BaseOrigamiController
|
|||||||
sale.sale_status = 'void'
|
sale.sale_status = 'void'
|
||||||
sale.save
|
sale.save
|
||||||
|
|
||||||
|
bookings = sale.bookings
|
||||||
|
bookings.each do |booking|
|
||||||
|
orders = booking.orders
|
||||||
|
orders.each do |order|
|
||||||
|
# order.status = 'void'
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
table_avaliable = true
|
table_avaliable = true
|
||||||
table = sale.bookings[0].dining_facility
|
table = sale.bookings[0].dining_facility
|
||||||
table.bookings.each do |booking|
|
table.bookings.each do |booking|
|
||||||
|
|||||||
@@ -70,6 +70,6 @@ class PrintSettingsController < ApplicationController
|
|||||||
|
|
||||||
# Never trust parameters from the scary internet, only allow the white list through.
|
# Never trust parameters from the scary internet, only allow the white list through.
|
||||||
def print_setting_params
|
def print_setting_params
|
||||||
params.require(:print_setting).permit(:name, :unique_code, :template, :db_name, :db_type, :db_username, :db_password, :printer_name, :api_settings, :page_width, :page_height, :print_copies)
|
params.require(:print_setting).permit(:name, :unique_code, :template, :db_name, :db_type, :db_username, :db_password, :printer_name, :api_settings, :page_width, :page_height, :print_copies,:precision,:delimiter,:heading_space)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,19 +0,0 @@
|
|||||||
class Reports::SaleItemsController < BaseReportController
|
|
||||||
authorize_resource :class => false
|
|
||||||
def index
|
|
||||||
|
|
||||||
from, to, report_type = get_date_range_from_params
|
|
||||||
|
|
||||||
@sale_data = Sale.get_by_range_by_saleitems(from,to,Sale::SALE_STATUS_COMPLETED,report_type)
|
|
||||||
|
|
||||||
respond_to do |format|
|
|
||||||
format.html
|
|
||||||
format.xls
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
def show
|
|
||||||
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
|
||||||
@@ -1,17 +0,0 @@
|
|||||||
class Reports::DailySalesController < BaseReportController
|
|
||||||
# authorize_resource :class => false
|
|
||||||
def index
|
|
||||||
from, to ,report_type = get_date_range_from_params
|
|
||||||
@sale_data = Sale.daily_sales_list(from,to)
|
|
||||||
@tax = SaleTax.get_tax(from,to)
|
|
||||||
respond_to do |format|
|
|
||||||
format.html
|
|
||||||
format.xls
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
def show
|
|
||||||
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
class Reports::DailySalesController < BaseReportController
|
class Reports::DailysaleController < BaseReportController
|
||||||
authorize_resource :class => false
|
authorize_resource :class => false
|
||||||
|
|
||||||
def index
|
def index
|
||||||
from, to ,report_type = get_date_range_from_params
|
from, to ,report_type = get_date_range_from_params
|
||||||
@sale_data = Sale.daily_sales_list(from,to)
|
@sale_data = Sale.daily_sales_list(from,to)
|
||||||
@@ -13,5 +14,4 @@ class Reports::DailySalesController < BaseReportController
|
|||||||
def show
|
def show
|
||||||
|
|
||||||
end
|
end
|
||||||
|
end
|
||||||
end
|
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
class Reports::ReceiptNoController < BaseReportController
|
class Reports::ReceiptNoController < BaseReportController
|
||||||
|
authorize_resource :class => false
|
||||||
def index
|
def index
|
||||||
from, to = get_date_range_from_params
|
from, to = get_date_range_from_params
|
||||||
puts "from..."
|
puts "from..."
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
class Reports::SaleItemsController < BaseReportController
|
class Reports::SaleitemController < BaseReportController
|
||||||
# authorize_resource :class => false
|
authorize_resource :class => false
|
||||||
def index
|
def index
|
||||||
|
|
||||||
from, to, report_type = get_date_range_from_params
|
from, to, report_type = get_date_range_from_params
|
||||||
@@ -16,4 +16,4 @@ class Reports::SaleItemsController < BaseReportController
|
|||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
18
app/controllers/reports/shiftsale_controller.rb
Normal file
18
app/controllers/reports/shiftsale_controller.rb
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
class Reports::ShiftsaleController < ApplicationController
|
||||||
|
# authorize_resource :class => false
|
||||||
|
|
||||||
|
def index
|
||||||
|
|
||||||
|
from, to, report_type = get_date_range_from_params
|
||||||
|
@sale_data = Sale.get_by_shiftsales(from,to)
|
||||||
|
respond_to do |format|
|
||||||
|
format.html
|
||||||
|
format.xls
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def show
|
||||||
|
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
16
app/forms/open_shift_form.rb
Normal file
16
app/forms/open_shift_form.rb
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
class LoginForm
|
||||||
|
include ActiveModel::Model
|
||||||
|
include ActiveModel::Validations
|
||||||
|
|
||||||
|
attr_accessor :float_amount
|
||||||
|
validates_presence_of :float_amount
|
||||||
|
|
||||||
|
def persisted?
|
||||||
|
false
|
||||||
|
end
|
||||||
|
|
||||||
|
def initialize(attributes={})
|
||||||
|
super
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
2
app/helpers/cash_mgmt_helper.rb
Normal file
2
app/helpers/cash_mgmt_helper.rb
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
module CashMgmtHelper
|
||||||
|
end
|
||||||
@@ -1,2 +1,3 @@
|
|||||||
module Origami::RequestBillsHelper
|
module Origami::RequestBillsHelper
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
2
app/helpers/origami/shifts_helper.rb
Normal file
2
app/helpers/origami/shifts_helper.rb
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
module Origami::ShiftsHelper
|
||||||
|
end
|
||||||
2
app/helpers/reports/dailysale_helper.rb
Normal file
2
app/helpers/reports/dailysale_helper.rb
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
module Reports::DailysaleHelper
|
||||||
|
end
|
||||||
@@ -1,2 +0,0 @@
|
|||||||
module Reports::DailysalesHelper
|
|
||||||
end
|
|
||||||
@@ -1,2 +0,0 @@
|
|||||||
module Reports::SaleItemsHelper
|
|
||||||
end
|
|
||||||
2
app/helpers/reports/saleitem_helper.rb
Normal file
2
app/helpers/reports/saleitem_helper.rb
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
module Reports::SaleitemHelper
|
||||||
|
end
|
||||||
2
app/helpers/reports/shiftsale_helper.rb
Normal file
2
app/helpers/reports/shiftsale_helper.rb
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
module Reports::ShiftsaleHelper
|
||||||
|
end
|
||||||
@@ -31,16 +31,23 @@ class Ability
|
|||||||
can :manage, Sale
|
can :manage, Sale
|
||||||
|
|
||||||
can :manage, Customer
|
can :manage, Customer
|
||||||
|
can :manage, DiningQueue
|
||||||
|
|
||||||
can :index, :dailysale
|
can :index, :dailysale
|
||||||
can :index, :saleitem
|
can :index, :saleitem
|
||||||
|
can :index, :receipt_no
|
||||||
|
|
||||||
can :add_customer, Customer
|
can :add_customer, Customer
|
||||||
can :update_sale_by_customer, Customer
|
can :update_sale_by_customer, Customer
|
||||||
|
|
||||||
|
can :index, :other_charges
|
||||||
|
can :create, :other_charges
|
||||||
can :index, :discount
|
can :index, :discount
|
||||||
can :create, :discount
|
can :create, :discount
|
||||||
|
can :remove_discount_items, :discount
|
||||||
|
can :remove_all_discount, :discount
|
||||||
|
|
||||||
|
can :first_bill, :payment
|
||||||
can :show, :payment
|
can :show, :payment
|
||||||
can :create, :payment
|
can :create, :payment
|
||||||
can :reprint, :payment
|
can :reprint, :payment
|
||||||
@@ -50,6 +57,14 @@ class Ability
|
|||||||
|
|
||||||
can :move_dining, :moveroom
|
can :move_dining, :moveroom
|
||||||
|
|
||||||
|
can :edit, :sale_edit
|
||||||
|
can :item_void, :sale_edit
|
||||||
|
can :item_void_cancel, :sale_edit
|
||||||
|
can :cancel_all_void, :sale_edit
|
||||||
|
can :apply_void, :sale_edit
|
||||||
|
|
||||||
|
can :overall_void, :void
|
||||||
|
|
||||||
elsif user.role == "cashier"
|
elsif user.role == "cashier"
|
||||||
|
|
||||||
can :read, Order
|
can :read, Order
|
||||||
@@ -63,6 +78,8 @@ class Ability
|
|||||||
|
|
||||||
can :index, :discount
|
can :index, :discount
|
||||||
can :create, :discount
|
can :create, :discount
|
||||||
|
can :remove_discount_items, :discount
|
||||||
|
can :remove_all_discount, :discount
|
||||||
|
|
||||||
can :show, :payment
|
can :show, :payment
|
||||||
can :create, :payment
|
can :create, :payment
|
||||||
@@ -76,12 +93,17 @@ class Ability
|
|||||||
elsif user.role == "accountant"
|
elsif user.role == "accountant"
|
||||||
|
|
||||||
can :index, :dailysale
|
can :index, :dailysale
|
||||||
can :index, :saleitem
|
can :manage, :saleitem
|
||||||
can :index, :receiptno
|
can :index, :receiptno
|
||||||
can :show, :dailysale
|
|
||||||
can :show, :saleitem
|
elsif user.role == "supervisour"
|
||||||
can :show, :receiptno
|
|
||||||
|
can :index, :dailysale
|
||||||
|
can :manage, :saleitem
|
||||||
|
can :index, :receiptno
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -31,6 +31,12 @@ class Customer < ApplicationRecord
|
|||||||
)
|
)
|
||||||
rescue Net::OpenTimeout
|
rescue Net::OpenTimeout
|
||||||
response = { status: false }
|
response = { status: false }
|
||||||
|
|
||||||
|
rescue OpenURI::HTTPError
|
||||||
|
response = { status: false}
|
||||||
|
|
||||||
|
rescue SocketError
|
||||||
|
response = { status: false}
|
||||||
end
|
end
|
||||||
|
|
||||||
return response;
|
return response;
|
||||||
@@ -55,6 +61,12 @@ class Customer < ApplicationRecord
|
|||||||
)
|
)
|
||||||
rescue Net::OpenTimeout
|
rescue Net::OpenTimeout
|
||||||
response = { status: false }
|
response = { status: false }
|
||||||
|
|
||||||
|
rescue OpenURI::HTTPError
|
||||||
|
response = { status: false}
|
||||||
|
|
||||||
|
rescue SocketError
|
||||||
|
response = { status: false}
|
||||||
end
|
end
|
||||||
|
|
||||||
return response;
|
return response;
|
||||||
|
|||||||
@@ -39,6 +39,16 @@ class DiningFacility < ApplicationRecord
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def get_moved_booking
|
||||||
|
booking = Booking.where("dining_facility_id = #{self.id} and booking_status ='moved' and checkin_at between '#{DateTime.now.utc - 5.hours}' and '#{DateTime.now.utc}' and checkout_at is null").limit(1)
|
||||||
|
|
||||||
|
if booking.count > 0 then
|
||||||
|
return booking[0]
|
||||||
|
else
|
||||||
|
return nil
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def get_new_booking
|
def get_new_booking
|
||||||
# query for new
|
# query for new
|
||||||
# if status
|
# if status
|
||||||
|
|||||||
@@ -1,11 +1,16 @@
|
|||||||
class Employee < ApplicationRecord
|
class Employee < ApplicationRecord
|
||||||
has_secure_password
|
has_secure_password
|
||||||
|
|
||||||
|
has_many :shit_sales
|
||||||
validates_presence_of :name, :role
|
validates_presence_of :name, :role
|
||||||
validates_presence_of :password, :on => [:create]
|
validates_presence_of :password, :on => [:create]
|
||||||
validates :emp_id, uniqueness: true, numericality: true, length: {in: 1..4}, allow_blank: true
|
validates :emp_id, uniqueness: true, numericality: true, length: {in: 1..4}, allow_blank: true
|
||||||
validates :password, numericality: true, length: {in: 3..9}, allow_blank: true
|
validates :password, numericality: true, length: {in: 3..9}, allow_blank: true
|
||||||
|
|
||||||
|
def self.all_emp_except_waiter
|
||||||
|
Employee.where('role!=?','waiter')
|
||||||
|
end
|
||||||
|
|
||||||
def self.collection
|
def self.collection
|
||||||
Employee.select("id, name").map { |e| [e.name, e.id] }
|
Employee.select("id, name").map { |e| [e.name, e.id] }
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -25,9 +25,8 @@ class Order < ApplicationRecord
|
|||||||
booking = nil
|
booking = nil
|
||||||
|
|
||||||
if self.new_booking
|
if self.new_booking
|
||||||
|
|
||||||
booking = Booking.create({:dining_facility_id => self.table_id,:type => "TableBooking",
|
booking = Booking.create({:dining_facility_id => self.table_id,:type => "TableBooking",
|
||||||
:checkin_at => Time.now.utc.getlocal, :checkin_by => self.employee_name,
|
:checkin_at => Time.now.utc, :checkin_by => self.employee_name,
|
||||||
:booking_status => "assign" })
|
:booking_status => "assign" })
|
||||||
table = DiningFacility.find(self.table_id)
|
table = DiningFacility.find(self.table_id)
|
||||||
table.status = "occupied"
|
table.status = "occupied"
|
||||||
@@ -39,6 +38,7 @@ class Order < ApplicationRecord
|
|||||||
booking.save!
|
booking.save!
|
||||||
self.default_values
|
self.default_values
|
||||||
|
|
||||||
|
# cashier already opened?
|
||||||
if self.save!
|
if self.save!
|
||||||
|
|
||||||
self.adding_line_items
|
self.adding_line_items
|
||||||
@@ -301,7 +301,7 @@ class Order < ApplicationRecord
|
|||||||
.joins("left join dining_facilities on dining_facilities.id = bookings.dining_facility_id")
|
.joins("left join dining_facilities on dining_facilities.id = bookings.dining_facility_id")
|
||||||
.joins("left join orders on orders.order_id = booking_orders.order_id")
|
.joins("left join orders on orders.order_id = booking_orders.order_id")
|
||||||
.joins("left join sales on sales.sale_id = bookings.sale_id")
|
.joins("left join sales on sales.sale_id = bookings.sale_id")
|
||||||
.where("(orders.status = 'new' or orders.status = 'billed')")
|
.where("(orders.status = 'new' or orders.status = 'billed') AND orders.date between #{ from } and #{ to }")
|
||||||
|
|
||||||
# orders = Order.select("orders.order_id as order_id,sales.receipt_no,orders.status as order_status, sales.sale_status as sale_status,
|
# orders = Order.select("orders.order_id as order_id,sales.receipt_no,orders.status as order_status, sales.sale_status as sale_status,
|
||||||
# orders.order_id as order_id,sales.customer_id as sale_customer_id,orders.customer_id as order_customer_id
|
# orders.order_id as order_id,sales.customer_id as sale_customer_id,orders.customer_id as order_customer_id
|
||||||
|
|||||||
43
app/models/payment_journal.rb
Normal file
43
app/models/payment_journal.rb
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
class PaymentJournal < ApplicationRecord
|
||||||
|
|
||||||
|
def cash_in(reference, remark, amount, payment_method, payment_method_reference, current_user)
|
||||||
|
self.payment_references = reference
|
||||||
|
self.remark = remark
|
||||||
|
self.credit_amount = amount
|
||||||
|
self.payment_method = payment_method
|
||||||
|
self.payment_status = 'paid'
|
||||||
|
self.payment_method_references = payment_method_reference
|
||||||
|
self.created_by = current_user
|
||||||
|
self.save
|
||||||
|
end
|
||||||
|
|
||||||
|
def cash_out(payment_reference, remark, amount, current_user)
|
||||||
|
self.payment_references = payment_reference
|
||||||
|
self.remark = remark
|
||||||
|
self.debit_amount = amount
|
||||||
|
self.payment_status = 'paid'
|
||||||
|
self.created_by = current_user
|
||||||
|
self.save
|
||||||
|
end
|
||||||
|
|
||||||
|
# def self.today_cash_in(current_user)
|
||||||
|
# credit = 0.0
|
||||||
|
# today_date = DateTime.now.strftime("%Y-%m-%d")
|
||||||
|
# pj_credit = PaymentJournal.where("TO_CHAR(created_at, 'YYYY-MM-DD')=? and created_by=?",today_date, current_user)
|
||||||
|
# pj_credit.each do |obj|
|
||||||
|
# credit += obj.credit_amount
|
||||||
|
# end
|
||||||
|
# return credit
|
||||||
|
# end
|
||||||
|
#
|
||||||
|
# def self.today_cash_out(current_user)
|
||||||
|
# debit = 0.0
|
||||||
|
# today_date = DateTime.now.strftime("%Y-%m-%d")
|
||||||
|
# pj_debit = PaymentJournal.where("TO_CHAR(created_at, 'YYYY-MM-DD')=? and created_by=?",today_date, current_user)
|
||||||
|
# pj_debit.each do |obj|
|
||||||
|
# debit += obj.debit_amount
|
||||||
|
# end
|
||||||
|
# return debit
|
||||||
|
# end
|
||||||
|
|
||||||
|
end
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
class Printer::OrderQueuePrinter < Printer::PrinterWorker
|
class Printer::OrderQueuePrinter < Printer::PrinterWorker
|
||||||
|
|
||||||
def print_order_item(oqs,order_id, item_code, print_status, options="")
|
def print_order_item(print_settings,oqs,order_id, item_code, print_status, options="")
|
||||||
#Use CUPS service
|
#Use CUPS service
|
||||||
#Generate PDF
|
#Generate PDF
|
||||||
#Print
|
#Print
|
||||||
@@ -10,7 +10,7 @@ class Printer::OrderQueuePrinter < Printer::PrinterWorker
|
|||||||
|
|
||||||
# check for item not to show
|
# check for item not to show
|
||||||
if order_item[0].price != 0
|
if order_item[0].price != 0
|
||||||
pdf = OrderItemPdf.new(order_item[0], print_status, options)
|
pdf = OrderItemPdf.new(print_settings,order_item[0], print_status, options, oqs.use_alternate_name)
|
||||||
pdf.render_file filename
|
pdf.render_file filename
|
||||||
|
|
||||||
if oqs.print_copy
|
if oqs.print_copy
|
||||||
@@ -26,21 +26,22 @@ class Printer::OrderQueuePrinter < Printer::PrinterWorker
|
|||||||
end
|
end
|
||||||
|
|
||||||
# Query for per order
|
# Query for per order
|
||||||
def print_order_summary(oqs, order_id, order_items, print_status)
|
def print_order_summary(print_settings,oqs, order_id, order_items, print_status)
|
||||||
#Use CUPS service
|
#Use CUPS service
|
||||||
#Generate PDF
|
#Generate PDF
|
||||||
#Print
|
#Print
|
||||||
order=print_query('order_summary', order_id)
|
order=print_query('order_summary', order_id)
|
||||||
|
|
||||||
# For Print Per Item
|
# For Print Per Item
|
||||||
if oqs.cut_per_item
|
if oqs.cut_per_item
|
||||||
order_items.each do|odi|
|
order.each do|odi|
|
||||||
filename = "tmp/order_item_#{odi.item_name}" + ".pdf"
|
filename = "tmp/order_item_#{odi.item_name}" + ".pdf"
|
||||||
# For Item Options
|
# For Item Options
|
||||||
options = odi.options == "[]"? "" : odi.options
|
options = odi.options == "[]"? "" : odi.options
|
||||||
|
|
||||||
# check for item not to show
|
# check for item not to show
|
||||||
if odi.price != 0 || odi.price != 10
|
if odi.price != 0
|
||||||
pdf = OrderItemPdf.new(odi, print_status, options)
|
pdf = OrderItemPdf.new(print_settings,odi, print_status, options, oqs.use_alternate_name)
|
||||||
# pdf.render_file "tmp/order_item.pdf"
|
# pdf.render_file "tmp/order_item.pdf"
|
||||||
pdf.render_file filename
|
pdf.render_file filename
|
||||||
if oqs.print_copy
|
if oqs.print_copy
|
||||||
@@ -54,7 +55,7 @@ class Printer::OrderQueuePrinter < Printer::PrinterWorker
|
|||||||
# For Print Order Summary
|
# For Print Order Summary
|
||||||
else
|
else
|
||||||
filename = "tmp/order_summary_#{ order_id }" + ".pdf"
|
filename = "tmp/order_summary_#{ order_id }" + ".pdf"
|
||||||
pdf = OrderSummaryPdf.new(order, print_status, order_items)
|
pdf = OrderSummaryPdf.new(print_settings,order, print_status, order_items, oqs.use_alternate_name)
|
||||||
pdf.render_file filename
|
pdf.render_file filename
|
||||||
if oqs.print_copy
|
if oqs.print_copy
|
||||||
self.print(filename, oqs.printer_name)
|
self.print(filename, oqs.printer_name)
|
||||||
@@ -69,7 +70,7 @@ class Printer::OrderQueuePrinter < Printer::PrinterWorker
|
|||||||
end
|
end
|
||||||
|
|
||||||
# Print for orders in booking
|
# Print for orders in booking
|
||||||
def print_booking_summary(oqs, booking_id, print_status)
|
def print_booking_summary(print_settings,oqs, booking_id, print_status)
|
||||||
order=print_query('booking_summary', booking_id)
|
order=print_query('booking_summary', booking_id)
|
||||||
# For Print Per Item
|
# For Print Per Item
|
||||||
if oqs.cut_per_item
|
if oqs.cut_per_item
|
||||||
@@ -80,7 +81,7 @@ class Printer::OrderQueuePrinter < Printer::PrinterWorker
|
|||||||
|
|
||||||
# check for item not to show
|
# check for item not to show
|
||||||
if odi.price != 0
|
if odi.price != 0
|
||||||
pdf = OrderItemPdf.new(odi, print_status, options)
|
pdf = OrderItemPdf.new(print_settings,odi, print_status, options,oqs.use_alternate_name)
|
||||||
pdf.render_file filename
|
pdf.render_file filename
|
||||||
|
|
||||||
if oqs.print_copy
|
if oqs.print_copy
|
||||||
@@ -97,7 +98,7 @@ class Printer::OrderQueuePrinter < Printer::PrinterWorker
|
|||||||
# For Print Order Summary
|
# For Print Order Summary
|
||||||
else
|
else
|
||||||
filename = "tmp/booking_summary_#{ booking_id }" + ".pdf"
|
filename = "tmp/booking_summary_#{ booking_id }" + ".pdf"
|
||||||
pdf = OrderSummaryPdf.new(order, print_status)
|
pdf = OrderSummaryPdf.new(print_settings,order, print_status,oqs.use_alternate_name)
|
||||||
pdf.render_file filename
|
pdf.render_file filename
|
||||||
if oqs.print_copy
|
if oqs.print_copy
|
||||||
self.print(filename, oqs.printer_name)
|
self.print(filename, oqs.printer_name)
|
||||||
@@ -114,31 +115,34 @@ class Printer::OrderQueuePrinter < Printer::PrinterWorker
|
|||||||
# Query for OQS with status
|
# Query for OQS with status
|
||||||
def print_query(type, id)
|
def print_query(type, id)
|
||||||
if type == "order_item"
|
if type == "order_item"
|
||||||
OrderItem.select("order_items.order_id, order_items.item_code, order_items.item_name, order_items.qty, order_items.price, order_items.options, order_items.item_order_by as order_by, order_items.created_at as order_at, cus.name as customer, df.type, df.name as dining")
|
OrderItem.select("order_items.order_id, order_items.item_code, order_items.item_name, order_items.qty, order_items.price, order_items.options, order_items.item_order_by as order_by, order_items.created_at as order_at, cus.name as customer, df.type, df.name as dining,item.alt_name as alt_name")
|
||||||
.joins("left join orders ON orders.order_id = order_items.order_id
|
.joins("left join orders ON orders.order_id = order_items.order_id
|
||||||
left join booking_orders AS bo ON bo.order_id=order_items.order_id
|
left join booking_orders AS bo ON bo.order_id=order_items.order_id
|
||||||
left join bookings AS b ON b.booking_id = bo.booking_id
|
left join bookings AS b ON b.booking_id = bo.booking_id
|
||||||
left join dining_facilities AS df ON df.id = b.dining_facility_id
|
left join dining_facilities AS df ON df.id = b.dining_facility_id
|
||||||
left join customers as cus ON cus.customer_id = orders.customer_id")
|
left join customers as cus ON cus.customer_id = orders.customer_id
|
||||||
|
left join menu_items as item ON item.item_code = order_items.item_code")
|
||||||
.where("order_items.item_code = '#{ id }' AND order_items.price != 0")
|
.where("order_items.item_code = '#{ id }' AND order_items.price != 0")
|
||||||
.group("order_items.item_code")
|
.group("order_items.item_code")
|
||||||
elsif type == "order_summary"
|
elsif type == "order_summary"
|
||||||
OrderItem.select("order_items.order_id, order_items.item_code, order_items.item_name, order_items.qty, order_items.price, order_items.options, order_items.item_order_by as order_by, order_items.created_at as order_at, cus.name as customer, df.type, df.name as dining")
|
OrderItem.select("order_items.order_id, order_items.item_code, order_items.item_name, order_items.qty, order_items.price, order_items.options, order_items.item_order_by as order_by, order_items.created_at as order_at, cus.name as customer, df.type, df.name as dining,item.alt_name as alt_name")
|
||||||
.joins("left join orders ON orders.order_id = order_items.order_id
|
.joins("left join orders ON orders.order_id = order_items.order_id
|
||||||
left join booking_orders AS bo ON bo.order_id=order_items.order_id
|
left join booking_orders AS bo ON bo.order_id=order_items.order_id
|
||||||
left join bookings AS b ON b.booking_id = bo.booking_id
|
left join bookings AS b ON b.booking_id = bo.booking_id
|
||||||
left join dining_facilities AS df ON df.id = b.dining_facility_id
|
left join dining_facilities AS df ON df.id = b.dining_facility_id
|
||||||
left join customers as cus ON cus.customer_id = orders.customer_id")
|
left join customers as cus ON cus.customer_id = orders.customer_id
|
||||||
|
left join menu_items as item ON item.item_code = order_items.item_code")
|
||||||
.where("orders.order_id = '#{ id }' AND order_items.price != 0")
|
.where("orders.order_id = '#{ id }' AND order_items.price != 0")
|
||||||
.group("order_items.order_items_id")
|
.group("order_items.order_items_id")
|
||||||
else
|
else
|
||||||
# order summary for booking
|
# order summary for booking
|
||||||
OrderItem.select("order_items.order_id, order_items.item_code, order_items.item_name, order_items.qty, order_items.price, order_items.options, order_items.item_order_by as order_by, order_items.created_at as order_at, cus.name as customer, df.type, df.name as dining")
|
OrderItem.select("order_items.order_id, order_items.item_code, order_items.item_name, order_items.qty, order_items.price, order_items.options, order_items.item_order_by as order_by, order_items.created_at as order_at, cus.name as customer, df.type, df.name as dining,item.alt_name as alt_name")
|
||||||
.joins("left join orders ON orders.order_id = order_items.order_id
|
.joins("left join orders ON orders.order_id = order_items.order_id
|
||||||
left join booking_orders AS bo ON bo.order_id=order_items.order_id
|
left join booking_orders AS bo ON bo.order_id=order_items.order_id
|
||||||
left join bookings AS b ON b.booking_id = bo.booking_id
|
left join bookings AS b ON b.booking_id = bo.booking_id
|
||||||
left join dining_facilities AS df ON df.id = b.dining_facility_id
|
left join dining_facilities AS df ON df.id = b.dining_facility_id
|
||||||
left join customers as cus ON cus.customer_id = orders.customer_id")
|
left join customers as cus ON cus.customer_id = orders.customer_id
|
||||||
|
left join menu_items as item ON item.item_code = order_items.item_code")
|
||||||
.where("b.booking_id = '#{ id }' AND order_items.price != 0")
|
.where("b.booking_id = '#{ id }' AND order_items.price != 0")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -65,14 +65,19 @@ class Printer::ReceiptPrinter < Printer::PrinterWorker
|
|||||||
end
|
end
|
||||||
|
|
||||||
#Bill Receipt Print
|
#Bill Receipt Print
|
||||||
def print_receipt_bill(printer_settings,sale_items,sale_data, customer_name, item_price_by_accounts, member_info = nil,rebate_amount=nil,shop_details)
|
def print_receipt_bill(printer_settings,sale_items,sale_data, customer_name, item_price_by_accounts, discount_price_by_accounts, member_info = nil,rebate_amount=nil,shop_details)
|
||||||
#Use CUPS service
|
#Use CUPS service
|
||||||
#Generate PDF
|
#Generate PDF
|
||||||
#Print
|
#Print
|
||||||
pdf = ReceiptBillPdf.new(printer_settings, sale_items, sale_data, customer_name, item_price_by_accounts, member_info,rebate_amount,shop_details)
|
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)
|
||||||
|
|
||||||
pdf.render_file "tmp/receipt_bill.pdf"
|
# print as print copies in printer setting
|
||||||
self.print("tmp/receipt_bill.pdf")
|
count = printer_settings.print_copies
|
||||||
|
begin
|
||||||
|
pdf.render_file "tmp/receipt_bill.pdf"
|
||||||
|
self.print("tmp/receipt_bill.pdf")
|
||||||
|
count -= 1
|
||||||
|
end until count == 0
|
||||||
end
|
end
|
||||||
|
|
||||||
#Queue No Print
|
#Queue No Print
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ class Sale < ApplicationRecord
|
|||||||
SALE_STATUS_OUTSTANDING = "outstanding"
|
SALE_STATUS_OUTSTANDING = "outstanding"
|
||||||
SALE_STATUS_COMPLETED = "completed"
|
SALE_STATUS_COMPLETED = "completed"
|
||||||
|
|
||||||
def generate_invoice_from_booking(booking_id, requested_by)
|
def generate_invoice_from_booking(booking_id, requested_by, cashier)
|
||||||
booking = Booking.find(booking_id)
|
booking = Booking.find(booking_id)
|
||||||
status = false
|
status = false
|
||||||
Rails.logger.debug "Booking -> " + booking.id.to_s
|
Rails.logger.debug "Booking -> " + booking.id.to_s
|
||||||
@@ -35,9 +35,9 @@ class Sale < ApplicationRecord
|
|||||||
|
|
||||||
booking.booking_orders.each do |order|
|
booking.booking_orders.each do |order|
|
||||||
if booking.sale_id
|
if booking.sale_id
|
||||||
status, sale_id = generate_invoice_from_order(order.order_id, nil, booking, requested_by)
|
status, sale_id = generate_invoice_from_order(order.order_id, nil, booking, requested_by, cashier)
|
||||||
else
|
else
|
||||||
status, sale_id = generate_invoice_from_order(order.order_id, booking.sale_id, booking, requested_by)
|
status, sale_id = generate_invoice_from_order(order.order_id, booking.sale_id, booking, requested_by, cashier)
|
||||||
end
|
end
|
||||||
booking.sale_id = sale_id
|
booking.sale_id = sale_id
|
||||||
end
|
end
|
||||||
@@ -47,7 +47,7 @@ class Sale < ApplicationRecord
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def generate_invoice_from_order (order_id, sale_id, booking, requested_by)
|
def generate_invoice_from_order (order_id, sale_id, booking, requested_by, cashier = nil)
|
||||||
taxable = true
|
taxable = true
|
||||||
#if sale_id is exsit and validate
|
#if sale_id is exsit and validate
|
||||||
#add order to that invoice
|
#add order to that invoice
|
||||||
@@ -66,12 +66,19 @@ class Sale < ApplicationRecord
|
|||||||
#Default Tax - Values
|
#Default Tax - Values
|
||||||
self.tax_type = "exclusive"
|
self.tax_type = "exclusive"
|
||||||
|
|
||||||
# set cashier by current login
|
# set cashier
|
||||||
self.cashier_id = requested_by.id
|
if cashier != nil
|
||||||
self.cashier_name = requested_by.name
|
self.cashier_id = cashier[0].id
|
||||||
|
self.cashier_name = cashier[0].name
|
||||||
|
else
|
||||||
|
self.cashier_id = requested_by.id
|
||||||
|
self.cashier_name = requested_by.name
|
||||||
|
end
|
||||||
|
|
||||||
|
# set waiter
|
||||||
self.requested_by = requested_by.name
|
self.requested_by = requested_by.name
|
||||||
|
|
||||||
self.requested_at = DateTime.now.utc
|
self.requested_at = DateTime.now.utc.getlocal
|
||||||
|
|
||||||
Rails.logger.debug "Order -> #{order.id} | order_status -> #{order.status}"
|
Rails.logger.debug "Order -> #{order.id} | order_status -> #{order.status}"
|
||||||
if order
|
if order
|
||||||
@@ -263,9 +270,6 @@ class Sale < ApplicationRecord
|
|||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
private
|
|
||||||
|
|
||||||
def product_get_unit_price(item_code)
|
def product_get_unit_price(item_code)
|
||||||
menu_item_hash =MenuItem.search_by_item_code(item_code)
|
menu_item_hash =MenuItem.search_by_item_code(item_code)
|
||||||
if (menu_instance_code)
|
if (menu_instance_code)
|
||||||
@@ -316,6 +320,41 @@ class Sale < ApplicationRecord
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def self.get_rounding_adjustment(num)
|
||||||
|
## 0 -- 25 -- 50 -- 75 -- 100
|
||||||
|
# if get_rounded_amt == true
|
||||||
|
value = 0
|
||||||
|
|
||||||
|
num = num.to_f.round
|
||||||
|
get_last_no = num.to_s.last(2).to_f
|
||||||
|
if get_last_no.between?(0,25)
|
||||||
|
## down to 0
|
||||||
|
num -= get_last_no
|
||||||
|
else
|
||||||
|
if get_last_no.between?(26,50)
|
||||||
|
## up to 50
|
||||||
|
value = 50 - get_last_no.to_f
|
||||||
|
num += value
|
||||||
|
puts 'up to 50'
|
||||||
|
else
|
||||||
|
if get_last_no.between?(51, 75)
|
||||||
|
## down to 50
|
||||||
|
value = get_last_no.to_f - 50
|
||||||
|
num -= value
|
||||||
|
puts 'down to 50'
|
||||||
|
else
|
||||||
|
## up to 100
|
||||||
|
value = 100 - get_last_no.to_f
|
||||||
|
num += value
|
||||||
|
puts 'up to 100'
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
# end
|
||||||
|
return num
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
def self.daily_sales_list(from,to)
|
def self.daily_sales_list(from,to)
|
||||||
payments_total = Sale.select("CAST((CONVERT_TZ(sales.receipt_date,'+00:00','+06:30')) AS DATE) as sale_date,
|
payments_total = Sale.select("CAST((CONVERT_TZ(sales.receipt_date,'+00:00','+06:30')) AS DATE) as sale_date,
|
||||||
SUM(case when (sale_payments.payment_method='mpu') then sale_payments.payment_amount else 0 end) as mpu_amount,
|
SUM(case when (sale_payments.payment_method='mpu') then sale_payments.payment_amount else 0 end) as mpu_amount,
|
||||||
@@ -381,13 +420,13 @@ def self.get_by_range_by_saleitems(from,to,status,report_type)
|
|||||||
.group('mi.id')
|
.group('mi.id')
|
||||||
.order("mi.menu_category_id")
|
.order("mi.menu_category_id")
|
||||||
|
|
||||||
query = query.joins("JOIN sale_items i ON i.sale_id = sales.sale_id
|
query = query.joins("JOIN sale_items i ON i.sale_id = sales.sale_id
|
||||||
JOIN menu_items mi ON i.product_code = mi.item_code" +
|
JOIN menu_items mi ON i.product_code = mi.item_code" +
|
||||||
" JOIN menu_categories mc ON mc.id = mi.menu_category_id
|
" JOIN menu_categories mc ON mc.id = mi.menu_category_id
|
||||||
JOIN employees ea ON ea.id = sales.cashier_id")
|
JOIN employees ea ON ea.id = sales.cashier_id")
|
||||||
|
|
||||||
|
|
||||||
query = query.where("receipt_date between ? and ? and sale_status=?",from,to,status)
|
query = query.where("receipt_date between ? and ? and sale_status=?",from,to,status)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -403,6 +442,51 @@ def self.get_by_range_by_saleitems(from,to,status,report_type)
|
|||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
def self.get_by_shiftsales(from,to)
|
||||||
|
return ShiftSale.where("(shift_started_at between ? and ? OR shift_closed_at between ? and ? )", from, to, from, to)
|
||||||
|
end
|
||||||
|
|
||||||
|
def get_cash_amount
|
||||||
|
cash = 0.0
|
||||||
|
self.sale_payments.each do |pay|
|
||||||
|
if pay.payment_method == 'cash'
|
||||||
|
cash = pay.payment_amount
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return cash
|
||||||
|
end
|
||||||
|
|
||||||
|
def get_credit_amount
|
||||||
|
credit = 0.0
|
||||||
|
self.sale_payments.each do |pay|
|
||||||
|
if pay.payment_method == 'creditnote'
|
||||||
|
credit = pay.payment_amount
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return credit
|
||||||
|
end
|
||||||
|
|
||||||
|
def get_other_amount
|
||||||
|
other = 0.0
|
||||||
|
self.sale_payments.each do |pay|
|
||||||
|
if pay.payment_method != 'cash' && pay.payment_method != 'creditnote'
|
||||||
|
other += pay.payment_amount
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return other
|
||||||
|
end
|
||||||
|
|
||||||
|
def get_commerical_tax
|
||||||
|
tax = 0.0
|
||||||
|
self.sale_taxes.each do |tax|
|
||||||
|
if tax.tax_name == "Commerical Tax"
|
||||||
|
tax += tax.tax_payable_amount
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def generate_custom_id
|
def generate_custom_id
|
||||||
|
|||||||
@@ -30,15 +30,17 @@ class SaleItem < ApplicationRecord
|
|||||||
# end
|
# end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Get Prices for each accounts (eg: food, beverage)
|
||||||
def self.calculate_price_by_accounts(sale_items)
|
def self.calculate_price_by_accounts(sale_items)
|
||||||
price_accounts = []
|
price_accounts = []
|
||||||
Account.all.each do |a|
|
Account.all.each do |a|
|
||||||
account_price = {:name => a.title, :price => 0}
|
account_price = {:name => a.title, :price => 0}
|
||||||
|
|
||||||
|
# Check for actual sale items
|
||||||
sale_items.each do |si|
|
sale_items.each do |si|
|
||||||
if si.account_id == a.id
|
if si.account_id == a.id
|
||||||
account_price[:price] = account_price[:price] + si.price
|
account_price[:price] = account_price[:price] + si.price
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
price_accounts.push(account_price)
|
price_accounts.push(account_price)
|
||||||
end
|
end
|
||||||
@@ -46,6 +48,24 @@ class SaleItem < ApplicationRecord
|
|||||||
return price_accounts
|
return price_accounts
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Get discount Prices for each accounts (eg: food, beverage)
|
||||||
|
def self.get_discount_price_by_accounts(sale_items)
|
||||||
|
discount_accounts = []
|
||||||
|
Account.all.each do |a|
|
||||||
|
discount_account = {:name => a.title, :price => 0}
|
||||||
|
|
||||||
|
# Check for actual sale items
|
||||||
|
sale_items.where("is_taxable = false AND remark = 'Discount'").find_each do |si|
|
||||||
|
if si.account_id == a.id
|
||||||
|
discount_account[:price] = (discount_account[:price] + si.price) * -1
|
||||||
|
end
|
||||||
|
end
|
||||||
|
discount_accounts.push(discount_account)
|
||||||
|
end
|
||||||
|
|
||||||
|
return discount_accounts
|
||||||
|
end
|
||||||
|
|
||||||
# Calculate rebate_by_account
|
# Calculate rebate_by_account
|
||||||
def self.calculate_rebate_by_account(sale_items)
|
def self.calculate_rebate_by_account(sale_items)
|
||||||
rebateacc = Account.where("rebate=?",true)
|
rebateacc = Account.where("rebate=?",true)
|
||||||
|
|||||||
@@ -77,6 +77,12 @@ class SalePayment < ApplicationRecord
|
|||||||
)
|
)
|
||||||
rescue Net::OpenTimeout
|
rescue Net::OpenTimeout
|
||||||
response = { status: false }
|
response = { status: false }
|
||||||
|
|
||||||
|
rescue OpenURI::HTTPError
|
||||||
|
response = { status: false}
|
||||||
|
|
||||||
|
rescue SocketError
|
||||||
|
response = { status: false}
|
||||||
end
|
end
|
||||||
return response;
|
return response;
|
||||||
end
|
end
|
||||||
@@ -110,6 +116,12 @@ class SalePayment < ApplicationRecord
|
|||||||
)
|
)
|
||||||
rescue Net::OpenTimeout
|
rescue Net::OpenTimeout
|
||||||
response = false
|
response = false
|
||||||
|
|
||||||
|
rescue OpenURI::HTTPError
|
||||||
|
response = { status: false}
|
||||||
|
|
||||||
|
rescue SocketError
|
||||||
|
response = { status: false}
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
response = false;
|
response = false;
|
||||||
@@ -131,7 +143,6 @@ class SalePayment < ApplicationRecord
|
|||||||
self.payment_status = "paid"
|
self.payment_status = "paid"
|
||||||
payment_method = self.save!
|
payment_method = self.save!
|
||||||
sale_update_payment_status(self.received_amount)
|
sale_update_payment_status(self.received_amount)
|
||||||
|
|
||||||
return payment_status
|
return payment_status
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -146,7 +157,6 @@ class SalePayment < ApplicationRecord
|
|||||||
payment_method = self.save!
|
payment_method = self.save!
|
||||||
|
|
||||||
sale_update_payment_status(self.received_amount)
|
sale_update_payment_status(self.received_amount)
|
||||||
|
|
||||||
return payment_status
|
return payment_status
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -161,7 +171,6 @@ class SalePayment < ApplicationRecord
|
|||||||
payment_method = self.save!
|
payment_method = self.save!
|
||||||
|
|
||||||
sale_update_payment_status(self.received_amount)
|
sale_update_payment_status(self.received_amount)
|
||||||
|
|
||||||
return payment_status
|
return payment_status
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -175,7 +184,6 @@ class SalePayment < ApplicationRecord
|
|||||||
self.outstanding_amount = self.sale.grand_total- self.received_amount
|
self.outstanding_amount = self.sale.grand_total- self.received_amount
|
||||||
self.payment_status = "paid"
|
self.payment_status = "paid"
|
||||||
payment_method = self.save!
|
payment_method = self.save!
|
||||||
|
|
||||||
sale_update_payment_status(self.received_amount)
|
sale_update_payment_status(self.received_amount)
|
||||||
|
|
||||||
return payment_status
|
return payment_status
|
||||||
@@ -192,7 +200,6 @@ class SalePayment < ApplicationRecord
|
|||||||
self.outstanding_amount = self.sale.grand_total- self.received_amount
|
self.outstanding_amount = self.sale.grand_total- self.received_amount
|
||||||
self.payment_status = "paid"
|
self.payment_status = "paid"
|
||||||
payment_method = self.save!
|
payment_method = self.save!
|
||||||
|
|
||||||
sale_update_payment_status(self.received_amount)
|
sale_update_payment_status(self.received_amount)
|
||||||
|
|
||||||
return payment_status
|
return payment_status
|
||||||
@@ -220,7 +227,6 @@ class SalePayment < ApplicationRecord
|
|||||||
else
|
else
|
||||||
sale_update_payment_status(0)
|
sale_update_payment_status(0)
|
||||||
end
|
end
|
||||||
|
|
||||||
return payment_status
|
return payment_status
|
||||||
|
|
||||||
end
|
end
|
||||||
@@ -249,10 +255,20 @@ class SalePayment < ApplicationRecord
|
|||||||
self.sale.save!
|
self.sale.save!
|
||||||
table_update_status(sObj)
|
table_update_status(sObj)
|
||||||
rebat(sObj)
|
rebat(sObj)
|
||||||
|
if paid_amount != "0.0"
|
||||||
|
update_shift
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def update_shift
|
||||||
|
shift = ShiftSale.current_open_shift(self.sale.cashier_id)
|
||||||
|
if !shift.nil?
|
||||||
|
shift.update(self.sale)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def table_update_status(sale_obj)
|
def table_update_status(sale_obj)
|
||||||
status = true
|
status = true
|
||||||
booking = Booking.find_by_sale_id(sale_obj.id)
|
booking = Booking.find_by_sale_id(sale_obj.id)
|
||||||
@@ -308,6 +324,12 @@ class SalePayment < ApplicationRecord
|
|||||||
}, :timeout => 10)
|
}, :timeout => 10)
|
||||||
rescue Net::OpenTimeout
|
rescue Net::OpenTimeout
|
||||||
response = { status: false }
|
response = { status: false }
|
||||||
|
|
||||||
|
rescue OpenURI::HTTPError
|
||||||
|
response = { status: false}
|
||||||
|
|
||||||
|
rescue SocketError
|
||||||
|
response = { status: false}
|
||||||
end
|
end
|
||||||
return response
|
return response
|
||||||
# puts response.to_json
|
# puts response.to_json
|
||||||
@@ -315,6 +337,8 @@ class SalePayment < ApplicationRecord
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private
|
private
|
||||||
def generate_custom_id
|
def generate_custom_id
|
||||||
self.sale_payment_id = SeedGenerator.generate_id(self.class.name, "SPI")
|
self.sale_payment_id = SeedGenerator.generate_id(self.class.name, "SPI")
|
||||||
|
|||||||
62
app/models/shift_sale.rb
Normal file
62
app/models/shift_sale.rb
Normal file
@@ -0,0 +1,62 @@
|
|||||||
|
|
||||||
|
#Description
|
||||||
|
#total_revenue = sum of all sub-total from sales table
|
||||||
|
#total_discounts = sum of all discount (overall) from sales tables
|
||||||
|
#total_taxes = sum of all taxes from sales table (Service + Goverment Tax (commercial_taxes))
|
||||||
|
#grand_total = total_revenue - total_discounts + total_taxes
|
||||||
|
#nett_sales = grand_total - commercial_taxes
|
||||||
|
#cash_sales = cash payment total revenue
|
||||||
|
#credit_sales = credit payment total revenue
|
||||||
|
#others_sales = [Sum of each of other payment type --- mpu, jcb, visa,master, rebate, vochure]
|
||||||
|
#commercial_taxes = Total Goverment tax due
|
||||||
|
#cash_in = Payment receive
|
||||||
|
#Cash_out = Payment issues for misc payments
|
||||||
|
|
||||||
|
class ShiftSale < ApplicationRecord
|
||||||
|
belongs_to :cashier_terminal
|
||||||
|
belongs_to :employee, :foreign_key => 'employee_id'
|
||||||
|
|
||||||
|
def self.current_open_shift(current_user)
|
||||||
|
#if current_user
|
||||||
|
#find open shift where is open today and is not closed and login by current cashier
|
||||||
|
today_date = DateTime.now.strftime("%Y-%m-%d")
|
||||||
|
puts today_date
|
||||||
|
shift = ShiftSale.where("TO_CHAR(shift_started_at, 'YYYY-MM-DD')=? and shift_started_at is not null and shift_closed_at is null and employee_id = #{current_user}", today_date).take
|
||||||
|
|
||||||
|
return shift
|
||||||
|
#end
|
||||||
|
end
|
||||||
|
|
||||||
|
def create(opening_balance,current_user)
|
||||||
|
self.cashier_terminal_id = CashierTerminal.first.id
|
||||||
|
self.shift_started_at = DateTime.now
|
||||||
|
self.employee_id = current_user.id
|
||||||
|
self.opening_balance = opening_balance
|
||||||
|
self.save
|
||||||
|
end
|
||||||
|
|
||||||
|
def update(sale)
|
||||||
|
saleobj = Sale.find_by_sale_id(sale)
|
||||||
|
cash = saleobj.get_cash_amount
|
||||||
|
credit = saleobj.get_credit_amount
|
||||||
|
other_sales = saleobj.get_other_amount
|
||||||
|
tax = saleobj.get_commerical_tax
|
||||||
|
self.total_revenue = self.total_revenue.to_f + saleobj.total_amount.to_f
|
||||||
|
self.total_discounts = self.total_discounts + saleobj.total_discount
|
||||||
|
self.total_taxes = self.total_taxes + saleobj.total_tax
|
||||||
|
self.grand_total = self.grand_total + saleobj.grand_total
|
||||||
|
self.cash_sales = self.cash_sales.to_f + cash.to_f
|
||||||
|
self.credit_sales = self.credit_sales.to_i + credit.to_f
|
||||||
|
self.other_sales = self.other_sales.to_i + other_sales.to_f
|
||||||
|
self.nett_sales = self.grand_total.to_i - self.commercial_taxes
|
||||||
|
self.commercial_taxes = self.commercial_taxes.to_i + tax.to_f
|
||||||
|
self.save
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
def get_closing_balance(shift)
|
||||||
|
shiftobj = ShiftSale.find(shift)
|
||||||
|
closing_balance = shiftobj.grand_total + shiftobj.cash_in - shiftobj.cash_out + shiftobj.total_cash
|
||||||
|
return closing_balance
|
||||||
|
end
|
||||||
|
end
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
class OrderItemPdf < Prawn::Document
|
class OrderItemPdf < Prawn::Document
|
||||||
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
|
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
|
||||||
def initialize(order_item, print_status, options)
|
def initialize(print_settings,order_item, print_status, options, alt_name)
|
||||||
self.page_width = 210
|
self.page_width = 210
|
||||||
self.page_height = 1450
|
self.page_height = 1450
|
||||||
self.margin = 5
|
self.margin = 5
|
||||||
@@ -12,12 +12,13 @@ class OrderItemPdf < Prawn::Document
|
|||||||
self.item_description_width = self.page_width - (self.price_width + self.qty_width + self.total_width)
|
self.item_description_width = self.page_width - (self.price_width + self.qty_width + self.total_width)
|
||||||
self.label_width=100
|
self.label_width=100
|
||||||
|
|
||||||
super(:margin => [self.margin, self.margin, self.margin, self.margin], :page_size => [self.page_width, self.page_height])
|
super(:margin => [print_settings.heading_space, self.margin, self.margin, self.margin], :page_size => [self.page_width, self.page_height])
|
||||||
# super(:margin => [10, 5, 30, 5], :page_size => [200,400])
|
# super(:margin => [10, 5, 30, 5], :page_size => [200,400])
|
||||||
|
|
||||||
# font "public/fonts/#{font_name}".to_s + ".ttf".to_s
|
# font "public/fonts/#{font_name}".to_s + ".ttf".to_s
|
||||||
# font "public/fonts/Zawgyi-One.ttf"
|
# font "public/fonts/Zawgyi-One.ttf"
|
||||||
# font "public/fonts/padauk.ttf"
|
# font "public/fonts/padauk.ttf"
|
||||||
|
#font "public/fonts/Chinese.ttf"
|
||||||
self.header_font_size = 12
|
self.header_font_size = 12
|
||||||
self.item_font_size = 10
|
self.item_font_size = 10
|
||||||
|
|
||||||
@@ -29,7 +30,7 @@ class OrderItemPdf < Prawn::Document
|
|||||||
order_info(order_item.order_id, order_item.order_by,order_item.order_at)
|
order_info(order_item.order_id, order_item.order_by,order_item.order_at)
|
||||||
|
|
||||||
# order items
|
# order items
|
||||||
order_items(order_item, options)
|
order_items(order_item, options, alt_name)
|
||||||
end
|
end
|
||||||
|
|
||||||
# Write Order Information to PDF
|
# Write Order Information to PDF
|
||||||
@@ -57,11 +58,11 @@ class OrderItemPdf < Prawn::Document
|
|||||||
end
|
end
|
||||||
|
|
||||||
# Write Order items to PDF
|
# Write Order items to PDF
|
||||||
def order_items(order_item, options)
|
def order_items(order_item, options, alt_name)
|
||||||
y_position = cursor
|
y_position = cursor
|
||||||
|
|
||||||
#Add Order Item
|
#Add Order Item
|
||||||
add_order_items(order_item, options)
|
add_order_items(order_item, options, alt_name)
|
||||||
|
|
||||||
dash(1, :space => 1, :phase => 1)
|
dash(1, :space => 1, :phase => 1)
|
||||||
stroke_horizontal_line 0, (self.page_width - self.margin)
|
stroke_horizontal_line 0, (self.page_width - self.margin)
|
||||||
@@ -69,19 +70,31 @@ class OrderItemPdf < Prawn::Document
|
|||||||
end
|
end
|
||||||
|
|
||||||
# Add order items under order info
|
# Add order items under order info
|
||||||
def add_order_items(order_item, options)
|
def add_order_items(order_item, options, alt_name)
|
||||||
y_position = cursor
|
y_position = cursor
|
||||||
|
|
||||||
move_down 5
|
move_down 5
|
||||||
|
|
||||||
bounding_box([0,y_position], :width => self.item_width, :height => self.item_height) do
|
bounding_box([0,y_position], :width => self.item_width) do
|
||||||
text "#{order_item.item_name}", :size => self.item_font_size,:align => :left
|
text "#{order_item.item_name}", :size => self.item_font_size,:align => :left
|
||||||
end
|
end
|
||||||
|
|
||||||
bounding_box([self.item_width,y_position], :width => self.qty_width, :height => self.item_height) do
|
bounding_box([self.item_width,y_position], :width => self.qty_width) do
|
||||||
text "[#{order_item.qty.to_i}]", :size => self.item_font_size,:align => :left
|
text "[#{order_item.qty.to_i}]", :size => self.item_font_size,:align => :left
|
||||||
end
|
end
|
||||||
|
|
||||||
|
bounding_box([0,y_position], :width => self.item_width) do
|
||||||
|
text "#{order_item.item_name}", :size => self.item_font_size,:align => :left
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
if alt_name
|
||||||
|
move_down 4
|
||||||
|
font("public/fonts/Chinese.ttf") do
|
||||||
|
text "(#{order_item.alt_name})", :size => self.item_font_size,:align => :left, :inline_format => true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
move_down 5
|
move_down 5
|
||||||
|
|
||||||
# add option
|
# add option
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
class OrderSummaryPdf < Prawn::Document
|
class OrderSummaryPdf < Prawn::Document
|
||||||
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
|
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
|
||||||
def initialize(order, print_status, order_items = nil)
|
def initialize(print_settings,order, print_status, order_items = nil,alt_name)
|
||||||
self.page_width = 210
|
self.page_width = 210
|
||||||
self.page_height = 1450
|
self.page_height = 1450
|
||||||
self.margin = 5
|
self.margin = 5
|
||||||
@@ -12,11 +12,11 @@ class OrderSummaryPdf < Prawn::Document
|
|||||||
self.item_description_width = self.page_width - (self.price_width + self.qty_width + self.total_width)
|
self.item_description_width = self.page_width - (self.price_width + self.qty_width + self.total_width)
|
||||||
self.label_width=100
|
self.label_width=100
|
||||||
|
|
||||||
super(:margin => [self.margin, self.margin, self.margin, self.margin], :page_size => [self.page_width, self.page_height])
|
super(:margin => [print_settings.heading_space, self.margin, self.margin, self.margin], :page_size => [self.page_width, self.page_height])
|
||||||
|
|
||||||
# font "public/fonts/#{font_name}".to_s + ".ttf".to_s
|
# font "public/fonts/#{font_name}".to_s + ".ttf".to_s
|
||||||
# font "public/fonts/Zawgyi-One.ttf"
|
# font "public/fonts/Zawgyi-One.ttf"
|
||||||
# font "public/fonts/padauk.ttf"
|
font "public/fonts/padauk.ttf"
|
||||||
self.header_font_size = 12
|
self.header_font_size = 12
|
||||||
self.item_font_size = 10
|
self.item_font_size = 10
|
||||||
|
|
||||||
@@ -29,9 +29,9 @@ class OrderSummaryPdf < Prawn::Document
|
|||||||
|
|
||||||
# order items
|
# order items
|
||||||
if order_items == nil
|
if order_items == nil
|
||||||
order_items(order)
|
order_items(order, alt_name)
|
||||||
else
|
else
|
||||||
order_items(order_items)
|
order_items(order_items, alt_name)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -60,7 +60,7 @@ class OrderSummaryPdf < Prawn::Document
|
|||||||
end
|
end
|
||||||
|
|
||||||
# Write Order items to PDF
|
# Write Order items to PDF
|
||||||
def order_items(order_item)
|
def order_items(order_item, alt_name)
|
||||||
y_position = cursor
|
y_position = cursor
|
||||||
|
|
||||||
bounding_box([0,y_position], :width => self.item_width, :height => self.item_height) do
|
bounding_box([0,y_position], :width => self.item_width, :height => self.item_height) do
|
||||||
@@ -75,12 +75,12 @@ class OrderSummaryPdf < Prawn::Document
|
|||||||
move_down 5
|
move_down 5
|
||||||
|
|
||||||
#Add Order Item
|
#Add Order Item
|
||||||
add_order_items(order_item)
|
add_order_items(order_item, alt_name)
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
# Add order items under order info
|
# Add order items under order info
|
||||||
def add_order_items(order_item)
|
def add_order_items(order_item, alt_name)
|
||||||
y_position = cursor
|
y_position = cursor
|
||||||
|
|
||||||
move_down 5
|
move_down 5
|
||||||
@@ -92,12 +92,26 @@ class OrderSummaryPdf < Prawn::Document
|
|||||||
|
|
||||||
bounding_box([0,y_position], :width => self.item_width) do
|
bounding_box([0,y_position], :width => self.item_width) do
|
||||||
text "#{odi.item_name}", :size => self.item_font_size,:align => :left
|
text "#{odi.item_name}", :size => self.item_font_size,:align => :left
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
bounding_box([self.item_width,y_position], :width => self.qty_width) do
|
bounding_box([self.item_width,y_position], :width => self.qty_width) do
|
||||||
text "#{odi.qty}", :size => self.item_font_size,:align => :left
|
text "#{odi.qty}", :size => self.item_font_size,:align => :left
|
||||||
end
|
end
|
||||||
|
|
||||||
|
bounding_box([0,y_position], :width => self.item_width) do
|
||||||
|
text "#{odi.item_name}", :size => self.item_font_size,:align => :left
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
if alt_name
|
||||||
|
move_down 4
|
||||||
|
font("public/fonts/Chinese.ttf") do
|
||||||
|
text "(#{odi.alt_name})", :size => self.item_font_size,:align => :left, :inline_format => true
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
move_down 5
|
move_down 5
|
||||||
|
|
||||||
# add option
|
# add option
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
class ReceiptBillPdf < Prawn::Document
|
class ReceiptBillPdf < Prawn::Document
|
||||||
|
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
|
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
|
||||||
def initialize(printer_settings, sale_items, sale_data, customer_name, item_price_by_accounts, member_info = nil,rebate_amount = nil,shop_details)
|
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)
|
||||||
self.page_width = 210
|
self.page_width = 210
|
||||||
self.page_height = 7000
|
self.page_height = 7000
|
||||||
self.margin = 5
|
self.margin = 5
|
||||||
@@ -16,7 +17,7 @@ class ReceiptBillPdf < Prawn::Document
|
|||||||
# @double = @qty_width * 1.3
|
# @double = @qty_width * 1.3
|
||||||
# @half_qty = @qty_width / 2
|
# @half_qty = @qty_width / 2
|
||||||
#setting page margin and width
|
#setting page margin and width
|
||||||
super(:margin => [self.margin, self.margin, self.margin, self.margin], :page_size => [self.page_width, self.page_height])
|
super(:margin => [printer_settings.heading_space, self.margin, self.margin, self.margin], :page_size => [self.page_width, self.page_height])
|
||||||
|
|
||||||
# font "public/fonts/#{font_name}".to_s + ".ttf".to_s
|
# font "public/fonts/#{font_name}".to_s + ".ttf".to_s
|
||||||
# font "public/fonts/Zawgyi-One.ttf"
|
# font "public/fonts/Zawgyi-One.ttf"
|
||||||
@@ -24,22 +25,33 @@ class ReceiptBillPdf < Prawn::Document
|
|||||||
self.header_font_size = 10
|
self.header_font_size = 10
|
||||||
self.item_font_size = 8
|
self.item_font_size = 8
|
||||||
|
|
||||||
|
if printer_settings.delimiter
|
||||||
|
delimiter = ","
|
||||||
|
else
|
||||||
|
delimiter = ""
|
||||||
|
end
|
||||||
|
|
||||||
header( shop_details)
|
header( shop_details)
|
||||||
|
|
||||||
stroke_horizontal_rule
|
stroke_horizontal_rule
|
||||||
|
|
||||||
cashier_info(sale_data, customer_name)
|
cashier_info(sale_data, customer_name)
|
||||||
line_items(sale_items)
|
line_items(sale_items,printer_settings.precision,delimiter)
|
||||||
all_total(sale_data)
|
all_total(sale_data,printer_settings.precision,delimiter)
|
||||||
|
|
||||||
|
|
||||||
if member_info != nil
|
if member_info != nil
|
||||||
member_info(member_info,customer_name,rebate_amount,sale_data)
|
member_info(member_info,customer_name,rebate_amount,sale_data,printer_settings.precision,delimiter)
|
||||||
end
|
end
|
||||||
|
|
||||||
customer(customer_name)
|
customer(customer_name)
|
||||||
|
|
||||||
items_account(item_price_by_accounts)
|
if discount_price_by_accounts.length > 0
|
||||||
|
discount_account(discount_price_by_accounts,printer_settings.precision,delimiter)
|
||||||
|
end
|
||||||
|
|
||||||
|
items_account(item_price_by_accounts,printer_settings.precision,delimiter)
|
||||||
|
|
||||||
|
|
||||||
footer
|
footer
|
||||||
end
|
end
|
||||||
@@ -83,7 +95,7 @@ class ReceiptBillPdf < Prawn::Document
|
|||||||
|
|
||||||
y_position = cursor
|
y_position = cursor
|
||||||
bounding_box([0,y_position], :width =>self.page_width - 10, :height => self.item_height) do
|
bounding_box([0,y_position], :width =>self.page_width - 10, :height => self.item_height) do
|
||||||
text "Receipt Date : #{ sale_data.receipt_date.strftime('%d-%m-%Y') } ( #{ sale_data.bookings[0].checkin_at.utc.getlocal.strftime('%I:%M %p') } - #{ sale_data.bookings[0].checkin_at.utc.getlocal.strftime('%I:%M %p') } )",:size => self.item_font_size,:align => :left
|
text "Receipt Date : #{ sale_data.receipt_date.strftime('%d-%m-%Y') } ( #{ sale_data.bookings[0].checkin_at.utc.getlocal.strftime('%I:%M %p') } - #{ sale_data.bookings[0].checkout_at.utc.getlocal.strftime('%I:%M %p') } )",:size => self.item_font_size,:align => :left
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
@@ -97,7 +109,7 @@ class ReceiptBillPdf < Prawn::Document
|
|||||||
stroke_horizontal_rule
|
stroke_horizontal_rule
|
||||||
end
|
end
|
||||||
|
|
||||||
def line_items(sale_items)
|
def line_items(sale_items,precision,delimiter)
|
||||||
move_down 5
|
move_down 5
|
||||||
y_position = cursor
|
y_position = cursor
|
||||||
move_down 5
|
move_down 5
|
||||||
@@ -110,10 +122,10 @@ class ReceiptBillPdf < Prawn::Document
|
|||||||
}
|
}
|
||||||
move_down -5
|
move_down -5
|
||||||
stroke_horizontal_rule
|
stroke_horizontal_rule
|
||||||
add_line_item_row(sale_items)
|
add_line_item_row(sale_items,precision,delimiter)
|
||||||
end
|
end
|
||||||
|
|
||||||
def add_line_item_row(sale_items)
|
def add_line_item_row(sale_items,precision,delimiter)
|
||||||
item_name_width = (self.item_width+self.price_width)
|
item_name_width = (self.item_width+self.price_width)
|
||||||
y_position = cursor
|
y_position = cursor
|
||||||
move_down 5
|
move_down 5
|
||||||
@@ -132,9 +144,9 @@ class ReceiptBillPdf < Prawn::Document
|
|||||||
|
|
||||||
pad_top(15) {
|
pad_top(15) {
|
||||||
text_box "#{product_name}", :at =>[0,y_position], :width => self.item_width, :height =>self.item_height, :size => self.item_font_size, :overflow => :shrink_to_fix
|
text_box "#{product_name}", :at =>[0,y_position], :width => self.item_width, :height =>self.item_height, :size => self.item_font_size, :overflow => :shrink_to_fix
|
||||||
text_box "#{price}", :at =>[self.item_width,y_position], :width => self.price_width, :height =>self.item_height, :size => self.item_font_size, :align => :right, :overflow => :shrink_to_fix
|
text_box "#{number_with_precision(price, :precision => precision.to_i, :delimiter => delimiter)}", :at =>[self.item_width,y_position], :width => self.price_width, :height =>self.item_height, :size => self.item_font_size, :align => :right, :overflow => :shrink_to_fix
|
||||||
text_box "#{qty}", :at =>[item_name_width,y_position], :width => self.qty_width, :height =>self.item_height, :size => self.item_font_size, :align => :center, :overflow => :shrink_to_fix
|
text_box "#{qty}", :at =>[item_name_width,y_position], :width => self.qty_width, :height =>self.item_height, :size => self.item_font_size, :align => :center, :overflow => :shrink_to_fix
|
||||||
text_box "#{total_price}", :at =>[(item_name_width+4),y_position], :width =>self.total_width+3, :height =>self.item_height, :size => self.item_font_size, :align => :right, :overflow => :shrink_to_fix
|
text_box "#{number_with_precision(total_price, :precision => precision.to_i, :delimiter => delimiter)}", :at =>[(item_name_width+4),y_position], :width =>self.total_width+3, :height =>self.item_height, :size => self.item_font_size, :align => :right, :overflow => :shrink_to_fix
|
||||||
}
|
}
|
||||||
move_down 1
|
move_down 1
|
||||||
end
|
end
|
||||||
@@ -148,20 +160,20 @@ class ReceiptBillPdf < Prawn::Document
|
|||||||
text "Sub Total", :size => self.item_font_size,:align => :left
|
text "Sub Total", :size => self.item_font_size,:align => :left
|
||||||
end
|
end
|
||||||
bounding_box([self.item_description_width,y_position], :width =>self.label_width) do
|
bounding_box([self.item_description_width,y_position], :width =>self.label_width) do
|
||||||
text "#{ sub_total }" , :size => self.item_font_size,:align => :right
|
text "#{number_with_precision(sub_total, :precision => precision.to_i, :delimiter => delimiter)}" ,:delimiter => ',', :size => self.item_font_size,:align => :right
|
||||||
end
|
end
|
||||||
move_down 5
|
move_down 5
|
||||||
end
|
end
|
||||||
|
|
||||||
def all_total(sale_data)
|
def all_total(sale_data,precision,delimiter)
|
||||||
item_name_width = self.item_width
|
item_name_width = self.item_width
|
||||||
y_position = cursor
|
y_position = cursor
|
||||||
|
|
||||||
bounding_box([0,y_position], :width =>self.item_description_width, :height => self.item_height) do
|
bounding_box([0,y_position], :width =>self.item_description_width, :height => self.item_height) do
|
||||||
text "Discount", :size => self.item_font_size,:align => :left
|
text "Overall Discount", :size => self.item_font_size,:align => :left
|
||||||
end
|
end
|
||||||
bounding_box([self.item_description_width,y_position], :width =>self.label_width) do
|
bounding_box([self.item_description_width,y_position], :width =>self.label_width) do
|
||||||
text "( " +"#{sale_data.total_discount}" +" )" , :size => self.item_font_size,:align => :right
|
text "( #{number_with_precision(sale_data.total_discount, :precision => precision.to_i, :delimiter => delimiter)} )" , :size => self.item_font_size,:align => :right
|
||||||
end
|
end
|
||||||
|
|
||||||
if sale_data.sale_taxes.length > 0
|
if sale_data.sale_taxes.length > 0
|
||||||
@@ -173,7 +185,7 @@ class ReceiptBillPdf < Prawn::Document
|
|||||||
text "#{ st.tax_name }", :size => self.item_font_size,:align => :left
|
text "#{ st.tax_name }", :size => self.item_font_size,:align => :left
|
||||||
end
|
end
|
||||||
bounding_box([self.item_description_width,y_position], :width =>self.label_width) do
|
bounding_box([self.item_description_width,y_position], :width =>self.label_width) do
|
||||||
text "#{ st.tax_payable_amount }" , :size => self.item_font_size,:align => :right
|
text "#{number_with_precision(st.tax_payable_amount, :precision => precision.to_i, :delimiter => delimiter)}" , :size => self.item_font_size,:align => :right
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
@@ -194,18 +206,18 @@ class ReceiptBillPdf < Prawn::Document
|
|||||||
y_position = cursor
|
y_position = cursor
|
||||||
move_down 5
|
move_down 5
|
||||||
bounding_box([0,y_position], :width =>self.item_description_width, :height => self.item_height) do
|
bounding_box([0,y_position], :width =>self.item_description_width, :height => self.item_height) do
|
||||||
text "Grand Total", :size => self.header_font_size,:align => :left
|
text "Grand Total",:style => :bold, :size => self.header_font_size,:align => :left
|
||||||
end
|
end
|
||||||
bounding_box([self.item_description_width,y_position], :width =>self.label_width) do
|
bounding_box([self.item_description_width,y_position], :width =>self.label_width) do
|
||||||
text "#{sale_data.grand_total}" , :size => self.header_font_size,:align => :right
|
text "#{number_with_precision(sale_data.grand_total, :precision => precision.to_i, :delimiter => delimiter)}" , :style => :bold, :size => self.header_font_size,:align => :right
|
||||||
end
|
end
|
||||||
move_down 5
|
move_down 5
|
||||||
|
|
||||||
sale_payment(sale_data)
|
sale_payment(sale_data,precision,delimiter)
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def sale_payment(sale_data)
|
def sale_payment(sale_data,precision,delimiter)
|
||||||
|
|
||||||
stroke_horizontal_rule
|
stroke_horizontal_rule
|
||||||
move_down 5
|
move_down 5
|
||||||
@@ -216,7 +228,7 @@ class ReceiptBillPdf < Prawn::Document
|
|||||||
text "#{payment.payment_method.capitalize} Payment", :size => self.item_font_size,:align => :left
|
text "#{payment.payment_method.capitalize} Payment", :size => self.item_font_size,:align => :left
|
||||||
end
|
end
|
||||||
bounding_box([self.item_description_width,y_position], :width =>self.label_width) do
|
bounding_box([self.item_description_width,y_position], :width =>self.label_width) do
|
||||||
text "#{ payment.payment_amount }" , :size => self.item_font_size,:align => :right
|
text "#{number_with_precision(payment.payment_amount, :precision => precision.to_i, :delimiter => delimiter)}" , :size => self.item_font_size,:align => :right
|
||||||
end
|
end
|
||||||
move_down 5
|
move_down 5
|
||||||
end
|
end
|
||||||
@@ -227,7 +239,7 @@ class ReceiptBillPdf < Prawn::Document
|
|||||||
text "Change Amount", :size => self.item_font_size,:align => :left
|
text "Change Amount", :size => self.item_font_size,:align => :left
|
||||||
end
|
end
|
||||||
bounding_box([self.item_description_width,y_position], :width =>self.label_width) do
|
bounding_box([self.item_description_width,y_position], :width =>self.label_width) do
|
||||||
text "#{sale_data.amount_changed}" , :size => self.item_font_size,:align => :right
|
text "#{number_with_precision(sale_data.amount_changed, :precision => precision.to_i, :delimiter => delimiter)}" , :size => self.item_font_size,:align => :right
|
||||||
end
|
end
|
||||||
move_down 5
|
move_down 5
|
||||||
end
|
end
|
||||||
@@ -235,7 +247,7 @@ class ReceiptBillPdf < Prawn::Document
|
|||||||
end
|
end
|
||||||
|
|
||||||
# show member information
|
# show member information
|
||||||
def member_info(member_info,customer_name,rebate_amount,sale_data)
|
def member_info(member_info,customer_name,rebate_amount,sale_data,precision,delimiter)
|
||||||
|
|
||||||
if rebate_amount != nil
|
if rebate_amount != nil
|
||||||
|
|
||||||
@@ -251,7 +263,7 @@ class ReceiptBillPdf < Prawn::Document
|
|||||||
text "Current Rebate Amount", :size => self.item_font_size,:align => :left
|
text "Current Rebate Amount", :size => self.item_font_size,:align => :left
|
||||||
end
|
end
|
||||||
bounding_box([self.item_description_width,y_position], :width =>self.label_width) do
|
bounding_box([self.item_description_width,y_position], :width =>self.label_width) do
|
||||||
text "#{ res["rebate"] }" , :size => self.item_font_size,:align => :right
|
text "#{number_with_precision(res["rebate"], :precision => precision.to_i, :delimiter => delimiter)}" , :size => self.item_font_size,:align => :right
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if res["receipt_no"]== sale_data.receipt_no && res["status"]== "Redeem"
|
if res["receipt_no"]== sale_data.receipt_no && res["status"]== "Redeem"
|
||||||
@@ -262,15 +274,15 @@ class ReceiptBillPdf < Prawn::Document
|
|||||||
text "Current Redeem Amount", :size => self.item_font_size,:align => :left
|
text "Current Redeem Amount", :size => self.item_font_size,:align => :left
|
||||||
end
|
end
|
||||||
bounding_box([self.item_description_width,y_position], :width =>self.label_width) do
|
bounding_box([self.item_description_width,y_position], :width =>self.label_width) do
|
||||||
text "(#{ res["redeem"] })" , :size => self.item_font_size,:align => :right
|
text "#{number_with_precision(res["redeem"], :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size,:align => :right
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if member_info["status"] == true
|
if member_info["status"] == true && member_info["data"].present?
|
||||||
balance = 0.0
|
balance = 0
|
||||||
member_info["data"].each do |res|
|
member_info["data"].each do |res|
|
||||||
|
|
||||||
if res["accountable_type"] == "RebateAccount" || res["accountable_type"] == "RebatebonusAccount"
|
if res["accountable_type"] == "RebateAccount" || res["accountable_type"] == "RebatebonusAccount"
|
||||||
@@ -285,7 +297,7 @@ class ReceiptBillPdf < Prawn::Document
|
|||||||
text "Current Balance", :size => self.item_font_size,:align => :left
|
text "Current Balance", :size => self.item_font_size,:align => :left
|
||||||
end
|
end
|
||||||
bounding_box([self.item_description_width,y_position], :width =>self.label_width) do
|
bounding_box([self.item_description_width,y_position], :width =>self.label_width) do
|
||||||
text "#{ balance }" , :size => self.item_font_size,:align => :right
|
text "#{number_with_precision(balance, :precision => precision.to_i, :delimiter => delimiter)}" , :size => self.item_font_size,:align => :right
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -301,8 +313,23 @@ class ReceiptBillPdf < Prawn::Document
|
|||||||
text "#{ customer_name }" , :size => self.item_font_size,:align => :right
|
text "#{ customer_name }" , :size => self.item_font_size,:align => :right
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
def discount_account(discount_price_by_accounts,precision,delimiter)
|
||||||
|
move_down 5
|
||||||
|
stroke_horizontal_rule
|
||||||
|
move_down 5
|
||||||
|
y_position = cursor
|
||||||
|
discount_price_by_accounts.each do |ipa|
|
||||||
|
y_position = cursor
|
||||||
|
bounding_box([0,y_position], :width =>self.item_description_width, :height => self.item_height) do
|
||||||
|
text "#{ 'Total ' + ipa[:name] + ' Discounts' }", :size => self.item_font_size,:align => :left
|
||||||
|
end
|
||||||
|
bounding_box([self.item_description_width,y_position], :width =>self.label_width) do
|
||||||
|
text "(" + "#{ number_with_precision(ipa[:price], :precision => precision.to_i, :delimiter => delimiter) }" + ")" , :size => self.item_font_size,:align => :right
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def items_account(item_price_by_accounts)
|
def items_account(item_price_by_accounts,precision,delimiter)
|
||||||
move_down 5
|
move_down 5
|
||||||
stroke_horizontal_rule
|
stroke_horizontal_rule
|
||||||
move_down 5
|
move_down 5
|
||||||
@@ -313,7 +340,7 @@ class ReceiptBillPdf < Prawn::Document
|
|||||||
text "#{ ipa[:name] }", :size => self.item_font_size,:align => :left
|
text "#{ ipa[:name] }", :size => self.item_font_size,:align => :left
|
||||||
end
|
end
|
||||||
bounding_box([self.item_description_width,y_position], :width =>self.label_width) do
|
bounding_box([self.item_description_width,y_position], :width =>self.label_width) do
|
||||||
text "#{ ipa[:price] }" , :size => self.item_font_size,:align => :right
|
text "#{number_with_precision(ipa[:price], :precision => precision.to_i, :delimiter => delimiter)}" , :size => self.item_font_size,:align => :right
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -18,19 +18,25 @@
|
|||||||
<div class="active" role="tabpanel">
|
<div class="active" role="tabpanel">
|
||||||
<div class="tab-pane" role="tabpanel">
|
<div class="tab-pane" role="tabpanel">
|
||||||
<div class="card-columns" style="padding-top:10px; column-gap: 1.2rem;">
|
<div class="card-columns" style="padding-top:10px; column-gap: 1.2rem;">
|
||||||
<% @i =0 %>
|
|
||||||
<% @dining_queues.each do |queue| %>
|
<% @dining_queues.each do |queue| %>
|
||||||
<div class="card select-queue <%= !queue.status.nil? ? "assign" : ""%>" data-id="<%= queue.id %>">
|
<% if queue.status == "Assign"
|
||||||
|
@bg_color = "assign"
|
||||||
|
elsif queue.status == "Cancel"
|
||||||
|
@bg_color = "cancel"
|
||||||
|
else
|
||||||
|
@bg_color = "normal"
|
||||||
|
end
|
||||||
|
%>
|
||||||
|
<div class="card select-queue <%= @bg_color %>" data-id="<%= queue.id %>" style="width: 21.5rem;">
|
||||||
<div class="card-block">
|
<div class="card-block">
|
||||||
<p class="hidden queue-id"><%= queue.id %></p>
|
<p class="hidden queue-id"><%= queue.id %></p>
|
||||||
<p class="hidden queue-status"><%= queue.status %></p>
|
<p class="hidden queue-status"><%= queue.status %></p>
|
||||||
<span class="card-title">
|
<span class="card-title"><strong> Queue No : <%= queue.queue_no %></strong></span>
|
||||||
<%= @i += 1 %> . Queue No </span>
|
<span class="card-title pull-right"><strong> Seater : <%= queue.seater %></strong></span><br>
|
||||||
<span class="card-title pull-right">Seater : <%= queue.seater %> </span>
|
<span class="card-title"> Name : <%= queue.name %></span><br>
|
||||||
<p style="font-size: 30px ;text-align: center;">
|
<span class="card-title"> Contact No : <%= queue.contact_no %></span>
|
||||||
<strong><%= queue.queue_no %></strong>
|
<span class="card-title"> Remark : <%= queue.remark %></span>
|
||||||
</p>
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -43,7 +49,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="col-lg-1 col-md-1 col-sm-1">
|
<div class="col-lg-1 col-md-1 col-sm-1">
|
||||||
<button type="button" id="assign" class="btn btn-primary btn-lg btn-block" disabled>Assign</button>
|
<button type="button" id="assign" class="btn btn-primary btn-lg btn-block" disabled>Assign</button>
|
||||||
|
<button type="button" id="cancel" class="btn btn-warning btn-lg btn-block" disabled>Cancel</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
@@ -53,20 +59,61 @@ $(function(){
|
|||||||
$('.select-queue').removeClass('selected-item');
|
$('.select-queue').removeClass('selected-item');
|
||||||
$(this).addClass('selected-item');
|
$(this).addClass('selected-item');
|
||||||
var status = $(this).find(".queue-status").text();
|
var status = $(this).find(".queue-status").text();
|
||||||
if(status != "Assign"){
|
if(status != "Assign" && status != "Cancel"){
|
||||||
$("#assign").removeAttr("disabled");
|
$("#assign").removeAttr("disabled");
|
||||||
|
$("#cancel").removeAttr("disabled");
|
||||||
}else{
|
}else{
|
||||||
$("#assign").attr("disabled","disabled");
|
$("#assign").attr("disabled","disabled");
|
||||||
|
$("#cancel").attr("disabled","disabled");
|
||||||
}
|
}
|
||||||
$("#assign").val($(this).find(".queue-id").text());
|
$("#assign").val($(this).find(".queue-id").text());
|
||||||
|
$("#cancel").val($(this).find(".queue-id").text());
|
||||||
}); //End Click
|
}); //End Click
|
||||||
|
|
||||||
|
|
||||||
});
|
});
|
||||||
$('#assign').click(function() {
|
$('#assign').click(function() {
|
||||||
var id = $(this).val();
|
var id = $(this).val();
|
||||||
window.location.href = "dining_queues/"+id + "/assign"
|
window.location.href = "dining_queues/"+id + "/assign"
|
||||||
|
});
|
||||||
|
|
||||||
});
|
$('#cancel').click(function() {
|
||||||
|
var id = $(this).val();
|
||||||
|
url = '<%= crm_cancel_queue_path %>';
|
||||||
|
cancel_queue(id,url);
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
function cancel_queue(id,url) {
|
||||||
|
$.confirm({
|
||||||
|
title: 'Confirm!',
|
||||||
|
content: 'Are You Sure to cancel this Queue!',
|
||||||
|
buttons: {
|
||||||
|
cancel: function () {
|
||||||
|
},
|
||||||
|
confirm: {
|
||||||
|
text: 'Confirm',
|
||||||
|
btnClass: 'btn-green',
|
||||||
|
keys: ['enter', 'shift'],
|
||||||
|
action: function(){
|
||||||
|
$.ajax({
|
||||||
|
type: "POST",
|
||||||
|
url: url ,
|
||||||
|
data: {id:id},
|
||||||
|
dataType: "json",
|
||||||
|
success: function(data) {
|
||||||
|
if(data.status == true)
|
||||||
|
{
|
||||||
|
location.reload();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
@@ -1,14 +1,24 @@
|
|||||||
<style>
|
<style>
|
||||||
.pin_pad {
|
.pin_pad {
|
||||||
width:10rem;
|
width: 30%;
|
||||||
height:10rem;
|
height:70px;
|
||||||
text-align: center;
|
line-height:70px;
|
||||||
vertical-align: middle;
|
text-align:center;
|
||||||
line-height: 10rem;
|
background:#54A5AF;
|
||||||
margin:2px;
|
font-size:20px;
|
||||||
margin-top:4px;
|
color:white;
|
||||||
margin-bottom:4px;
|
}
|
||||||
font-size:3rem;
|
.bottom{
|
||||||
|
margin-bottom: 1px;
|
||||||
|
}
|
||||||
|
.left{
|
||||||
|
margin-left:1px;
|
||||||
|
}
|
||||||
|
.orange{
|
||||||
|
background-color:#FF7F50;
|
||||||
|
}
|
||||||
|
.purple {
|
||||||
|
background-color:#7a62d3;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
@@ -23,21 +33,29 @@
|
|||||||
<%= f.input :password, label: "Access PIN", required: false, class: "form-control" %>
|
<%= f.input :password, label: "Access PIN", required: false, class: "form-control" %>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="content" style="margin:10px; margin-top:0px; text-align:center">
|
<div class="content row" style="padding-left:10px;margin-left:10px; margin-top:0px; text-align:center">
|
||||||
<button class="pin_pad" data-value="1">1</button>
|
<div class='col-md-12'>
|
||||||
<button class="pin_pad" data-value="2">2</button>
|
<div class='row bottom'>
|
||||||
<button class="pin_pad" data-value="3">3</button>
|
<div class="pin_pad " data-value="1">1</div>
|
||||||
<button class="pin_pad" data-value="4">4</button>
|
<div class="pin_pad left" data-value="2">2</div>
|
||||||
<button class="pin_pad" data-value="5">5</button>
|
<div class="pin_pad left" data-value="3">3</div>
|
||||||
<button class="pin_pad" data-value="6">6</button>
|
</div>
|
||||||
<button class="pin_pad" data-value="7">7</button>
|
<div class='row bottom'>
|
||||||
<button class="pin_pad" data-value="8">8</button>
|
<div class="pin_pad" data-value="4">4</div>
|
||||||
<button class="pin_pad" data-value="9">9</button>
|
<div class="pin_pad left" data-value="5">5</div>
|
||||||
<button class="pin_pad" data-value="CLR">CLR</button>
|
<div class="pin_pad left" data-value="6">6</div>
|
||||||
<button class="pin_pad" data-value="8">0</button>
|
</div>
|
||||||
<button class="pin_pad btn-warning" data-value="ENT">ENT</button>
|
<div class='row bottom'>
|
||||||
|
<div class="pin_pad" data-value="7">7</div>
|
||||||
|
<div class="pin_pad left" data-value="8">8</div>
|
||||||
|
<div class="pin_pad left" data-value="9">9</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class='row bottom'>
|
||||||
|
<div class="pin_pad orange" data-value="CLR">CLR</div>
|
||||||
|
<div class="pin_pad left" data-value="8">0</div>
|
||||||
|
<div class="pin_pad left purple" data-value="ENT">ENT</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<div class="footer text-center" style="margin:10px">
|
<div class="footer text-center" style="margin:10px">
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -33,15 +33,16 @@
|
|||||||
<ul class="dropdown-menu">
|
<ul class="dropdown-menu">
|
||||||
<li><%= link_to "Orders ", transactions_orders_path, :tabindex =>"-1" %></li>
|
<li><%= link_to "Orders ", transactions_orders_path, :tabindex =>"-1" %></li>
|
||||||
<li><%= link_to "Sales ", transactions_sales_path, :tabindex =>"-1" %></li>
|
<li><%= link_to "Sales ", transactions_sales_path, :tabindex =>"-1" %></li>
|
||||||
<!-- <li><%= link_to "Sales ", transactions_credit_notes_path, :tabindex =>"-1" %></li> -->
|
<li><%= link_to "Credit Note ", transactions_credit_notes_path, :tabindex =>"-1" %></li>
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
<li class="navbar-nav mr-auto dropdown">
|
<li class="navbar-nav mr-auto dropdown">
|
||||||
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false"> Reports</a>
|
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false"> Reports</a>
|
||||||
<ul class="dropdown-menu">
|
<ul class="dropdown-menu">
|
||||||
<li><%= link_to "Daily Sale Report", reports_daily_sales_path, :tabindex =>"-1" %></li>
|
<li><%= link_to "Daily Sale Report", reports_dailysale_index_path, :tabindex =>"-1" %></li>
|
||||||
<li><%= link_to "Sales Item Report", reports_sale_items_path, :tabindex =>"-1" %></li>
|
<li><%= link_to "Sales Item Report", reports_saleitem_index_path, :tabindex =>"-1" %></li>
|
||||||
<li><%= link_to "Receipt Report", reports_receipt_no_index_path, :tabindex =>"-1" %></li>
|
<li><%= link_to "Receipt Report", reports_receipt_no_index_path, :tabindex =>"-1" %></li>
|
||||||
|
<!-- <li><%= link_to "Shift Sale Report", reports_shiftsale_index_path, :tabindex =>"-1" %></li> -->
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|||||||
@@ -19,14 +19,14 @@
|
|||||||
<%= render 'layouts/header_orgiami' %>
|
<%= render 'layouts/header_orgiami' %>
|
||||||
<div class="container-fluid">
|
<div class="container-fluid">
|
||||||
<% flash.each do |type, message| %>
|
<% flash.each do |type, message| %>
|
||||||
<% if !flash["errors"]%>
|
<% if !flash["errors"]%>
|
||||||
<div class="alert fade in">
|
<div class="alert fade in">
|
||||||
<button class="close" aria-hidden="true" data-dismiss="alert" type="button">×</button>
|
<button class="close" aria-hidden="true" data-dismiss="alert" type="button">×</button>
|
||||||
<%=message%>
|
<%=message%>
|
||||||
</div>
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<% end %>
|
<% end %>
|
||||||
<%= yield %>
|
<%= yield %>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
79
app/views/origami/cash_ins/new.html.erb
Normal file
79
app/views/origami/cash_ins/new.html.erb
Normal file
@@ -0,0 +1,79 @@
|
|||||||
|
|
||||||
|
<div class='row'>
|
||||||
|
<div class="col-lg-11 col-md-11 col-sm-11">
|
||||||
|
<h2> Payment Credit </h2>
|
||||||
|
<br>
|
||||||
|
<table class='table table-striped'>
|
||||||
|
<tr>
|
||||||
|
<td> Payment Reference
|
||||||
|
</td>
|
||||||
|
<td><input type='text' id='reference'/></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td> Remark
|
||||||
|
</td>
|
||||||
|
<td><input type="text" id='remark'/></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td> Payment Method
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<button class='btn btn-primary payment-type' data-id='cash' id='cash'>CASH</button>
|
||||||
|
<button class='btn btn-primary payment-type' data-id='mpu' id='mpu'>MPU</button>
|
||||||
|
<button class='btn btn-primary payment-type' data-id='visa' id='visa'>VISA</button>
|
||||||
|
<button class='btn btn-primary payment-type' data-id='jcb' id='jcb'>JCB</button>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<div class='row'>
|
||||||
|
<div class='col-md-2'></div>
|
||||||
|
<div class='col-md-2'>Reference Number </div>
|
||||||
|
<div class='col-md-4'><input type='text' id='payment_method_reference'/> </div>
|
||||||
|
</div>
|
||||||
|
<br>
|
||||||
|
<div class='row'>
|
||||||
|
<div class='col-md-2'></div>
|
||||||
|
<div class='col-md-2'>Amount</div>
|
||||||
|
<div class='col-md-4'><input type='text' id='amount'/></div>
|
||||||
|
</div>
|
||||||
|
<br><br>
|
||||||
|
<div class='row'>
|
||||||
|
<div class='col-md-3'></div>
|
||||||
|
<div class='col-md-4'><button class='btn btn-primary btn-lg' id='cash_in' style='width:200px;'> Cash In</button></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-lg-1 col-md-1 col-sm-1">
|
||||||
|
<button class='btn btn-primary ' id='cash_in' style='width:100px;'> Back </button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
var payment_method = "";
|
||||||
|
$('.payment-type').on('click',function(){
|
||||||
|
$('.payment-type').css("background-color","#7a62d3")
|
||||||
|
$(this).css("background-color","green");
|
||||||
|
var type = $(this).attr('data-id')
|
||||||
|
if(type == 'cash'){
|
||||||
|
payment_method = 'cash';
|
||||||
|
}else if(type == 'mpu'){
|
||||||
|
payment_method = "mpu";
|
||||||
|
}else if(type == 'visa'){
|
||||||
|
payment_method = "visa";
|
||||||
|
}else if(type == 'jcb'){
|
||||||
|
payment_method = "jcb";
|
||||||
|
}
|
||||||
|
})
|
||||||
|
$('#cash_in').on('click',function(){
|
||||||
|
var reference = $('#reference').val();
|
||||||
|
var remark = $('#remark').val();
|
||||||
|
var amount = $('#amount').val();
|
||||||
|
var payment_method_reference = $('#payment_method_reference').val();
|
||||||
|
$.ajax({type: "POST",
|
||||||
|
url: "<%= origami_cash_ins_path %>",
|
||||||
|
data: "reference="+ reference + "&remark=" + remark + "&amount="+ amount + "&payment_method="+payment_method + "&payment_method_reference="+ payment_method_reference,
|
||||||
|
success:function(result){
|
||||||
|
window.location.href = '/origami';
|
||||||
|
}
|
||||||
|
});
|
||||||
|
})
|
||||||
|
</script>
|
||||||
2
app/views/origami/cash_mgmt/create.html.erb
Normal file
2
app/views/origami/cash_mgmt/create.html.erb
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
<h1>CashMgmt#create</h1>
|
||||||
|
<p>Find me in app/views/cash_mgmt/create.html.erb</p>
|
||||||
2
app/views/origami/cash_mgmt/index.html.erb
Normal file
2
app/views/origami/cash_mgmt/index.html.erb
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
<h1>CashMgmt#index</h1>
|
||||||
|
<p>Find me in app/views/cash_mgmt/index.html.erb</p>
|
||||||
2
app/views/origami/cash_mgmt/new.html.erb
Normal file
2
app/views/origami/cash_mgmt/new.html.erb
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
<h1>CashMgmt#new</h1>
|
||||||
|
<p>Find me in app/views/cash_mgmt/new.html.erb</p>
|
||||||
44
app/views/origami/cash_outs/new.html.erb
Normal file
44
app/views/origami/cash_outs/new.html.erb
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
<h2>Payment Debit</h2>
|
||||||
|
<div class='row'>
|
||||||
|
<div class='col-md-9'>
|
||||||
|
<table class='table table-striped'>
|
||||||
|
<tr>
|
||||||
|
<td> Payment Reference
|
||||||
|
</td>
|
||||||
|
<td><input id='reference' type='text' value=''/></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td> Remark
|
||||||
|
</td>
|
||||||
|
<td><input id='remark' type="text" value=''/></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td> Amount
|
||||||
|
</td>
|
||||||
|
<td><input id='amount' type="text" value=''/></td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<br><br>
|
||||||
|
<div class='row'>
|
||||||
|
<div class='col-md-3'></div>
|
||||||
|
<div class='col-md-4'><button class='btn btn-primary btn-lg' id='cash_out'> Cash Out</button></div>
|
||||||
|
</div>
|
||||||
|
<script>
|
||||||
|
|
||||||
|
$('#cash_out').on('click',function(){
|
||||||
|
var reference = $('#reference').val();
|
||||||
|
var remark = $('#remark').val();
|
||||||
|
var amount = $('#amount').val();
|
||||||
|
$.ajax({type: "POST",
|
||||||
|
url: "<%= origami_cash_outs_path %>",
|
||||||
|
data: "reference="+ reference + "&remark=" + remark + "&amount="+ amount,
|
||||||
|
success:function(result){
|
||||||
|
window.location.href = '/origami';
|
||||||
|
}
|
||||||
|
});
|
||||||
|
})
|
||||||
|
</script>
|
||||||
@@ -138,7 +138,7 @@
|
|||||||
|
|
||||||
<div class="row bottom">
|
<div class="row bottom">
|
||||||
<div class="col-md-3">
|
<div class="col-md-3">
|
||||||
<div class="fluid cashier_number" data-value="20" data-type="add">20%</div>
|
<div class="fluid cashier_number" data-value="20" data-type="add">15%</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-9">
|
<div class="col-md-9">
|
||||||
<div class="col-md-4 cashier_number" data-value="7" data-type="num">7</div>
|
<div class="col-md-4 cashier_number" data-value="7" data-type="num">7</div>
|
||||||
@@ -149,7 +149,7 @@
|
|||||||
|
|
||||||
<div class="row bottom">
|
<div class="row bottom">
|
||||||
<div class="col-md-3">
|
<div class="col-md-3">
|
||||||
<div class="fluid cashier_number" data-value="30" data-type="add">30%</div>
|
<div class="fluid cashier_number" data-value="30" data-type="add">20%</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-9">
|
<div class="col-md-9">
|
||||||
<div class="col-md-4 cashier_number" data-value="0" data-type="num">0</div>
|
<div class="col-md-4 cashier_number" data-value="0" data-type="num">0</div>
|
||||||
@@ -160,7 +160,7 @@
|
|||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md-3">
|
<div class="col-md-3">
|
||||||
<div class="fluid cashier_number" data-value="50" data-type="add">50%</div>
|
<div class="fluid cashier_number" data-value="50" data-type="add">30%</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-9">
|
<div class="col-md-9">
|
||||||
<div class="col-md-4 cashier_number"></div>
|
<div class="col-md-4 cashier_number"></div>
|
||||||
@@ -172,7 +172,7 @@
|
|||||||
|
|
||||||
<div class="col-md-3">
|
<div class="col-md-3">
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<button id="net" class="btn btn-warning fluid action-btn">Nett</button>
|
<button id="net" class="btn btn-info fluid action-btn">Nett</button>
|
||||||
<button id="percentage" class="btn btn-primary fluid action-btn">Percentage</button>
|
<button id="percentage" class="btn btn-primary fluid action-btn">Percentage</button>
|
||||||
<button id="remove-item" class="btn btn-default fluid action-btn">Remove</button>
|
<button id="remove-item" class="btn btn-default fluid action-btn">Remove</button>
|
||||||
</div>
|
</div>
|
||||||
@@ -187,6 +187,8 @@
|
|||||||
<!-- Action Panel -->
|
<!-- Action Panel -->
|
||||||
<div>
|
<div>
|
||||||
<button type="button" class="btn btn-primary btn-block" onclick="window.location.href = '/origami';"><i class="fa fa-arrow-left"></i> Back </button>
|
<button type="button" class="btn btn-primary btn-block" onclick="window.location.href = '/origami';"><i class="fa fa-arrow-left"></i> Back </button>
|
||||||
|
<button id="remove-item-discount" class="btn btn-warning btn-block action-btn">Remove Discount</button>
|
||||||
|
<button id="remove-all" class="btn btn-warning btn-block action-btn">Remove All</button>
|
||||||
<button id="pay-discount" class="btn btn-danger btn-block action-btn">Enter</button>
|
<button id="pay-discount" class="btn btn-danger btn-block action-btn">Enter</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -358,6 +360,64 @@ $(document).ready(function(){
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Remove selected given discount item
|
||||||
|
$("#remove-item-discount").on('click', function(e){
|
||||||
|
e.preventDefault();
|
||||||
|
var sale_id = $('#sale-id').text();
|
||||||
|
var discount_items = [];
|
||||||
|
|
||||||
|
// Selected Items
|
||||||
|
var sale_items = get_selected_sale_items();
|
||||||
|
if(sale_items.length == 0){
|
||||||
|
alert("You have no selected item!");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
for(var i=0;i < sale_items.length;i++){
|
||||||
|
if(sale_items[i].price < 0){
|
||||||
|
discount_items.push(sale_items[i]);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
alert("You have selected no discount item!");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var params = { 'sale_id': sale_id, 'discount_items': JSON.stringify(discount_items) };
|
||||||
|
$.ajax({
|
||||||
|
type: "POST",
|
||||||
|
url: "/origami/" + sale_id + "/remove_discount_items",
|
||||||
|
data: params,
|
||||||
|
success: function(result){
|
||||||
|
alert('Removed Discount');
|
||||||
|
if(result.table_type == "Table"){
|
||||||
|
window.location.href = "/origami/table/" + result.table_id
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
window.location.href = "/origami/room/" + result.table_id
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
$("#remove-all").on('click', function(e){
|
||||||
|
e.preventDefault();
|
||||||
|
var sale_id = $('#sale-id').text();
|
||||||
|
$.ajax({
|
||||||
|
type: "GET",
|
||||||
|
url: "/origami/" + sale_id + "/remove_all_discount",
|
||||||
|
success: function(result){
|
||||||
|
alert('Removed All Discount');
|
||||||
|
if(result.table_type == "Table"){
|
||||||
|
window.location.href = "/origami/table/" + result.table_id
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
window.location.href = "/origami/room/" + result.table_id
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
/* Remove Selection */
|
/* Remove Selection */
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<div class="row">
|
<div class="row">
|
||||||
<!-- Column One -->
|
<!-- Column One -->
|
||||||
<div class="col-lg-11 col-md-11 col-sm-11">
|
<div class="col-lg-10 col-md-10 col-sm-10">
|
||||||
|
|
||||||
<!-- Nav tabs -->
|
<!-- Nav tabs -->
|
||||||
<ul class="nav nav-tabs" role="tablist">
|
<ul class="nav nav-tabs" role="tablist">
|
||||||
@@ -27,6 +27,7 @@
|
|||||||
<div class="card sales red text-white" data-id = "<%= sale.sale_id %>">
|
<div class="card sales red text-white" data-id = "<%= sale.sale_id %>">
|
||||||
<div class="card-block">
|
<div class="card-block">
|
||||||
<%= sale.receipt_no %>
|
<%= sale.receipt_no %>
|
||||||
|
<span style="font-size:12px;float:right;line-height:inherit;"><%= sale.sale_status %></span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
@@ -102,8 +103,11 @@
|
|||||||
</div>
|
</div>
|
||||||
<!-- tabs - End -->
|
<!-- tabs - End -->
|
||||||
</div>
|
</div>
|
||||||
<div class="col-lg-1 col-md-1 col-sm-1">
|
<div class="col-lg-2 col-md-2 col-sm-2">
|
||||||
<button id="refreshbutton" type="button" class="btn btn-block" style="border-radius:5px;color:#fff;background-color:red;"> Refresh off </button>
|
<button id="refreshbutton" type="button" class="btn btn-block" style="border-radius:5px;color:#fff;background-color:red;"> Refresh off </button>
|
||||||
|
<button id="cash_in" type="button" class="btn btn-block btn-primary" style="border-radius:5px;color:#fff;"> Cash In </button>
|
||||||
|
<button id="cash_out" type="button" class="btn btn-block btn-primary" style="border-radius:5px;color:#fff;"> Cash Out </button>
|
||||||
|
<button id="close_cashier" type="button" class="btn btn-block btn-primary" style="border-radius:5px;color:#fff;"> Close Cashier </button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<!-- Column One -->
|
<!-- Column One -->
|
||||||
@@ -192,4 +196,16 @@ $(function() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$('#cash_in').on('click',function(){
|
||||||
|
window.location.href = '/origami/cash_ins/new';
|
||||||
|
})
|
||||||
|
|
||||||
|
$('#cash_out').on('click',function(){
|
||||||
|
window.location.href = '/origami/cash_outs/new';
|
||||||
|
})
|
||||||
|
|
||||||
|
$('#close_cashier').on('click',function(){
|
||||||
|
window.location.href = '/origami/shift/close';
|
||||||
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -3,9 +3,11 @@
|
|||||||
<div class="col-lg-6 col-md-6 col-sm-6">
|
<div class="col-lg-6 col-md-6 col-sm-6">
|
||||||
|
|
||||||
<!-- Nav tabs -->
|
<!-- Nav tabs -->
|
||||||
<ul class="nav nav-tabs" role="tablist" id="mytab">
|
|
||||||
|
<ul class="nav nav-tabs" role="tablist">
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
<a class="nav-link" data-toggle="tab" href="#completed" role="tab">Completed</a>
|
<a class="nav-link" data-toggle="tab" href="#Completed" role="tab">Completed</a>
|
||||||
|
|
||||||
</li>
|
</li>
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
<a class="nav-link active" data-toggle="tab" href="#tables" role="tab">Tables</a>
|
<a class="nav-link active" data-toggle="tab" href="#tables" role="tab">Tables</a>
|
||||||
@@ -21,12 +23,14 @@
|
|||||||
|
|
||||||
<div class="tab-content" style="max-height:670px; overflow:auto">
|
<div class="tab-content" style="max-height:670px; overflow:auto">
|
||||||
<!--- Panel 0 - Completed Orders -->
|
<!--- Panel 0 - Completed Orders -->
|
||||||
|
|
||||||
<div class="tab-pane" id="completed" role="tabpanel">
|
<div class="tab-pane" id="completed" role="tabpanel">
|
||||||
<div class="card-columns" style="padding-top:10px; column-gap: 1.2rem;">
|
<div class="card-columns" style="padding-top:10px; column-gap: 1.2rem;">
|
||||||
<% @complete.each do |sale| %>
|
<% @complete.each do |sale| %>
|
||||||
<div class="card sales red text-white" data-id = "<%= sale.sale_id %>">
|
<div class="card sales red text-white" data-id = "<%= sale.sale_id %>">
|
||||||
<div class="card-block">
|
<div class="card-block">
|
||||||
<%= sale.receipt_no %>
|
<%= sale.receipt_no %>
|
||||||
|
<span style="font-size:12px;float:right;line-height:inherit;"><%= sale.sale_status %></span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
@@ -38,6 +42,7 @@
|
|||||||
<div class="card-columns" style="padding-top:10px; column-gap: 1.2rem;">
|
<div class="card-columns" style="padding-top:10px; column-gap: 1.2rem;">
|
||||||
<% @tables.each do |table| %>
|
<% @tables.each do |table| %>
|
||||||
<% if table.status == 'occupied' %>
|
<% if table.status == 'occupied' %>
|
||||||
|
|
||||||
<% if table.get_booking.nil? %>
|
<% if table.get_booking.nil? %>
|
||||||
<div class="card tables red text-white" data-id="<%= table.id %>">
|
<div class="card tables red text-white" data-id="<%= table.id %>">
|
||||||
<div class="card-block">
|
<div class="card-block">
|
||||||
@@ -70,6 +75,7 @@
|
|||||||
<div class="card-columns" style="padding-top:10px; column-gap: 1.2rem;">
|
<div class="card-columns" style="padding-top:10px; column-gap: 1.2rem;">
|
||||||
<% @rooms.each do |room| %>
|
<% @rooms.each do |room| %>
|
||||||
<% if room.status == 'occupied' %>
|
<% if room.status == 'occupied' %>
|
||||||
|
|
||||||
<div class="card rooms red text-white" data-id="<%= room.id %>">
|
<div class="card rooms red text-white" data-id="<%= room.id %>">
|
||||||
<div class="card-block">
|
<div class="card-block">
|
||||||
<%= room.name %>
|
<%= room.name %>
|
||||||
@@ -94,6 +100,7 @@
|
|||||||
<!--- Panel 3 - Orders -->
|
<!--- Panel 3 - Orders -->
|
||||||
<div class="tab-pane" id="orders" role="tabpanel">
|
<div class="tab-pane" id="orders" role="tabpanel">
|
||||||
<div class="card-columns" style="padding-top:10px; column-gap: 1.2rem;">
|
<div class="card-columns" style="padding-top:10px; column-gap: 1.2rem;">
|
||||||
|
|
||||||
<% @orders.each do |order| %>
|
<% @orders.each do |order| %>
|
||||||
<div class="card orders red text-white" data-id = "<%= order.order_id %>">
|
<div class="card orders red text-white" data-id = "<%= order.order_id %>">
|
||||||
<div class="card-block">
|
<div class="card-block">
|
||||||
@@ -103,7 +110,6 @@
|
|||||||
<% end %>
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<!-- tabs - End -->
|
<!-- tabs - End -->
|
||||||
</div>
|
</div>
|
||||||
@@ -113,6 +119,7 @@
|
|||||||
<div class="col-lg-5 col-md-5 col-sm-5">
|
<div class="col-lg-5 col-md-5 col-sm-5">
|
||||||
<div class="card" >
|
<div class="card" >
|
||||||
<div class="card-header">
|
<div class="card-header">
|
||||||
|
|
||||||
<% if @status_order == 'order' && @status_sale != 'sale' %>
|
<% if @status_order == 'order' && @status_sale != 'sale' %>
|
||||||
<div id="save_order_id" data-order="<%= @obj_order.order_id %>"><strong id="order-title">ORDER DETAILS </strong> | Table <%= @dining.name rescue "" %></div>
|
<div id="save_order_id" data-order="<%= @obj_order.order_id %>"><strong id="order-title">ORDER DETAILS </strong> | Table <%= @dining.name rescue "" %></div>
|
||||||
<% elsif @status_sale == 'sale' %>
|
<% elsif @status_sale == 'sale' %>
|
||||||
@@ -123,12 +130,14 @@
|
|||||||
<div class="card-title row">
|
<div class="card-title row">
|
||||||
<div class="col-lg-6 col-md-6 col-sm-6">
|
<div class="col-lg-6 col-md-6 col-sm-6">
|
||||||
<p> Receipt No: <span id="receipt_no">
|
<p> Receipt No: <span id="receipt_no">
|
||||||
|
|
||||||
<% if @status_sale == 'sale' %>
|
<% if @status_sale == 'sale' %>
|
||||||
<%= @sale_array[0].receipt_no rescue '' %>
|
<%= @sale_array[0].receipt_no rescue '' %>
|
||||||
<% end %>
|
<% end %>
|
||||||
</span></p>
|
</span></p>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-lg-6 col-md-6 col-sm-6 text-right">
|
<div class="col-lg-6 col-md-6 col-sm-6 text-right">
|
||||||
|
|
||||||
<p>Date: <span id="receipt_date"><%= @date.utc.getlocal.strftime("%d/%m/%Y - %I:%M %p") rescue '-'%></span></p>
|
<p>Date: <span id="receipt_date"><%= @date.utc.getlocal.strftime("%d/%m/%Y - %I:%M %p") rescue '-'%></span></p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -145,6 +154,7 @@
|
|||||||
<table class="table table-striped" id="order-items-table">
|
<table class="table table-striped" id="order-items-table">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
|
|
||||||
<th>#</th>
|
<th>#</th>
|
||||||
<th class="item-name">Items</th>
|
<th class="item-name">Items</th>
|
||||||
<th class="item-attr">QTY</td>
|
<th class="item-attr">QTY</td>
|
||||||
@@ -153,6 +163,7 @@
|
|||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
<%
|
<%
|
||||||
|
|
||||||
count = 0
|
count = 0
|
||||||
sub_total = 0
|
sub_total = 0
|
||||||
if @status_sale == "sale"
|
if @status_sale == "sale"
|
||||||
@@ -172,6 +183,7 @@
|
|||||||
<td class='item-attr'><%= sale_item.price %></td>
|
<td class='item-attr'><%= sale_item.price %></td>
|
||||||
</tr>
|
</tr>
|
||||||
<%
|
<%
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -191,6 +203,7 @@
|
|||||||
<td class='item-attr'><%= order_item.qty*order_item.price %></td>
|
<td class='item-attr'><%= order_item.qty*order_item.price %></td>
|
||||||
</tr>
|
</tr>
|
||||||
<%
|
<%
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -207,6 +220,7 @@
|
|||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td class="charges-name"><strong>Discount:</strong></td>
|
<td class="charges-name"><strong>Discount:</strong></td>
|
||||||
|
|
||||||
<td class="item-attr"><strong id="order-discount">(<%= @obj_sale.total_discount rescue 0%>)</strong></td>
|
<td class="item-attr"><strong id="order-discount">(<%= @obj_sale.total_discount rescue 0%>)</strong></td>
|
||||||
</tr>
|
</tr>
|
||||||
<% if @status_sale == "sale" %>
|
<% if @status_sale == "sale" %>
|
||||||
@@ -214,6 +228,10 @@
|
|||||||
<td class="charges-name"><strong>Tax:</strong></td>
|
<td class="charges-name"><strong>Tax:</strong></td>
|
||||||
<td class="item-attr"><strong id="order-Tax"><%= @obj_sale.total_tax rescue 0%></strong></td>
|
<td class="item-attr"><strong id="order-Tax"><%= @obj_sale.total_tax rescue 0%></strong></td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="charges-name"><strong>Rounding Adj:</strong></td>
|
||||||
|
<td class="item-attr"><strong id="order-round-adj"><%= @obj_sale.rounding_adjustment rescue 0%></strong></td>
|
||||||
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td class="charges-name"><strong>Grand Total:</strong></td>
|
<td class="charges-name"><strong>Grand Total:</strong></td>
|
||||||
<td class="item-attr"><strong id="order-grand-total"><%= @obj_sale.grand_total rescue 0%></strong></td>
|
<td class="item-attr"><strong id="order-grand-total"><%= @obj_sale.grand_total rescue 0%></strong></td>
|
||||||
@@ -270,7 +288,6 @@
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
%>
|
%>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -278,6 +295,7 @@
|
|||||||
<!-- Column Three -->
|
<!-- Column Three -->
|
||||||
<div class="col-lg-1 col-md-1 col-sm-1">
|
<div class="col-lg-1 col-md-1 col-sm-1">
|
||||||
<!-- Waiter Buttons -->
|
<!-- Waiter Buttons -->
|
||||||
|
|
||||||
<button type="button" class="btn btn-primary btn-block" id='back' >Back</button>
|
<button type="button" class="btn btn-primary btn-block" id='back' >Back</button>
|
||||||
<% if @dining.bookings.length >= 1 %>
|
<% if @dining.bookings.length >= 1 %>
|
||||||
<button type="button" id="customer" class="btn btn-primary btn-block" >Customer</button>
|
<button type="button" id="customer" class="btn btn-primary btn-block" >Customer</button>
|
||||||
@@ -285,17 +303,21 @@
|
|||||||
<% if @status_order == 'order' && @status_sale != 'sale' %>
|
<% if @status_order == 'order' && @status_sale != 'sale' %>
|
||||||
<button type="button" class="btn btn-primary btn-block" >Add Order</button>
|
<button type="button" class="btn btn-primary btn-block" >Add Order</button>
|
||||||
<button type="button" class="btn btn-primary btn-block" disabled >Edit</button>
|
<button type="button" class="btn btn-primary btn-block" disabled >Edit</button>
|
||||||
<button type="button" id="discount" class="btn btn-primary btn-block" disabled >Discount</button>
|
<button type="button" id="discount" class="btn btn-primary btn-block" disabled>Discount</button>
|
||||||
|
<button type="button" id="other-charges" class="btn btn-primary btn-block" disabled>Charges</button>
|
||||||
<button type="button" class="btn btn-primary btn-block" id='move'>Move</button>
|
<button type="button" class="btn btn-primary btn-block" id='move'>Move</button>
|
||||||
<button type="button" id="request_bills" class="btn btn-primary btn-block">Req.Bill</button>
|
<button type="button" id="request_bills" class="btn btn-primary btn-block">Req.Bill</button>
|
||||||
|
<button type="button" id="first_bill" class="btn btn-primary btn-block" disabled>First Bill</button>
|
||||||
<button type="button" id="pay" class="btn btn-primary btn-block" disabled>Pay</button>
|
<button type="button" id="pay" class="btn btn-primary btn-block" disabled>Pay</button>
|
||||||
<button type="button" class="btn btn-primary btn-block" disabled=""> Void </button>
|
<button type="button" class="btn btn-primary btn-block" disabled> Void </button>
|
||||||
<% else %>
|
<% else %>
|
||||||
<button type="button" class="btn btn-primary btn-block" disabled>Add Order</button>
|
<button type="button" class="btn btn-primary btn-block" disabled>Add Order</button>
|
||||||
<button type="button" class="btn btn-primary btn-block" id='edit'>Edit</button>
|
<button type="button" class="btn btn-primary btn-block" id='edit'>Edit</button>
|
||||||
<button type="button" id="discount" class="btn btn-primary btn-block" >Discount</button>
|
<button type="button" id="discount" class="btn btn-primary btn-block" >Discount</button>
|
||||||
|
<button type="button" id="other-charges" class="btn btn-primary btn-block" >Charges</button>
|
||||||
<button type="button" class="btn btn-primary btn-block" id='move' disabled="">Move</button>
|
<button type="button" class="btn btn-primary btn-block" id='move' disabled="">Move</button>
|
||||||
<button type="button" id="request_bills" class="btn btn-primary btn-block" disabled> Req.Bill</button>
|
<button type="button" id="request_bills" class="btn btn-primary btn-block" disabled> Req.Bill</button>
|
||||||
|
<button type="button" id="first_bill" class="btn btn-primary btn-block">First Bill</button>
|
||||||
<button type="button" id="pay" class="btn btn-primary btn-block">Pay</button>
|
<button type="button" id="pay" class="btn btn-primary btn-block">Pay</button>
|
||||||
<button type="button" id="void" class="btn btn-primary btn-block" > Void </button>
|
<button type="button" id="void" class="btn btn-primary btn-block" > Void </button>
|
||||||
<% end %>
|
<% end %>
|
||||||
@@ -307,6 +329,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<script>
|
<script>
|
||||||
$(document).ready(function(){
|
$(document).ready(function(){
|
||||||
|
|
||||||
$('.invoicedetails').on('click',function(){
|
$('.invoicedetails').on('click',function(){
|
||||||
var dining_id = "<%= @dining.id %>";
|
var dining_id = "<%= @dining.id %>";
|
||||||
var sale_id = this.id;
|
var sale_id = this.id;
|
||||||
@@ -369,6 +392,25 @@ $(document).ready(function(){
|
|||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Add Other Charges
|
||||||
|
$('#other-charges').click(function() {
|
||||||
|
var sale = $('#sale_id').val();
|
||||||
|
if (sale!="") {
|
||||||
|
var sale_id = sale
|
||||||
|
}else{
|
||||||
|
var sale_id = $('#save_order_id').attr('data-order');
|
||||||
|
}
|
||||||
|
|
||||||
|
if(sale_id!=""){
|
||||||
|
window.location.href = '/origami/' + sale_id + '/other_charges'
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
alert("Please select an table!");
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
});
|
||||||
|
|
||||||
// Discount for Payment
|
// Discount for Payment
|
||||||
$('#discount').click(function() {
|
$('#discount').click(function() {
|
||||||
var sale = $('#sale_id').val();
|
var sale = $('#sale_id').val();
|
||||||
@@ -387,10 +429,21 @@ $(document).ready(function(){
|
|||||||
|
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Print for first bill
|
||||||
|
$("#first_bill").on('click', function(){
|
||||||
|
var sale_id = $('#sale_id').val();
|
||||||
|
var ajax_url = "/origami/sale/"+ sale_id + "/first_bill";
|
||||||
|
|
||||||
|
$.ajax({
|
||||||
|
type: "GET",
|
||||||
|
url: ajax_url,
|
||||||
|
success:function(result){
|
||||||
|
location.reload();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
$('#pay').on('click',function() {
|
$('#pay').on('click',function() {
|
||||||
var sale_id = $('#sale_id').val();
|
var sale_id = $('#sale_id').val();
|
||||||
@@ -402,9 +455,9 @@ $('#request_bills').click(function() {
|
|||||||
var order_id = $('#save_order_id').attr('data-order');
|
var order_id = $('#save_order_id').attr('data-order');
|
||||||
var ajax_url = "/origami/" + order_id + "/request_bills";
|
var ajax_url = "/origami/" + order_id + "/request_bills";
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type: "POST",
|
type: "GET",
|
||||||
url: ajax_url,
|
url: ajax_url,
|
||||||
data: 'order_id='+ order_id,
|
// data: 'order_id='+ order_id,
|
||||||
success:function(result){
|
success:function(result){
|
||||||
|
|
||||||
location.reload();
|
location.reload();
|
||||||
@@ -468,31 +521,28 @@ function show_customer_details(customer_id){
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
//End Ajax
|
//End Ajax
|
||||||
}
|
}
|
||||||
|
|
||||||
$('#edit').on('click',function(){
|
$('#edit').on('click',function(){
|
||||||
var dining_id = "<%= @dining.id %>"
|
var dining_id = "<%= @dining.id %>"
|
||||||
var sale_id = "<%= @obj_sale.sale_id rescue "" %>"
|
var sale_id = "<%= @obj_sale.sale_id rescue "" %>"
|
||||||
window.location.href = '/origami/table/'+ dining_id + "/sale/"+ sale_id + "/edit";
|
window.location.href = '/origami/table/'+ dining_id + "/sale/"+ sale_id + "/edit";
|
||||||
})
|
});
|
||||||
|
|
||||||
$('#void').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';
|
|
||||||
$.ajax({
|
|
||||||
type: 'POST',
|
|
||||||
url: ajax_url,
|
|
||||||
success: function () {
|
|
||||||
window.location.href = '/origami/';
|
|
||||||
}
|
|
||||||
})
|
|
||||||
} else {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
})
|
|
||||||
|
|
||||||
|
$('#void').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';
|
||||||
|
$.ajax({
|
||||||
|
type: 'POST',
|
||||||
|
url: ajax_url,
|
||||||
|
success: function () {
|
||||||
|
window.location.href = '/origami/';
|
||||||
|
}
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -26,7 +26,7 @@
|
|||||||
<% @complete.each do |sale| %>
|
<% @complete.each do |sale| %>
|
||||||
<div class="card sales red text-white" data-id = "<%= sale.sale_id %>">
|
<div class="card sales red text-white" data-id = "<%= sale.sale_id %>">
|
||||||
<div class="card-block">
|
<div class="card-block">
|
||||||
<%= sale.receipt_no %>
|
<%= sale.receipt_no %><span style="font-size:12px;float:right;line-height:inherit;"><%= sale.sale_status %></span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|||||||
331
app/views/origami/other_charges/index.html.erb
Normal file
331
app/views/origami/other_charges/index.html.erb
Normal file
@@ -0,0 +1,331 @@
|
|||||||
|
<div class="row">
|
||||||
|
<!-- Column One -->
|
||||||
|
<div class="col-lg-6 col-md-6 col-sm-6">
|
||||||
|
<!-- Order Details -->
|
||||||
|
<div class="card" >
|
||||||
|
<!-- <div class="card-header">
|
||||||
|
<div><strong id="order-title">ORDER DETAILS</strong></div>
|
||||||
|
</div> -->
|
||||||
|
<div class="card-block">
|
||||||
|
<div class="card-title row">
|
||||||
|
<div class="col-lg-6 col-md-6 col-sm-6">
|
||||||
|
<p id="sale-id" class="hidden"><%=@sale_data.sale_id %></p>
|
||||||
|
<p>Receipt No: <span id="receipt_no"><%=@sale_data.receipt_no rescue ' '%></span></p>
|
||||||
|
<!-- <p>Cashier: <span id="cashier"><%=@sale_data.cashier_name rescue ' '%></span></p> -->
|
||||||
|
</div>
|
||||||
|
<div class="col-lg-6 col-md-6 col-sm-6 text-right">
|
||||||
|
<p>Date: <span id="receipt_date"> <%=@sale_data.receipt_date.strftime("%d/%m/%Y - %I:%M %p") rescue '-'%></span></p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="card-text">
|
||||||
|
<table class="table table-default" id="order-items-table">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th class="item-name">Items</th>
|
||||||
|
<th class="item-attr">QTY</td>
|
||||||
|
<th class="item-attr">Price</td>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<% sub_total = 0 %>
|
||||||
|
<% @sale_data.sale_items.each do |sale_item| %>
|
||||||
|
<%
|
||||||
|
sub_total += sale_item.qty*sale_item.unit_price
|
||||||
|
unless sale_item.price == 0
|
||||||
|
%>
|
||||||
|
<tr class="item-row" id=<%= sale_item.sale_item_id %> >
|
||||||
|
<td style="width:60%; text-align:left">
|
||||||
|
<span id="item-account-type" class="hidden"><%=sale_item.account_id%></span>
|
||||||
|
<span id="item-name-price"><%=sale_item.product_name%>@<%=sale_item.unit_price%></span>
|
||||||
|
</td>
|
||||||
|
<td style="width:20%; text-align:right">
|
||||||
|
<span id="item-qty"><%=sale_item.qty%></span>
|
||||||
|
</td>
|
||||||
|
<td style="width:20%; text-align:right">
|
||||||
|
<span id="item-total-price"><%=(sale_item.qty*sale_item.unit_price)%></span>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<%
|
||||||
|
end
|
||||||
|
end
|
||||||
|
%>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
<div class="card-footer">
|
||||||
|
<table class="table" id="order-charges-table" border="0">
|
||||||
|
<tr>
|
||||||
|
<td class="charges-name"><strong>Sub Total:</strong></td>
|
||||||
|
<td class="item-attr"><strong id="order-sub-total"><%=sub_total%></strong></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="charges-name"><strong>Discount:</strong></td>
|
||||||
|
<td class="item-attr">(<strong id="order-discount"><%=@sale_data.total_discount rescue 0%></strong>)</td>
|
||||||
|
</tr>
|
||||||
|
<tr class="hidden">
|
||||||
|
<td class="charges-name"><strong>Tax:</strong></td>
|
||||||
|
<td class="item-attr"><strong id="order-Tax"><%=@sale_data.total_tax rescue 0%></strong></td>
|
||||||
|
</tr>
|
||||||
|
<tr class="hidden">
|
||||||
|
<td class="charges-name"><strong>Grand Total:</strong></td>
|
||||||
|
<td class="item-attr"><strong id="order-grand-total"><%=@sale_data.grand_total rescue 0%></strong></td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<!-- Column One -->
|
||||||
|
|
||||||
|
<!-- Column Two -->
|
||||||
|
<div class="col-lg-5 col-md-5 col-sm-5">
|
||||||
|
<!-- Discount Amount -->
|
||||||
|
<div class="card">
|
||||||
|
<div class="card-header">
|
||||||
|
<div><strong id="order-title">Other Charges Control</strong></div>
|
||||||
|
</div>
|
||||||
|
<div class="card-block">
|
||||||
|
<div class="card-title">
|
||||||
|
<div class="form-horizontal">
|
||||||
|
<div class="col-md-12">
|
||||||
|
<div class="form-group">
|
||||||
|
<input type="text" id="other-charges-amount" name="other-charges-amount" class="form-control" placeholder="Amount" />
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<textarea id="reasons" name="reasons" rows="2" class="form-control" placeholder="Reasons"></textarea>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<hr />
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-9">
|
||||||
|
<div class="row bottom">
|
||||||
|
<div class="col-md-3">
|
||||||
|
<div class="fluid cashier_number" data-value="3000" data-type="add">3000</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-9">
|
||||||
|
<div class="col-md-4 cashier_number" data-value="1" data-type="num">1</div>
|
||||||
|
<div class="col-md-4 left cashier_number" data-value="2" data-type="num">2</div>
|
||||||
|
<div class="col-md-4 left cashier_number" data-value="3" data-type="num">3</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="row bottom">
|
||||||
|
<div class="col-md-3">
|
||||||
|
<div class="fluid cashier_number" data-value="5000" data-type="add">5000</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-9">
|
||||||
|
<div class="col-md-4 cashier_number" data-value="4" data-type="num">4</div>
|
||||||
|
<div class="col-md-4 left cashier_number" data-value="5" data-type="num">5</div>
|
||||||
|
<div class="col-md-4 left cashier_number" data-value="6" data-type="num">6</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="row bottom">
|
||||||
|
<div class="col-md-3">
|
||||||
|
<div class="fluid cashier_number" data-value="10000" data-type="add">10000</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-9">
|
||||||
|
<div class="col-md-4 cashier_number" data-value="7" data-type="num">7</div>
|
||||||
|
<div class="col-md-4 left cashier_number" data-value="8" data-type="num">8</div>
|
||||||
|
<div class="col-md-4 left cashier_number" data-value="9" data-type="num">9</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="row bottom">
|
||||||
|
<div class="col-md-3">
|
||||||
|
<div class="fluid cashier_number" data-value="15000" data-type="add">15000</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-9">
|
||||||
|
<div class="col-md-4 cashier_number" data-value="0" data-type="num">0</div>
|
||||||
|
<div class="col-md-4 left cashier_number" data-value="." data-type="num">.</div>
|
||||||
|
<div class="col-md-4 left cashier_number" data-value="00" data-type="num">00</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-3">
|
||||||
|
<div class="fluid cashier_number" data-value="20000" data-type="add">20000</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-9">
|
||||||
|
<div class="col-md-4 cashier_number"></div>
|
||||||
|
<div class="col-md-4 left cashier_number red" data-type="del">DEL</div>
|
||||||
|
<div class="col-md-4 left cashier_number green" data-type="clr">CLR</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="col-md-3">
|
||||||
|
<div class="form-group">
|
||||||
|
<button id="add_charges" class="btn btn-info fluid action-btn">Add</button>
|
||||||
|
<button id="remove-item" class="btn btn-default fluid action-btn">Remove</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Column Three -->
|
||||||
|
<div class="col-lg-1 col-md-1 col-sm-1">
|
||||||
|
<!-- Action Panel -->
|
||||||
|
<div>
|
||||||
|
<button type="button" class="btn btn-primary btn-block" onclick="window.location.href = '/origami';"><i class="fa fa-arrow-left"></i> Back </button>
|
||||||
|
<button id="charge_other" class="btn btn-danger btn-block action-btn">Enter</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<script type="text/javascript">
|
||||||
|
$(document).ready(function(){
|
||||||
|
$(".cashier_number").on('click', function(event){
|
||||||
|
if(event.handled !== true) {
|
||||||
|
var original_value=0;
|
||||||
|
original_value = $('#other-charges-amount').val();
|
||||||
|
|
||||||
|
var input_type = $(this).attr("data-type");
|
||||||
|
|
||||||
|
switch (input_type) {
|
||||||
|
case 'num':
|
||||||
|
var input_value = $(this).attr("data-value");
|
||||||
|
if (original_value == "0.0"){
|
||||||
|
$('#other-charges-amount').val(input_value);
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
$('#other-charges-amount').val(original_value + '' + input_value);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'add':
|
||||||
|
var input_value = $(this).attr("data-value");
|
||||||
|
amount = parseInt(input_value);
|
||||||
|
$('#other-charges-amount').val(amount);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'del' :
|
||||||
|
var discount_text=$('#other-charges-amount').val();
|
||||||
|
$('#other-charges-amount').val(discount_text.substr(0,discount_text.length-1));
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'clr':
|
||||||
|
$('#other-charges-amount').val("0.0");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
event.handled = true;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// Select discount-item
|
||||||
|
$('#order-items-table tbody').on('click', '.other-item-row',function(){
|
||||||
|
if($(this).hasClass('selected-item') == true){
|
||||||
|
$(this).removeClass('selected-item');
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$(this).addClass('selected-item');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// Remove selected discount items
|
||||||
|
$("#remove-item").on('click', function(e){
|
||||||
|
e.preventDefault();
|
||||||
|
|
||||||
|
$('.other-item-row.selected-item').each(function(i){
|
||||||
|
var sub_total = $('#order-sub-total').text();
|
||||||
|
var charge_amount = $(this).children('td').find("#item-total-price").text();
|
||||||
|
|
||||||
|
// Update sub total
|
||||||
|
$('#order-sub-total').text(parseFloat(sub_total) - parseFloat(charge_amount));
|
||||||
|
$(this).remove();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
// Calculate Net Discount for Payment
|
||||||
|
$("#add_charges").on('click', function(e){
|
||||||
|
e.preventDefault();
|
||||||
|
var sale_id = $('#sale-id').text();
|
||||||
|
var sub_total = $('#order-sub-total').text();
|
||||||
|
var charge_amount = $("#other-charges-amount").val();
|
||||||
|
var reasons = $("#reasons").val();
|
||||||
|
|
||||||
|
// Update sub total
|
||||||
|
$('#order-sub-total').text(parseFloat(sub_total) + parseFloat(charge_amount));
|
||||||
|
|
||||||
|
var item_row = item_row_template(sale_id, charge_amount, reasons);
|
||||||
|
$("#order-items-table tbody").append(item_row);
|
||||||
|
});
|
||||||
|
|
||||||
|
// Calculate Other Charges for Payment
|
||||||
|
$("#charge_other").on('click', function(e){
|
||||||
|
e.preventDefault();
|
||||||
|
var sale_id = $('#sale-id').text();
|
||||||
|
var sub_total = $('#order-sub-total').text();
|
||||||
|
var other_charges_items = JSON.stringify(get_other_item_rows());
|
||||||
|
var ajax_url = "/origami/" + sale_id + "/other_charges";
|
||||||
|
|
||||||
|
var params = { 'sale_id': sale_id, 'sub_total': sub_total, 'other_charges_items': other_charges_items };
|
||||||
|
|
||||||
|
$.ajax({
|
||||||
|
type: "POST",
|
||||||
|
url: ajax_url,
|
||||||
|
data: params,
|
||||||
|
success:function(result){
|
||||||
|
alert("Success!");
|
||||||
|
if(result.table_type == "Table"){
|
||||||
|
window.location.href = "/origami/table/" + result.table_id
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
window.location.href = "/origami/room/" + result.table_id
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
/* Remove Selection */
|
||||||
|
function selection_remove(){
|
||||||
|
$(".item-row").removeClass("selected-item");
|
||||||
|
$(".discount_item_row").removeClass("selected-item");
|
||||||
|
$(".accounts-type").removeClass("selected-account");
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Get discount Item rows */
|
||||||
|
function get_other_item_rows(){
|
||||||
|
var sale_items = [];
|
||||||
|
$('.other-item-row').each(function(i){
|
||||||
|
var sale_item = {};
|
||||||
|
sale_item.id = $(this).attr('id');
|
||||||
|
sale_item.name = $(this).find('#item-name-price').text();
|
||||||
|
sale_item.price = $(this).find('#item-total-price').text();
|
||||||
|
sale_items.push(sale_item);
|
||||||
|
});
|
||||||
|
return sale_items;
|
||||||
|
}
|
||||||
|
|
||||||
|
function item_row_template(sale_id, charge_amount, reasons){
|
||||||
|
var item_row = "<tr class='other-item-row' id='SLI-000000000000'>" +
|
||||||
|
"<td style='width: 60%; text-align: left;'>" +
|
||||||
|
"<span id='item_account_type' class='hidden'>" +
|
||||||
|
0 +
|
||||||
|
"</span>" +
|
||||||
|
"<span id='item-name-price'>" +
|
||||||
|
reasons +
|
||||||
|
"</span>" +
|
||||||
|
"</td>" +
|
||||||
|
"<td style='width: 20%; text-align: right;'>" +
|
||||||
|
"<span id='item-qty'>1</span>" +
|
||||||
|
"</td>" +
|
||||||
|
"<td style='width: 20%; text-align: right;'>" +
|
||||||
|
"<span id='item-total-price'>" +
|
||||||
|
charge_amount +
|
||||||
|
"</span>" +
|
||||||
|
"</td>" +
|
||||||
|
"</tr>";
|
||||||
|
return item_row;
|
||||||
|
}
|
||||||
|
|
||||||
|
</script>
|
||||||
@@ -11,7 +11,7 @@
|
|||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td><strong>Table No</strong> <% if @sale_data%>- <%=@sale_data.receipt_no%><% end %></td>
|
<td><strong>Table No</strong> <% if @sale_data%>- <%=@sale_data.receipt_no%><% end %></td>
|
||||||
<td><strong>Sale Id</strong> </span><span id="sale_id"><% if @sale_data %><%=@sale_data.sale_id %><% end %></td>
|
<td><strong>Sale Id</strong> <span id="sale_id"><% if @sale_data %><%=@sale_data.sale_id %><% end %></span></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td><strong>Customer :</strong> <%= @sale_data.customer.name%></td>
|
<td><strong>Customer :</strong> <%= @sale_data.customer.name%></td>
|
||||||
@@ -136,13 +136,13 @@
|
|||||||
<% if @ppamount != 0.0 %>
|
<% if @ppamount != 0.0 %>
|
||||||
<div class="row payment other-payment-color" style="line-height:30px;height: 30px;margin-bottom: 0px;">
|
<div class="row payment other-payment-color" style="line-height:30px;height: 30px;margin-bottom: 0px;">
|
||||||
<div class="col-md-5"></div>
|
<div class="col-md-5"></div>
|
||||||
<div class="col-md-3">Paypar</div>
|
<div class="col-md-3">Redeem</div>
|
||||||
<div class="col-md-4" id="ppamount"><%= @ppamount %></div>
|
<div class="col-md-4" id="ppamount"><%= @ppamount %></div>
|
||||||
</div>
|
</div>
|
||||||
<% else %>
|
<% else %>
|
||||||
<div class="row" style="display:none">
|
<div class="row" style="display:none">
|
||||||
<div class="col-md-5"></div>
|
<div class="col-md-5"></div>
|
||||||
<div class="col-md-3">Paypar</div>
|
<div class="col-md-3">Redeem</div>
|
||||||
<div class="col-md-4" id="ppamount">0.0</div>
|
<div class="col-md-4" id="ppamount">0.0</div>
|
||||||
</div>
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
@@ -244,7 +244,7 @@
|
|||||||
|
|
||||||
<button type="button" class="btn btn-primary btn-block" onclick="localStorage.removeItem('cash');window.location.href = '/origami';"> Back </button>
|
<button type="button" class="btn btn-primary btn-block" onclick="localStorage.removeItem('cash');window.location.href = '/origami';"> Back </button>
|
||||||
<button type="button" class="btn btn-primary btn-block"> FOC </button>
|
<button type="button" class="btn btn-primary btn-block"> FOC </button>
|
||||||
<button type="button" class="btn btn-primary btn-block"> Void </button>
|
<button type="button" class="btn btn-primary btn-block" id="void"> Void </button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -354,6 +354,23 @@ $( document ).ready(function() {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$('#void').on('click',function () {
|
||||||
|
var sure = confirm("Are you sure want to Void");
|
||||||
|
if (sure == true) {
|
||||||
|
var sale_id = $('#sale_id').text();
|
||||||
|
var ajax_url = "/origami/sale/" + sale_id + '/void';
|
||||||
|
$.ajax({
|
||||||
|
type: 'POST',
|
||||||
|
url: ajax_url,
|
||||||
|
success: function () {
|
||||||
|
window.location.href = '/origami/';
|
||||||
|
}
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
function update_balance(){
|
function update_balance(){
|
||||||
@@ -369,4 +386,5 @@ function update_balance(){
|
|||||||
var result = amount_due - total;
|
var result = amount_due - total;
|
||||||
$('#balance').text(result.toFixed(2));
|
$('#balance').text(result.toFixed(2));
|
||||||
}
|
}
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -26,7 +26,7 @@
|
|||||||
<% @complete.each do |sale| %>
|
<% @complete.each do |sale| %>
|
||||||
<div class="card sales red text-white" data-id = "<%= sale.sale_id %>">
|
<div class="card sales red text-white" data-id = "<%= sale.sale_id %>">
|
||||||
<div class="card-block">
|
<div class="card-block">
|
||||||
<%= sale.receipt_no %>
|
<%= sale.receipt_no %><span style="font-size:12px;float:right;line-height:inherit;"><%= sale.sale_status %></span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
@@ -268,61 +268,128 @@
|
|||||||
<div class="col-lg-1 col-md-1 col-sm-1">
|
<div class="col-lg-1 col-md-1 col-sm-1">
|
||||||
<!-- Waiter Buttons -->
|
<!-- Waiter Buttons -->
|
||||||
<button type="button" class="btn btn-primary btn-block" id='back' >Back</button>
|
<button type="button" class="btn btn-primary btn-block" id='back' >Back</button>
|
||||||
<button type="button" class="btn btn-primary btn-block" disabled>Add Order</button>
|
<% if @dining.bookings.length >= 1 %>
|
||||||
<button type="button" class="btn btn-primary btn-block" disabled>Edit</button>
|
<button type="button" id="customer" class="btn btn-primary btn-block" >Customer</button>
|
||||||
<button type="button" class="btn btn-primary btn-block" id="move">Move</button>
|
|
||||||
<button type="button" id="customer" class="btn btn-primary btn-block">Customer</button>
|
<% if @status_order == 'order' && @status_sale != 'sale' %>
|
||||||
<button type="button" id="request_bills" class="btn btn-primary btn-block">Req.Bill</button>
|
<button type="button" class="btn btn-primary btn-block" >Add Order</button>
|
||||||
|
<button type="button" class="btn btn-primary btn-block" disabled >Edit</button>
|
||||||
|
<button type="button" id="discount" class="btn btn-primary btn-block" disabled >Discount</button>
|
||||||
|
<button type="button" class="btn btn-primary btn-block" id='move'>Move</button>
|
||||||
|
<button type="button" id="request_bills" class="btn btn-primary btn-block">Req.Bill</button>
|
||||||
|
<button type="button" id="first_bill" class="btn btn-primary btn-block" disabled>First Bill</button>
|
||||||
|
<button type="button" id="pay" class="btn btn-primary btn-block" disabled>Pay</button>
|
||||||
|
<button type="button" class="btn btn-primary btn-block" disabled=""> Void </button>
|
||||||
|
<% else %>
|
||||||
|
<button type="button" class="btn btn-primary btn-block" disabled>Add Order</button>
|
||||||
|
<button type="button" class="btn btn-primary btn-block" id='edit'>Edit</button>
|
||||||
|
<button type="button" id="discount" class="btn btn-primary btn-block" >Discount</button>
|
||||||
|
<button type="button" class="btn btn-primary btn-block" id='move' disabled="">Move</button>
|
||||||
|
<button type="button" id="request_bills" class="btn btn-primary btn-block" disabled> Req.Bill</button>
|
||||||
|
<button type="button" id="first_bill" class="btn btn-primary btn-block">First Bill</button>
|
||||||
|
<button type="button" id="pay" class="btn btn-primary btn-block">Pay</button>
|
||||||
|
<button type="button" id="void" class="btn btn-primary btn-block" > Void </button>
|
||||||
|
<% end %>
|
||||||
<!-- Cashier Buttons -->
|
<!-- Cashier Buttons -->
|
||||||
<button type="button" id="discount" class="btn btn-primary btn-block">Discount</button>
|
|
||||||
<!-- <button type="button" class="btn btn-primary btn-lg btn-block" disabled>Tax</button> -->
|
<!-- <button type="button" id="re-print" class="btn btn-primary btn-block" >Re.Print</button> -->
|
||||||
<button type="button" id="pay" class="btn btn-primary btn-block">Pay</button>
|
<% end %>
|
||||||
<!-- <button type="button" id="re-print" class="btn btn-primary btn-block">Re.Print</button> -->
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<script>
|
<script>
|
||||||
$(document).ready(function(){
|
$(document).ready(function(){
|
||||||
|
// $(".tables").on('click', function(){
|
||||||
|
// var customer_id=$(".customer-id").text();
|
||||||
|
// show_customer_details(customer_id);
|
||||||
|
|
||||||
|
// var dining_id = $(this).attr("data-id");
|
||||||
|
// window.location.href = '/origami/table/' + dining_id;
|
||||||
|
// })
|
||||||
|
// $(".sales").on('click',function(){
|
||||||
|
// var customer_id=$(".customer-id").text();
|
||||||
|
// show_customer_details(customer_id);
|
||||||
|
|
||||||
|
// var sale_id = $(this).attr("data-id");
|
||||||
|
// window.location.href = '/origami/sale/' + sale_id;
|
||||||
|
// })
|
||||||
|
// $(".rooms").on('click', function(){
|
||||||
|
// var customer_id=$(".customer-id").text();
|
||||||
|
// show_customer_details(customer_id);
|
||||||
|
|
||||||
|
// var dining_id = $(this).attr("data-id");
|
||||||
|
// window.location.href = '/origami/room/' + dining_id;
|
||||||
|
// })
|
||||||
|
// $(".orders").on('click',function(){
|
||||||
|
// var customer_id=$(".customer-id").text();
|
||||||
|
// show_customer_details(customer_id);
|
||||||
|
|
||||||
|
// var order_id = $(this).attr("data-id");
|
||||||
|
// window.location.href = '/origami/order/' + order_id;
|
||||||
|
// })
|
||||||
|
|
||||||
|
$('.invoicedetails').on('click',function(){
|
||||||
|
var dining_id = "<%= @dining.id %>";
|
||||||
|
var sale_id = this.id;
|
||||||
|
window.location.href = '/origami/table/'+ dining_id + "/table_invoice/"+sale_id;
|
||||||
|
})
|
||||||
$(".tables").on('click', function(){
|
$(".tables").on('click', function(){
|
||||||
|
|
||||||
var customer_id=$(".customer-id").text();
|
var customer_id=$(".customer-id").text();
|
||||||
show_customer_details(customer_id);
|
show_customer_details(customer_id);
|
||||||
|
|
||||||
var dining_id = $(this).attr("data-id");
|
var dining_id = $(this).attr("data-id");
|
||||||
window.location.href = '/origami/table/' + dining_id;
|
window.location.href = '/origami/table/' + dining_id;
|
||||||
})
|
});
|
||||||
|
|
||||||
$(".sales").on('click',function(){
|
$(".sales").on('click',function(){
|
||||||
|
|
||||||
var customer_id=$(".customer-id").text();
|
var customer_id=$(".customer-id").text();
|
||||||
show_customer_details(customer_id);
|
show_customer_details(customer_id);
|
||||||
|
|
||||||
var sale_id = $(this).attr("data-id");
|
var sale_id = $(this).attr("data-id");
|
||||||
window.location.href = '/origami/sale/' + sale_id;
|
window.location.href = '/origami/sale/' + sale_id;
|
||||||
})
|
});
|
||||||
|
|
||||||
$(".rooms").on('click', function(){
|
$(".rooms").on('click', function(){
|
||||||
|
|
||||||
var customer_id=$(".customer-id").text();
|
var customer_id=$(".customer-id").text();
|
||||||
show_customer_details(customer_id);
|
show_customer_details(customer_id);
|
||||||
|
|
||||||
var dining_id = $(this).attr("data-id");
|
var dining_id = $(this).attr("data-id");
|
||||||
window.location.href = '/origami/room/' + dining_id;
|
window.location.href = '/origami/room/' + dining_id;
|
||||||
})
|
});
|
||||||
|
|
||||||
$(".orders").on('click',function(){
|
$(".orders").on('click',function(){
|
||||||
|
|
||||||
var customer_id=$(".customer-id").text();
|
var customer_id=$(".customer-id").text();
|
||||||
show_customer_details(customer_id);
|
show_customer_details(customer_id);
|
||||||
|
|
||||||
var order_id = $(this).attr("data-id");
|
var order_id = $(this).attr("data-id");
|
||||||
window.location.href = '/origami/order/' + order_id;
|
window.location.href = '/origami/order/' + order_id;
|
||||||
})
|
});
|
||||||
|
|
||||||
// bind customer to order or sale
|
// bind customer to order or sale
|
||||||
$("#customer").on('click', function(){
|
$("#customer").on('click', function(){
|
||||||
var sale = $('#sale_id').val();
|
var sale = $('#sale_id').val();
|
||||||
if (sale) {
|
if (sale) {
|
||||||
var sale_id = sale
|
var sale_id = sale
|
||||||
}else{
|
}else{
|
||||||
var sale_id = $('#save_order_id').attr('data-order');
|
var sale_id = $('#save_order_id').attr('data-order');
|
||||||
}
|
}
|
||||||
|
var table_id = $('.tables').attr("data-id");
|
||||||
|
|
||||||
window.location.href = '/origami/'+ sale_id + "/customers"
|
window.location.href = '/origami/'+ sale_id + "/customers"
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$('#re-print').click(function() {
|
||||||
|
var sale_id = $('#sale_id').val();
|
||||||
|
window.location.href = '/origami/'+ sale_id + "/reprint"
|
||||||
|
|
||||||
|
return false;
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
// Discount for Payment
|
// Discount for Payment
|
||||||
$('#discount').click(function() {
|
$('#discount').click(function() {
|
||||||
var sale = $('#sale_id').val();
|
var sale = $('#sale_id').val();
|
||||||
@@ -341,6 +408,20 @@ $("#customer").on('click', function(){
|
|||||||
|
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
// Print for first bill
|
||||||
|
$("#first_bill").on('click', function(){
|
||||||
|
var sale_id = $('#sale_id').val();
|
||||||
|
var ajax_url = "/origami/sale/"+ sale_id + "/first_bill";
|
||||||
|
$.ajax({
|
||||||
|
type: "GET",
|
||||||
|
url: ajax_url,
|
||||||
|
success:function(result){
|
||||||
|
location.reload();
|
||||||
|
}
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
@@ -354,9 +435,9 @@ $('#request_bills').click(function() {
|
|||||||
var order_id = $('#save_order_id').attr('data-order');
|
var order_id = $('#save_order_id').attr('data-order');
|
||||||
var ajax_url = "/origami/" + order_id + "/request_bills";
|
var ajax_url = "/origami/" + order_id + "/request_bills";
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type: "POST",
|
type: "GET",
|
||||||
url: ajax_url,
|
url: ajax_url,
|
||||||
data: 'order_id='+ order_id,
|
// data: 'order_id='+ order_id,
|
||||||
success:function(result){
|
success:function(result){
|
||||||
|
|
||||||
location.reload();
|
location.reload();
|
||||||
@@ -373,39 +454,109 @@ $('#back').on('click',function(){
|
|||||||
window.location.href = '/origami/';
|
window.location.href = '/origami/';
|
||||||
})
|
})
|
||||||
|
|
||||||
//show cusotmer rebate amount
|
$('#add_invoice').on('click',function(){
|
||||||
function show_customer_details(customer_id){
|
var dining_id = "<%= @dining.id %>"
|
||||||
|
var sale_id = "<%= @obj_sale.sale_id rescue "" %>"
|
||||||
|
var ajax_url = "/origami/sale/append_order";
|
||||||
|
$.ajax({
|
||||||
|
type: "POST",
|
||||||
|
url: ajax_url,
|
||||||
|
data: 'dining_id='+ dining_id + "&sale_id=" + sale_id,
|
||||||
|
success:function(result){
|
||||||
|
alert("Invoice updated")
|
||||||
|
window.location.reload();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
// //show cusotmer rebate amount
|
||||||
|
// function show_customer_details(customer_id){
|
||||||
|
// var url = '<%= @show_customer_details_path %>'
|
||||||
|
// //Start Ajax
|
||||||
|
// $.ajax({
|
||||||
|
// type: "GET",
|
||||||
|
// url: url,
|
||||||
|
// data: {},
|
||||||
|
// dataType: "json",
|
||||||
|
// success: function(data) {
|
||||||
|
// $("#customer_name").text(data["customer"].name);
|
||||||
|
// if (data["response_data"]["data"].length) {
|
||||||
|
// $.each(data["response_data"]["data"], function (i) {
|
||||||
|
// if(data["response_data"]["data"][i]["accountable_type"] == "RebateAccount"){
|
||||||
|
// var balance = data["response_data"]["data"][i]["balance"];
|
||||||
|
// if (data["response_data"]["status"]==true) {
|
||||||
|
// $('.rebate_amount').removeClass('hide');
|
||||||
|
// row =
|
||||||
|
// '<td class="charges-name">' + "Rebate Balance" +'</td>'
|
||||||
|
// +'<td class="item-attr">' + balance + '</td>';
|
||||||
|
|
||||||
|
// $(".rebate_amount").html(row);
|
||||||
|
// }
|
||||||
|
|
||||||
|
// }
|
||||||
|
// });
|
||||||
|
// }else{
|
||||||
|
// $('.rebate_amount').addClass('hide');
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// });
|
||||||
|
// //End Ajax
|
||||||
|
// }
|
||||||
|
|
||||||
|
//show cusotmer rebate amount
|
||||||
|
function show_customer_details(customer_id){
|
||||||
var url = '<%= @show_customer_details_path %>'
|
var url = '<%= @show_customer_details_path %>'
|
||||||
|
//Start Ajax
|
||||||
|
$.ajax({
|
||||||
|
type: "GET",
|
||||||
|
url: url,
|
||||||
|
data: {},
|
||||||
|
dataType: "json",
|
||||||
|
success: function(data) {
|
||||||
|
$("#customer_name").text(data["customer"].name);
|
||||||
|
if (data["response_data"]["data"].length) {
|
||||||
|
$.each(data["response_data"]["data"], function (i) {
|
||||||
|
if(data["response_data"]["data"][i]["accountable_type"] == "RebateAccount"){
|
||||||
|
var balance = data["response_data"]["data"][i]["balance"];
|
||||||
|
if (data["response_data"]["status"]==true) {
|
||||||
|
$('.rebate_amount').removeClass('hide');
|
||||||
|
row =
|
||||||
|
'<td class="charges-name">' + "Rebate Balance" +'</td>'
|
||||||
|
+'<td class="item-attr">' + balance + '</td>';
|
||||||
|
|
||||||
//Start Ajax
|
$(".rebate_amount").html(row);
|
||||||
$.ajax({
|
|
||||||
type: "GET",
|
|
||||||
url: url,
|
|
||||||
data: {},
|
|
||||||
dataType: "json",
|
|
||||||
success: function(data) {
|
|
||||||
$("#customer_name").text(data["customer"].name);
|
|
||||||
if (data["response_data"]["data"].length) {
|
|
||||||
$.each(data["response_data"]["data"], function (i) {
|
|
||||||
if(data["response_data"]["data"][i]["accountable_type"] == "RebateAccount"){
|
|
||||||
var balance = data["response_data"]["data"][i]["balance"];
|
|
||||||
if (data["response_data"]["status"]==true) {
|
|
||||||
$('.rebate_amount').removeClass('hide');
|
|
||||||
row =
|
|
||||||
'<td class="charges-name">' + "Rebate Balance" +'</td>'
|
|
||||||
+'<td class="item-attr">' + balance + '</td>';
|
|
||||||
|
|
||||||
$(".rebate_amount").html(row);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
|
||||||
}else{
|
|
||||||
$('.rebate_amount').addClass('hide');
|
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
});
|
}else{
|
||||||
//End Ajax
|
$('.rebate_amount').addClass('hide');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
//End Ajax
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$('#edit').on('click',function(){
|
||||||
|
var dining_id = "<%= @dining.id %>"
|
||||||
|
var sale_id = "<%= @obj_sale.sale_id rescue "" %>"
|
||||||
|
window.location.href = '/origami/table/'+ dining_id + "/sale/"+ sale_id + "/edit";
|
||||||
|
});
|
||||||
|
|
||||||
|
$('#void').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';
|
||||||
|
$.ajax({
|
||||||
|
type: 'POST',
|
||||||
|
url: ajax_url,
|
||||||
|
success: function () {
|
||||||
|
window.location.href = '/origami/';
|
||||||
|
}
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -26,7 +26,7 @@
|
|||||||
<% @complete.each do |sale| %>
|
<% @complete.each do |sale| %>
|
||||||
<div class="card sales red text-white" data-id = "<%= sale.sale_id %>">
|
<div class="card sales red text-white" data-id = "<%= sale.sale_id %>">
|
||||||
<div class="card-block">
|
<div class="card-block">
|
||||||
<%= sale.receipt_no %>
|
<%= sale.receipt_no %><span style="font-size:12px;float:right;line-height:inherit;"><%= sale.sale_status %></span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
@@ -117,7 +117,7 @@
|
|||||||
</span></p>
|
</span></p>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-lg-6 col-md-6 col-sm-6 text-right">
|
<div class="col-lg-6 col-md-6 col-sm-6 text-right">
|
||||||
<p>Date: <span id="receipt_date"><%= @sale.created_at.utc.getlocal.strftime("%d/%m/%Y - %I:%M %p") rescue '-'%></span></p>
|
<p>Date: <span id="receipt_date"><%= @sale.created_at.strftime("%d/%m/%Y - %I:%M %p") rescue '-'%></span></p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="card-title row customer_detail hide">
|
<div class="card-title row customer_detail hide">
|
||||||
@@ -185,7 +185,9 @@
|
|||||||
<!-- Column Three -->
|
<!-- Column Three -->
|
||||||
<div class="col-lg-1 col-md-1 col-sm-1">
|
<div class="col-lg-1 col-md-1 col-sm-1">
|
||||||
<button type="button" class="btn btn-primary btn-block" id='back'>Back</button>
|
<button type="button" class="btn btn-primary btn-block" id='back'>Back</button>
|
||||||
<button type="button" id="void" class="btn btn-primary btn-block">VOID</button>
|
<% if @sale.sale_status != 'void' %>
|
||||||
|
<button type="button" id="void" class="btn btn-primary btn-block">VOID</button>
|
||||||
|
<% end %>
|
||||||
<button type="button" id="re-print" class="btn btn-primary btn-block">Re.Print</button>
|
<button type="button" id="re-print" class="btn btn-primary btn-block">Re.Print</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
1
app/views/origami/shifts/create.json.jbuilder
Normal file
1
app/views/origami/shifts/create.json.jbuilder
Normal file
@@ -0,0 +1 @@
|
|||||||
|
json.status true
|
||||||
1
app/views/origami/shifts/edit.html.erb
Normal file
1
app/views/origami/shifts/edit.html.erb
Normal file
@@ -0,0 +1 @@
|
|||||||
|
<h1> Close Cashier </h1>
|
||||||
2
app/views/origami/shifts/index.html.erb
Normal file
2
app/views/origami/shifts/index.html.erb
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
<h1>Origami::Shifts#index</h1>
|
||||||
|
<p>Find me in app/views/origami/shifts/index.html.erb</p>
|
||||||
83
app/views/origami/shifts/new.html.erb
Normal file
83
app/views/origami/shifts/new.html.erb
Normal file
@@ -0,0 +1,83 @@
|
|||||||
|
<h1>Open Cashier</h1>
|
||||||
|
<br>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-12">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-4">
|
||||||
|
<table class='table table-striped'>
|
||||||
|
<% @float.each do |float| %>
|
||||||
|
<tr>
|
||||||
|
<th><%= float.name %></th>
|
||||||
|
<th><input class='float-value' type='text' data-value ="<%= float.value %>" value='' /></th>
|
||||||
|
</tr>
|
||||||
|
<% end %>
|
||||||
|
<tr>
|
||||||
|
<th>Total</th>
|
||||||
|
<th><div id='total'></div></th>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<div class="row">
|
||||||
|
<div class='col-md-4'></div>
|
||||||
|
<div class='col-md-2'>
|
||||||
|
<button class='btn btn-primary' id='open_cashier'>Open Cashier</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class='col-md-8'>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-lg-6 col-md-1 col-sm-1">
|
||||||
|
<div class="row bottom">
|
||||||
|
<div class=" cashier_number " data-value="1" data-type="num">1</div>
|
||||||
|
<div class=" cashier_number left" data-value="2" data-type="num">2</div>
|
||||||
|
<div class=" cashier_number left" data-value="3" data-type="num">3</div>
|
||||||
|
</div>
|
||||||
|
<div class="row bottom">
|
||||||
|
<div class=" cashier_number " data-value="4" data-type="num">4</div>
|
||||||
|
<div class=" cashier_number left" data-value="5" data-type="num">5</div>
|
||||||
|
<div class=" cashier_number left" data-value="6" data-type="num">6</div>
|
||||||
|
</div>
|
||||||
|
<div class="row bottom">
|
||||||
|
<div class=" cashier_number " data-value="7" data-type="num">7</div>
|
||||||
|
<div class=" cashier_number left" data-value="8" data-type="num">8</div>
|
||||||
|
<div class=" cashier_number left" data-value="9" data-type="num">9</div>
|
||||||
|
</div>
|
||||||
|
<div class="row bottom">
|
||||||
|
<div class=" cashier_number " data-value="0" data-type="num">0</div>
|
||||||
|
<div class=" cashier_number left" data-value="." data-type="num">.</div>
|
||||||
|
<div class=" cashier_number left" data-value="00" data-type="num">00</div>
|
||||||
|
</div>
|
||||||
|
<div class="row bottom">
|
||||||
|
<div class=" cashier_number red" data-type="del" >Del</div>
|
||||||
|
<div class=" cashier_number orange left" data-type="clr">Clr</div>
|
||||||
|
<div class=" cashier_number purple left" data-type="ent">Ent</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
var total = 0
|
||||||
|
$(document).on('focusout', '.float-value', function(event){
|
||||||
|
var input_type = $(this).attr("data-value");
|
||||||
|
var count = $(this).val();
|
||||||
|
total += input_type * count
|
||||||
|
$('#total').text(total)
|
||||||
|
|
||||||
|
})
|
||||||
|
$('#open_cashier').on('click',function(){
|
||||||
|
var amount = $('#total').text();
|
||||||
|
$.ajax({type: "POST",
|
||||||
|
url: "<%= origami_shifts_path %>",
|
||||||
|
data: "opening_balance=" + amount,
|
||||||
|
success:function(result){
|
||||||
|
if(result){
|
||||||
|
window.location.href = '/origami';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
})
|
||||||
|
</script>
|
||||||
48
app/views/origami/shifts/show.html.erb
Normal file
48
app/views/origami/shifts/show.html.erb
Normal file
@@ -0,0 +1,48 @@
|
|||||||
|
|
||||||
|
<div class='row'>
|
||||||
|
<div class='col-md-10'>
|
||||||
|
<h1>Close Cashier</h1>
|
||||||
|
<br>
|
||||||
|
<table class='table table-striped'>
|
||||||
|
<tr>
|
||||||
|
<td>Shift Started At</td>
|
||||||
|
<td><%= @shift.shift_started_at.utc.getlocal.strftime("%d/%m/%Y - %I:%M %p") rescue '-' %></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>Cashier Name</td>
|
||||||
|
<td><%= @shift.employee.name rescue ''%></td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
</table>
|
||||||
|
<hr>
|
||||||
|
<div class='row'>
|
||||||
|
<div class='col-md-5'>
|
||||||
|
<span style='font-size:20px;'><b>Closing Balance</b></span>
|
||||||
|
</div>
|
||||||
|
<div class='col-md-6'>
|
||||||
|
<span style='font-size:20px;'><b><input type='text' id='closing_balance_amount' value=''></b></span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-lg-2 col-md-2 col-sm-2">
|
||||||
|
<button type="button" class="btn btn-primary btn-block" id='back'> Back </button>
|
||||||
|
<button type="button" class="btn btn-primary btn-block green" id='close_cashier'> Close Cashier </button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<script>
|
||||||
|
$('#close_cashier').on('click',function(){
|
||||||
|
var amount = $('#closing_balance_amount').val();
|
||||||
|
var shift_id = "<%= @shift.id %>"
|
||||||
|
$.ajax({type: "POST",
|
||||||
|
url: "<%= origami_close_shift_path %>",
|
||||||
|
data: "closing_balance="+ amount + "&shift_id="+ shift_id,
|
||||||
|
success:function(result){
|
||||||
|
console.log(result)
|
||||||
|
window.location.href = '/';
|
||||||
|
}
|
||||||
|
});
|
||||||
|
})
|
||||||
|
$('#back').on('click',function(){
|
||||||
|
window.location.href = '/origami';
|
||||||
|
})
|
||||||
|
</script>
|
||||||
1
app/views/origami/shifts/update_shift.json.jbuilder
Normal file
1
app/views/origami/shifts/update_shift.json.jbuilder
Normal file
@@ -0,0 +1 @@
|
|||||||
|
json.status true
|
||||||
@@ -128,6 +128,7 @@
|
|||||||
<div class="col-lg-1 col-md-1 col-sm-1">
|
<div class="col-lg-1 col-md-1 col-sm-1">
|
||||||
<button type="button" class="btn btn-primary btn-block" id='back'>Back</button>
|
<button type="button" class="btn btn-primary btn-block" id='back'>Back</button>
|
||||||
<button type="button" id="pay" class="btn btn-primary btn-block">Pay</button>
|
<button type="button" id="pay" class="btn btn-primary btn-block">Pay</button>
|
||||||
|
<button type="button" id="void" class="btn btn-primary btn-block"> Void </button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<script>
|
<script>
|
||||||
@@ -143,5 +144,21 @@ $('#pay').on('click',function() {
|
|||||||
});
|
});
|
||||||
$('#back').on('click',function(){
|
$('#back').on('click',function(){
|
||||||
window.location.href = '/origami/table/<%= @table.id %>';
|
window.location.href = '/origami/table/<%= @table.id %>';
|
||||||
})
|
});
|
||||||
|
$('#void').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';
|
||||||
|
$.ajax({
|
||||||
|
type: 'POST',
|
||||||
|
url: ajax_url,
|
||||||
|
success: function () {
|
||||||
|
window.location.href = '/origami/';
|
||||||
|
}
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -14,6 +14,9 @@
|
|||||||
<%= f.input :page_width %>
|
<%= f.input :page_width %>
|
||||||
<%= f.input :page_height %>
|
<%= f.input :page_height %>
|
||||||
<%= f.input :print_copies %>
|
<%= f.input :print_copies %>
|
||||||
|
<%= f.input :precision %>
|
||||||
|
<%= f.input :delimiter %>
|
||||||
|
<%= f.input :heading_space %>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-actions">
|
<div class="form-actions">
|
||||||
|
|||||||
@@ -26,6 +26,9 @@
|
|||||||
<th>Page width</th>
|
<th>Page width</th>
|
||||||
<th>Page height</th>
|
<th>Page height</th>
|
||||||
<th>Print copies</th>
|
<th>Print copies</th>
|
||||||
|
<th>Precision</th>
|
||||||
|
<th>Delimiter</th>
|
||||||
|
<th>Heading_space</th>
|
||||||
<th colspan="3"></th>
|
<th colspan="3"></th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
@@ -45,6 +48,9 @@
|
|||||||
<td><%= print_setting.page_width %></td>
|
<td><%= print_setting.page_width %></td>
|
||||||
<td><%= print_setting.page_height %></td>
|
<td><%= print_setting.page_height %></td>
|
||||||
<td><%= print_setting.print_copies %></td>
|
<td><%= print_setting.print_copies %></td>
|
||||||
|
<td><%= print_setting.precision %></td>
|
||||||
|
<td><%= print_setting.delimiter %></td>
|
||||||
|
<td><%= print_setting.heading_space %></td>
|
||||||
<td><%= link_to 'Show', print_setting %></td>
|
<td><%= link_to 'Show', print_setting %></td>
|
||||||
<td><%= link_to 'Edit', edit_print_setting_path(print_setting) %></td>
|
<td><%= link_to 'Edit', edit_print_setting_path(print_setting) %></td>
|
||||||
<td><%= link_to 'Destroy', print_setting, method: :delete, data: { confirm: 'Are you sure?' } %></td>
|
<td><%= link_to 'Destroy', print_setting, method: :delete, data: { confirm: 'Are you sure?' } %></td>
|
||||||
|
|||||||
@@ -1,151 +0,0 @@
|
|||||||
<div class="row">
|
|
||||||
<div class="col-md-12">
|
|
||||||
<%= form_tag report_path, :method => :get, :id=>"frm_report", :class => "form" do %>
|
|
||||||
<% if period_type != false %>
|
|
||||||
<div class="row">
|
|
||||||
<div class="form-group col-md-2">
|
|
||||||
<label>Select Period</label>
|
|
||||||
<select name="period" id="sel_period" class="form-control">
|
|
||||||
<option value="0">Today</option>
|
|
||||||
<option value="1">Yesterday</option>
|
|
||||||
<option value="2">This week</option>
|
|
||||||
<option value="3">Last week</option>
|
|
||||||
<option value="4">Last 7 days</option>
|
|
||||||
<option value="5">This month</option>
|
|
||||||
<option value="6">Last month</option>
|
|
||||||
<option value="7">Last 30 days</option>
|
|
||||||
<option value="8">This year</option>
|
|
||||||
<option value="9">Last year</option>
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
<input type="hidden" name="report_type" value="daily_sale" id="sel_sale_type">
|
|
||||||
<!-- <div class="form-group col-md-2">
|
|
||||||
<label>Select Type</label>
|
|
||||||
<select name="sale_type" id="sel_sale_type" class="form-control">
|
|
||||||
<option value="0">All Sale Type</option>
|
|
||||||
<option value="1">Revenue Only</option>
|
|
||||||
<option value="2">Discount Only</option>
|
|
||||||
<option value="3">Void Only</option>
|
|
||||||
<option value="4">Taxes Only</option>
|
|
||||||
<option value="5">Other Amount Only</option>
|
|
||||||
</select>
|
|
||||||
</div> -->
|
|
||||||
<div class="form-group col-md-3">
|
|
||||||
<!-- <label class="">Select Shift Period</label> -->
|
|
||||||
<label class="">From</label>
|
|
||||||
<input data-behaviour='datepicker' class="form-control" name="from" id="from" type="text" placeholder="From date">
|
|
||||||
</div>
|
|
||||||
<div class="form-group col-md-3">
|
|
||||||
<label class="">To</label>
|
|
||||||
<input data-behaviour='datepicker' class="form-control" name="to" id="to" type="text" placeholder="To date">
|
|
||||||
</div>
|
|
||||||
<div class="form-group col-md-2 margin-top-20">
|
|
||||||
<input type="submit" value="Generate Report" class='btn btn-primary'>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<% end %>
|
|
||||||
|
|
||||||
<!-- <div class="row">
|
|
||||||
<% if defined? show_monthly %>
|
|
||||||
<div class="span3" style="margin-bottom:10px;">
|
|
||||||
<input type="hidden" id="report_type" name="report_type" value="0">
|
|
||||||
<div class="btn-group" data-toggle="buttons-radio">
|
|
||||||
<button id="btn_report_type_1" onclick="$('#report_type').val(1)" type="button" class="btn btn-inverse">Monthly</button>
|
|
||||||
<button id="btn_report_type_2" onclick="$('#report_type').val(2)" type="button" class="btn btn-inverse">Yearly</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<% end %>
|
|
||||||
</div> -->
|
|
||||||
|
|
||||||
<div class="row">
|
|
||||||
<div class="form-group">
|
|
||||||
<% if defined? promotions %>
|
|
||||||
<%= select_tag "promotion", options_for_select(@promotions, :selected => params[:promotion_type]), :class => "form-control" %>
|
|
||||||
<% end %>
|
|
||||||
|
|
||||||
<% if defined? menu_types %>
|
|
||||||
<%= select_tag "menu_type", options_for_select(@menu_types, :selected => params[:menu_type]), :class => "form-control" %>
|
|
||||||
<% end %>
|
|
||||||
|
|
||||||
<% if defined? payments %>
|
|
||||||
<%= select_tag "payment_type", options_for_select(@payments, :selected => params[:payment_type]), :class => "form-control" %>
|
|
||||||
<% end %>
|
|
||||||
|
|
||||||
<% if defined? shift_name %>
|
|
||||||
<!-- Temporary no needs
|
|
||||||
<select name="shift_name" id="shift_name"></select>
|
|
||||||
-->
|
|
||||||
<% end %>
|
|
||||||
|
|
||||||
<% if defined? cashiers %>
|
|
||||||
<%= select_tag "cashier", options_from_collection_for_select(@cashiers,"id","name"),:prompt => "All Cashier Stations", :class => "form-control" %>
|
|
||||||
<% end %>
|
|
||||||
|
|
||||||
<% if defined? singer %>
|
|
||||||
<%= select_tag "singer", options_from_collection_for_select(singer,"id","name"),:prompt => "All Vocal List", :class => "form-control" %>
|
|
||||||
<% end %>
|
|
||||||
|
|
||||||
<% if defined? bsm %>
|
|
||||||
<%= select_tag "singer", options_from_collection_for_select(bsm,"id","name"),:prompt => "All BSM List", :class => "form-control" %>
|
|
||||||
<% end %>
|
|
||||||
|
|
||||||
<% if defined? guest_role %>
|
|
||||||
<%= select_tag "guest_role", options_from_collection_for_select(@guest_role,"id","name"),:prompt => "Vocal/BSM List", :class => "form-control" %>
|
|
||||||
<% end %>
|
|
||||||
|
|
||||||
<% if defined? list_by_payment_type %> <!-- for report detail by credit and foc -->
|
|
||||||
<%= select_tag "payment_type_list", options_for_select(@payment_list, :selected => params[:payment_type_list]), :class => "form-control" %>
|
|
||||||
<% end %>
|
|
||||||
|
|
||||||
<% if defined? products %>
|
|
||||||
<%= select_tag "product", options_from_collection_for_select(@products,"id","name"),:prompt => "All Products", :class => "form-control" %>
|
|
||||||
<% end %>
|
|
||||||
|
|
||||||
<% if defined? items %>
|
|
||||||
<%= select_tag "item", options_for_select(@items, :selected => params[:item_type]), :class => "form-control" %>
|
|
||||||
<% end %>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- <div class="row">
|
|
||||||
<div class="col-md-12">
|
|
||||||
<input type="submit" value="Generate Report" class='btn btn-primary'>
|
|
||||||
</div>
|
|
||||||
</div> -->
|
|
||||||
|
|
||||||
<% end %>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!--
|
|
||||||
<div class = "row">
|
|
||||||
|
|
||||||
<div class = "span3">
|
|
||||||
<input type="button" value="Filter by Shift" class='btn' onclick = "select_shift(this)">
|
|
||||||
</div>
|
|
||||||
<div class = "span3">
|
|
||||||
<select name="shift" id="shift">
|
|
||||||
<option value="">All Shift</option>
|
|
||||||
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
<div class = "span3">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
-->
|
|
||||||
|
|
||||||
<script type="text/javascript">
|
|
||||||
$(function(){
|
|
||||||
$('#custom_excel').hide();
|
|
||||||
|
|
||||||
$('#custom_excel').click(function(){
|
|
||||||
var url = $('#custom_excel').attr('data-url');
|
|
||||||
$('#frm_report').attr('action',url)
|
|
||||||
$('#frm_report').submit();
|
|
||||||
// window.location = url;
|
|
||||||
});
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
</script>
|
|
||||||
@@ -1,190 +0,0 @@
|
|||||||
<div class="page-header">
|
|
||||||
<ul class="breadcrumb">
|
|
||||||
<li><a href="<%= dashboard_path %>">Home</a></li>
|
|
||||||
<li>Daily Sale Report</li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="container">
|
|
||||||
<%= render :partial=>'shift_sale_report_filter',
|
|
||||||
:locals=>{ :period_type => true, :shift_name => false, :report_path =>reports_daily_sales_path} %>
|
|
||||||
<hr />
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="container">
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-md-12 text-right">
|
|
||||||
<a href="javascript:export_to('<%=reports_daily_sales_path%>.xls')" class = "btn btn-default">Export to Excel</a>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="container margin-top-20">
|
|
||||||
<div class="card row">
|
|
||||||
<div class="table-responsive">
|
|
||||||
<table class="table table-bordered">
|
|
||||||
<thead>
|
|
||||||
<% if params[:from]%>
|
|
||||||
<tr>
|
|
||||||
<th colspan="17"> Sale (<%= params[:from] rescue '-' %> - <%= params[:to] rescue '-'%>)</th>
|
|
||||||
</tr>
|
|
||||||
<% end %>
|
|
||||||
<tr>
|
|
||||||
<th style='text-align:center;'>Sr.no</th>
|
|
||||||
<th style='text-align:center;'>Date</th>
|
|
||||||
<th style='text-align:center;'>Void Amount</th>
|
|
||||||
<th style='text-align:center;'>Mpu Sales</th>
|
|
||||||
<th style='text-align:center;'>Master Sales</th>
|
|
||||||
<th style='text-align:center;'>Visa Sales</th>
|
|
||||||
<th style='text-align:center;'>Jcb Sales</th>
|
|
||||||
<th style='text-align:center;'>Paypar Sales</th>
|
|
||||||
<th style='text-align:center;'>Cash Sales</th>
|
|
||||||
<th style='text-align:center;'>Credit Sales</th>
|
|
||||||
<th style='text-align:center;'>FOC Sales</th>
|
|
||||||
<th style='text-align:center;'>(Discount)</th>
|
|
||||||
<th style='text-align:center;'>Grand Total + <br/> Rounding Adj.</th>
|
|
||||||
<th style='text-align:center;'>Rounding Adj.</th>
|
|
||||||
<th style='text-align:center;'>Grand Total</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<% unless @sale_data.empty? %>
|
|
||||||
|
|
||||||
<tbody>
|
|
||||||
<% void = 0 %>
|
|
||||||
<% mpu = 0 %>
|
|
||||||
<% master = 0 %>
|
|
||||||
<% visa = 0 %>
|
|
||||||
<% jcb = 0 %>
|
|
||||||
<% paypar = 0 %>
|
|
||||||
<% cash = 0 %>
|
|
||||||
<% credit = 0 %>
|
|
||||||
<% foc = 0 %>
|
|
||||||
<% discount = 0 %>
|
|
||||||
<% total = 0 %>
|
|
||||||
<% grand_total = 0 %>
|
|
||||||
<% count = 1 %> <% rounding_adj = 0 %>
|
|
||||||
<% @sale_data.each do |sale| %>
|
|
||||||
<% void += sale[:void_amount] %>
|
|
||||||
<% mpu += sale[:mpu_amount] %>
|
|
||||||
<% master += sale[:master_amount] %>
|
|
||||||
<% visa += sale[:visa_amount] %>
|
|
||||||
<% jcb += sale[:jcb_amount] %>
|
|
||||||
<% paypar += sale[:paypar_amount] %>
|
|
||||||
<% cash += sale[:cash_amount] %>
|
|
||||||
<% credit += sale[:credit_amount] %>
|
|
||||||
<% foc += sale[:foc_amount] %>
|
|
||||||
<% discount += sale[:total_discount] %>
|
|
||||||
<% total += sale[:grand_total].to_f + sale[:rounding_adj].to_f %>
|
|
||||||
<% grand_total += sale[:grand_total].to_f %>
|
|
||||||
<% rounding_adj += sale[:rounding_adj].to_f %>
|
|
||||||
<tr>
|
|
||||||
<td style='text-align:right;'><%= count %></td>
|
|
||||||
<td><%= sale[:sale_date].strftime("#{sale[:sale_date].day.ordinalize} %b") rescue '-' %></td>
|
|
||||||
<td style='color:red;text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:void_amount]), :delimiter => ',') rescue '-'%></td>
|
|
||||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:mpu_amount]), :delimiter => ',') rescue '-'%></td>
|
|
||||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:master_amount]), :delimiter => ',') rescue '-'%></td>
|
|
||||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:visa_amount]), :delimiter => ',') rescue '-'%></td>
|
|
||||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:jcb_amount]), :delimiter => ',') rescue '-'%></td>
|
|
||||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:paypar_amount]), :delimiter => ',') rescue '-'%></td>
|
|
||||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:cash_amount]), :delimiter => ',') rescue '-'%></td>
|
|
||||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:credit_amount]), :delimiter => ',') rescue '-'%></td>
|
|
||||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:foc_amount]), :delimiter => ',') rescue '-'%></td>
|
|
||||||
<td style='text-align:right;'>(<%= number_with_delimiter(sprintf("%.2f",sale[:total_discount]), :delimiter => ',') rescue '-'%>)</td>
|
|
||||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:grand_total].to_f + sale[:rounding_adj].to_f ), :delimiter => ',') rescue '-'%></td>
|
|
||||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:rounding_adj].to_f), :delimiter => ',') rescue '-'%></td>
|
|
||||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:grand_total]), :delimiter => ',') rescue '-'%></td>
|
|
||||||
</tr>
|
|
||||||
<% count = count + 1 %>
|
|
||||||
<% end %>
|
|
||||||
|
|
||||||
<tr style="font-weight:600;">
|
|
||||||
<td colspan="3" style='text-align:center;'>Total</td>
|
|
||||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",mpu_amount), :delimiter => ',') rescue '-'%></td>
|
|
||||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",master_amount), :delimiter => ',') rescue '-'%></td>
|
|
||||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",visa_amount), :delimiter => ',') rescue '-'%></td>
|
|
||||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",jcb_amount), :delimiter => ',') rescue '-'%></td>
|
|
||||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",paypar_amount), :delimiter => ',') rescue '-'%></td>
|
|
||||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",cash), :delimiter => ',') rescue '-'%></td>
|
|
||||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",credit), :delimiter => ',') rescue '-'%></td>
|
|
||||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",foc), :delimiter => ',') rescue '-'%></td>
|
|
||||||
<td style='text-align:right;'>(<%= number_with_delimiter(sprintf("%.2f",discount), :delimiter => ',') rescue '-'%>)</td>
|
|
||||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",total), :delimiter => ',') rescue '-'%></td>
|
|
||||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",rounding_adj), :delimiter => ',') rescue '-'%></td>
|
|
||||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",grand_total), :delimiter => ',') rescue '-'%></td>
|
|
||||||
</tr>
|
|
||||||
|
|
||||||
<% total_tax = 0 %>
|
|
||||||
<% unless @tax.empty? %>
|
|
||||||
<% @tax.each do |tax| %>
|
|
||||||
<% total_tax += tax.tax_amount.to_f %>
|
|
||||||
<tr style="font-weight:600;">
|
|
||||||
<td colspan="12" style='text-align:right;'><%= tax.tax_name rescue '-'%></td>
|
|
||||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",tax.tax_amount), :delimiter => ',') rescue '-'%></td>
|
|
||||||
<td colspan="2"> </td>
|
|
||||||
</tr>
|
|
||||||
|
|
||||||
<% end %>
|
|
||||||
<% net = total - total_tax %>
|
|
||||||
<tr style="font-weight:600;">
|
|
||||||
<td colspan="12" style='text-align:right;'>Net Amount</td>
|
|
||||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",net), :delimiter => ',') rescue '-'%></td>
|
|
||||||
<td colspan="2"> </td>
|
|
||||||
</tr>
|
|
||||||
<% end %>
|
|
||||||
</tbody>
|
|
||||||
<% end %>
|
|
||||||
</table>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
|
|
||||||
<script>
|
|
||||||
$(function(){
|
|
||||||
var check_arr = [];
|
|
||||||
var search = '<%= params[:period_type] %>';
|
|
||||||
if(search){
|
|
||||||
if(parseInt(search) == 0){
|
|
||||||
search_by_period();
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
search_by_date();
|
|
||||||
}
|
|
||||||
}else{
|
|
||||||
search_by_period();
|
|
||||||
}
|
|
||||||
$('#sel_period').change(function(){
|
|
||||||
search_by_period();
|
|
||||||
});
|
|
||||||
function search_by_period(){
|
|
||||||
var period = $('#sel_period').val();
|
|
||||||
var period_type = 0;
|
|
||||||
var from = "";
|
|
||||||
var to = "";
|
|
||||||
}
|
|
||||||
|
|
||||||
$('#from').change(function(){
|
|
||||||
search_by_date();
|
|
||||||
});
|
|
||||||
|
|
||||||
$('#to').change(function(){
|
|
||||||
search_by_date();
|
|
||||||
});
|
|
||||||
function search_by_date(){
|
|
||||||
var from = $('#from').val();
|
|
||||||
var to = $('#to').val();
|
|
||||||
var period = 0;
|
|
||||||
var period_type = 1;
|
|
||||||
if(to != '' && from != ''){
|
|
||||||
shift_name = from + ',' + to;
|
|
||||||
check_arr.push(to);
|
|
||||||
// console.log(check_arr.length)
|
|
||||||
if(check_arr.length == 1){
|
|
||||||
}
|
|
||||||
if(check_arr.length == 3){
|
|
||||||
check_arr = [];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
@@ -117,23 +117,6 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!--
|
|
||||||
<div class = "row">
|
|
||||||
|
|
||||||
<div class = "span3">
|
|
||||||
<input type="button" value="Filter by Shift" class='btn' onclick = "select_shift(this)">
|
|
||||||
</div>
|
|
||||||
<div class = "span3">
|
|
||||||
<select name="shift" id="shift">
|
|
||||||
<option value="">All Shift</option>
|
|
||||||
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
<div class = "span3">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
-->
|
|
||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
$(function(){
|
$(function(){
|
||||||
$('#custom_excel').hide();
|
$('#custom_excel').hide();
|
||||||
@@ -145,7 +128,68 @@ $(function(){
|
|||||||
// window.location = url;
|
// window.location = url;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
var item = $('#item').val();
|
||||||
|
var payment_type = $('#payment_type');
|
||||||
|
|
||||||
|
if(item == 'order'){
|
||||||
|
$('#cashier').hide();
|
||||||
|
$('#waiter').show();
|
||||||
|
if(payment_type){
|
||||||
|
$('#payment_type').hide();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if(item == 'sale'){
|
||||||
|
$('#waiter').hide();
|
||||||
|
$('#cashier').show();
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
$('#waiter').hide();
|
||||||
|
$('#cashier').show();
|
||||||
|
$("#item").val('sale');
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
//Reset the form to pervious values
|
||||||
|
$("#branch").val(<%=params[:branch]%>);
|
||||||
|
$("#waiter").val("<%=params[:waiter]%>");
|
||||||
|
$("#cashier").val(<%=params[:cashier]%>);
|
||||||
|
$("#product").val(<%=params[:product]%>);
|
||||||
|
$("#singer").val(<%=params[:singer]%>);
|
||||||
|
$("#item").val('<%=params[:item]%>');
|
||||||
|
$("#guest_role").val('<%=params[:guest_role]%>');
|
||||||
|
|
||||||
|
|
||||||
|
$("#from").val("<%=params[:from]%>");
|
||||||
|
$("#to").val("<%=params[:to]%>");
|
||||||
|
$("#sel_period").val(<%=params[:period]%>);
|
||||||
|
$("#sel_sale_type").val(<%=params[:sale_type]%>);
|
||||||
|
|
||||||
|
<% if params[:period_type] == 1 || params[:period_type] == "1" %>
|
||||||
|
$("#rd_period_type_1").attr("checked","checked");
|
||||||
|
<% else %>
|
||||||
|
$("#rd_period_type_0").attr("checked","checked");
|
||||||
|
<% end %>
|
||||||
|
$(".btn-group button").removeClass("active");
|
||||||
|
<% report_type = params[:report_type].blank? ? "0" : params[:report_type] %>
|
||||||
|
$("#btn_report_type_<%= report_type %>").addClass("active");
|
||||||
|
|
||||||
|
$('#item').change(function(){
|
||||||
|
var item = $('#item').val();
|
||||||
|
var payment_type = $('#payment_type');
|
||||||
|
|
||||||
|
if(item == 'sale'){
|
||||||
|
$('#waiter').hide();
|
||||||
|
$('#cashier').show();
|
||||||
|
if(payment_type){
|
||||||
|
$('#payment_type').show();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
$('#cashier').hide();
|
||||||
|
$('#waiter').show();
|
||||||
|
if(payment_type){
|
||||||
|
$('#payment_type').hide();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
@@ -7,14 +7,14 @@
|
|||||||
|
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<%= render :partial=>'shift_sale_report_filter',
|
<%= render :partial=>'shift_sale_report_filter',
|
||||||
:locals=>{ :period_type => true, :shift_name => false, :report_path =>reports_daily_sales_path} %>
|
:locals=>{ :period_type => true, :shift_name => false, :report_path =>reports_dailysale_index_path} %>
|
||||||
<hr />
|
<hr />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md-12 text-right">
|
<div class="col-md-12 text-right">
|
||||||
<a href="javascript:export_to('<%=reports_daily_sales_path%>.xls')" class = "btn btn-default">Export to Excel</a>
|
<a href="javascript:export_to('<%=reports_dailysale_index_path%>.xls')" class = "btn btn-default">Export to Excel</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -1,135 +1,43 @@
|
|||||||
<div class="span12">
|
<div class="span12">
|
||||||
<div class="table-responsive">
|
<div class="table-responsive">
|
||||||
|
|
||||||
<% unless @sale_data.empty? %>
|
<table class="table table-striped">
|
||||||
<h3 align="center"><%=current_active_location.name%></h3>
|
<thead>
|
||||||
<h3 align="center">Sales Summary Report (BreadTalk)</h3>
|
<tr>
|
||||||
<% if params[:from]%>
|
<th style='text-align:center;'>Date</th>
|
||||||
<h4>From Date : <%= params[:from] %> , To Date : <%= params[:to] %></h4>
|
<th style='text-align:center;'>Receipt No</th>
|
||||||
<% end %>
|
<th style='text-align:center;'>Cashier Name</th>
|
||||||
<table class="table table-bordered" border="1">
|
<th style='text-align:center;'>Gross Sales</th>
|
||||||
<thead>
|
<th style='text-align:center;'>Discount</th>
|
||||||
<tr>
|
<th style='text-align:center;'>Total Sales</th>
|
||||||
<!-- <th style='text-align:center;'>Sr.no</th> -->
|
<% TaxProfile.all.each do |r|%>
|
||||||
<th style='text-align:center;'>Location Name</th>
|
<th style='text-align:center;'><%=r.name%></th>
|
||||||
<th style='text-align:center;'>Date</th>
|
<% end %>
|
||||||
<th style='text-align:center;'>Cash Sales</th>
|
<th style='text-align:center;'>Nett Sales</th>
|
||||||
<th style='text-align:center;'>Credit Sales</th>
|
</tr>
|
||||||
<th style='text-align:center;'>Credit Received</th>
|
</thead>
|
||||||
<!-- <th style='text-align:center;'>Other Payment</th> -->
|
|
||||||
<th style='text-align:center;'>Card Payment</th>
|
|
||||||
<th style='text-align:center;'>Total Discount</th>
|
|
||||||
<th style='text-align:center;'>Total Taxes</th>
|
|
||||||
<th style='text-align:center;'>Total Other Charges</th>
|
|
||||||
<th style='text-align:center;'>FOC Sales</th>
|
|
||||||
<th style='text-align:center;'>Void Sales</th>
|
|
||||||
<th style='text-align:center;'>Grand Total</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
<% void = 0 %>
|
|
||||||
<% card = 0 %>
|
|
||||||
<% credit_payment = 0 %>
|
|
||||||
<% cash = 0 %>
|
|
||||||
<% credit = 0 %>
|
|
||||||
<% foc = 0 %>
|
|
||||||
<% discount = 0 %>
|
|
||||||
<% total = 0 %>
|
|
||||||
<% count = 1 %>
|
|
||||||
<% discount_rev = 0 %>
|
|
||||||
<% total_rev = 0 %>
|
|
||||||
<% grand_rev = 0 %>
|
|
||||||
<% total_other_charges=0 %>
|
|
||||||
<% total_tax=0 %>
|
|
||||||
<% cash_received = 0 %>
|
|
||||||
<% total_cash_received = 0 %>
|
|
||||||
<% today_credit_payment_amount = 0 %>
|
|
||||||
<% old_location_id = 0%>
|
|
||||||
<% sub_total = 0 %>
|
|
||||||
<% count_of_void = 0 %>
|
|
||||||
<% flag = false %>
|
|
||||||
<% @sale_data.each do |sale| %>
|
|
||||||
<% credit_payment += sale[:credit_payment].to_f %>
|
|
||||||
<% card += sale[:card_amount].to_f %>
|
|
||||||
<% cash += sale[:cash_amount].to_f %>
|
|
||||||
<% credit += sale[:credit_amount].to_f %>
|
|
||||||
<% foc += sale[:foc_amount].to_f %>
|
|
||||||
<% discount += sale[:total_discount].to_f %>
|
|
||||||
<% total += sale[:grand_total].to_f %>
|
|
||||||
<% total_other_charges +=sale[:other_charges].to_f %>
|
|
||||||
<% total_tax +=sale[:total_tax].to_f %>
|
|
||||||
|
|
||||||
<% cash_received = sale[:cash_amount].to_f + sale[:credit_payment].to_f%>
|
<tbody>
|
||||||
<% total_cash_received = cash.to_f + credit_payment.to_f%>
|
<% total_sales = 0 %>
|
||||||
<% today_credit_payment_amount += sale[:today_credit_payment].to_f %>
|
<% net_sales = 0 %>
|
||||||
|
<% @sale_data.each do |sale| %>
|
||||||
<tr>
|
<% total_sales = sale.total_amount.to_f - sale.total_discount.to_f%>
|
||||||
<!-- <td style='text-align:right;'><%= count %></td> -->
|
<% net_sales = total_sales.to_f + sale.total_tax.to_f%>
|
||||||
|
<tr>
|
||||||
<td style='text-align:right;'><%= sale[:location].to_s rescue '-' %></td>
|
<td style='text-align:center;'><%= sale.receipt_date.strftime("#{sale.receipt_date.day.ordinalize} %b") rescue '-' %></td>
|
||||||
<td><%= sale[:sale_date].strftime("#{sale[:sale_date].day.ordinalize} %b") rescue '-' %></td>
|
<td style='text-align:center;'><%=sale.receipt_no.to_s rescue ''%></td>
|
||||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:cash_amount].to_f), :delimiter => ',') %></td>
|
<td style='text-align:center;'><%=Employee.find(sale.cashier_id).name rescue ''%></td>
|
||||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:credit_amount].to_f), :delimiter => ',') %></td>
|
<td style='text-align:center;'><%= number_with_delimiter(sprintf("%.2f",sale.total_amount.to_f), :delimiter => ',') %></td>
|
||||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:credit_payment].to_f), :delimiter => ',') %></td>
|
<td style='text-align:center;'><%= number_with_delimiter(sprintf("%.2f",sale.total_discount.to_f), :delimiter => ',') %></td>
|
||||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:card_amount].to_f), :delimiter => ',') %></td>
|
<td style='text-align:center;'><%= number_with_delimiter(sprintf("%.2f",total_sales.to_f), :delimiter => ',') %></td>
|
||||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:total_discount].to_f), :delimiter => ',') %></td>
|
<% sale.sale_taxes.each do |sale|%>
|
||||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:total_tax].to_f), :delimiter => ',') %></td>
|
<td style='text-align:center;'><%= number_with_delimiter(sprintf("%.2f",sale.tax_payable_amount.to_f), :delimiter => ',') %></td>
|
||||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:other_charges].to_f), :delimiter => ',') %></td>
|
<% end %>
|
||||||
<td style='text-align:right;color: pink;'><%= number_with_delimiter(sprintf("%.2f",sale[:foc_amount].to_f), :delimiter => ',') %></td>
|
|
||||||
<% total_void_amount = 0 %>
|
<td style='text-align:center;'><%= number_with_delimiter(sprintf("%.2f",net_sales.to_f), :delimiter => ',') %></td>
|
||||||
<% if !@daily_void.nil? %>
|
</tr>
|
||||||
<% @daily_void.each do |d_v|%>
|
<% end %>
|
||||||
|
</tbody>
|
||||||
<% if d_v[:daily_void_amt].to_i > 0 %>
|
</table>
|
||||||
<% if d_v[:location_id] == sale[:location_id] %>
|
|
||||||
<% if d_v[:date].utc.getlocal.strftime("%Y-%m-%d").to_s == sale[:sale_date].to_s%>
|
|
||||||
<%count_of_void+=1%>
|
|
||||||
|
|
||||||
<%total_void_amount += d_v[:daily_void_amt].to_f%>
|
|
||||||
<% flag = true %>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<%end %>
|
|
||||||
<% end%>
|
|
||||||
<% end%>
|
|
||||||
<% end%>
|
|
||||||
<% end%>
|
|
||||||
<% if flag == true%>
|
|
||||||
<% void += total_void_amount.to_f %>
|
|
||||||
<td style='color:red;text-align:right;'> <%= number_with_delimiter(sprintf("%.2f",total_void_amount.to_f), :delimiter => ',') %></td>
|
|
||||||
<% flag = false %>
|
|
||||||
<% end%>
|
|
||||||
<%if count_of_void == 0%>
|
|
||||||
<td style='color:red;text-align:right;'> <%= number_with_delimiter(sprintf("%.2f",0.to_f), :delimiter => ',') %></td>
|
|
||||||
<%end %>
|
|
||||||
<td style='text-align:right;'>
|
|
||||||
<%= number_with_delimiter(sprintf("%.2f",((sale[:cash_amount].to_f + sale[:credit_amount].to_f + sale[:card_amount].to_f + sale[:credit_payment].to_f) - sale[:today_credit_payment].to_f) ).to_f, :delimiter => ',') %>
|
|
||||||
</td>
|
|
||||||
|
|
||||||
</tr>
|
|
||||||
|
|
||||||
<%count_of_void= 0%>
|
|
||||||
<% count = count + 1 %>
|
|
||||||
<% end %>
|
|
||||||
|
|
||||||
<tr style="font-weight:600;">
|
|
||||||
<td colspan="2" style='text-align:center;'>Grand Total</td>
|
|
||||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",cash), :delimiter => ',') %></td>
|
|
||||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",credit ), :delimiter => ',') %></td>
|
|
||||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",credit_payment ), :delimiter => ',') %></td>
|
|
||||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",card ), :delimiter => ',') %></td>
|
|
||||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",discount ), :delimiter => ',') %></td>
|
|
||||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",total_tax ), :delimiter => ',') %></td>
|
|
||||||
|
|
||||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",total_other_charges ), :delimiter => ',') %></td>
|
|
||||||
<td style='text-align:right;color: pink;'><%= number_with_delimiter(sprintf("%.2f",foc ), :delimiter => ',') %></td>
|
|
||||||
<td style='color:red;text-align:right;'><%= number_with_delimiter(sprintf("%.2f",void ), :delimiter => ',') %></td>
|
|
||||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f", (cash.to_f + credit.to_f + card.to_f + credit_payment.to_f) - today_credit_payment_amount.to_f ).to_f, :delimiter => ',') %></td>
|
|
||||||
|
|
||||||
</tr>
|
|
||||||
</tbody>
|
|
||||||
<% end %>
|
|
||||||
</table>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1,156 +0,0 @@
|
|||||||
<div class="row">
|
|
||||||
<div class="col-md-12">
|
|
||||||
<%= form_tag report_path, :method => :get, :id=>"frm_report", :class => "form" do %>
|
|
||||||
<% if period_type != false %>
|
|
||||||
<div class="row">
|
|
||||||
<div class="form-group col-md-2">
|
|
||||||
<label>Select Period</label>
|
|
||||||
<select name="period" id="sel_period" class="form-control">
|
|
||||||
<option value="0">Today</option>
|
|
||||||
<option value="1">Yesterday</option>
|
|
||||||
<option value="2">This week</option>
|
|
||||||
<option value="3">Last week</option>
|
|
||||||
<option value="4">Last 7 days</option>
|
|
||||||
<option value="5">This month</option>
|
|
||||||
<option value="6">Last month</option>
|
|
||||||
<option value="7">Last 30 days</option>
|
|
||||||
<option value="8">This year</option>
|
|
||||||
<option value="9">Last year</option>
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
<input type="hidden" name="report_type" value="sale_item" id="sel_sale_type">
|
|
||||||
<!-- <div class="form-group col-md-2">
|
|
||||||
<label>Select Type</label>
|
|
||||||
<select name="sale_type" id="sel_sale_type" class="form-control">
|
|
||||||
<option value="0">All Sale Type</option>
|
|
||||||
<option value="1">Revenue Only</option>
|
|
||||||
<option value="2">Discount Only</option>
|
|
||||||
<option value="3">Void Only</option>
|
|
||||||
<option value="4">Taxes Only</option>
|
|
||||||
<option value="5">Other Amount Only</option>
|
|
||||||
</select>
|
|
||||||
</div> -->
|
|
||||||
<div class="form-group col-md-3">
|
|
||||||
<!-- <label class="">Select Shift Period</label> -->
|
|
||||||
<label class="">From</label>
|
|
||||||
<input data-behaviour='datepicker' class="form-control" name="from" id="from" type="text" placeholder="From date">
|
|
||||||
</div>
|
|
||||||
<div class="form-group col-md-3">
|
|
||||||
<label class="">To</label>
|
|
||||||
<input data-behaviour='datepicker' class="form-control" name="to" id="to" type="text" placeholder="To date">
|
|
||||||
</div>
|
|
||||||
<div class="form-group col-md-2 margin-top-20">
|
|
||||||
<input type="submit" value="Generate Report" class='btn btn-primary'>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<% end %>
|
|
||||||
|
|
||||||
<!-- <div class="row">
|
|
||||||
<% if defined? show_monthly %>
|
|
||||||
<div class="span3" style="margin-bottom:10px;">
|
|
||||||
<input type="hidden" id="report_type" name="report_type" value="0">
|
|
||||||
<div class="btn-group" data-toggle="buttons-radio">
|
|
||||||
<button id="btn_report_type_1" onclick="$('#report_type').val(1)" type="button" class="btn btn-inverse">Monthly</button>
|
|
||||||
<button id="btn_report_type_2" onclick="$('#report_type').val(2)" type="button" class="btn btn-inverse">Yearly</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<% end %>
|
|
||||||
</div> -->
|
|
||||||
|
|
||||||
<div class="row">
|
|
||||||
<div class="form-group">
|
|
||||||
<% if defined? promotions %>
|
|
||||||
<%= select_tag "promotion", options_for_select(@promotions, :selected => params[:promotion_type]), :class => "form-control" %>
|
|
||||||
<% end %>
|
|
||||||
|
|
||||||
<% if defined? menu_types %>
|
|
||||||
<%= select_tag "menu_type", options_for_select(@menu_types, :selected => params[:menu_type]), :class => "form-control" %>
|
|
||||||
<% end %>
|
|
||||||
|
|
||||||
<% if defined? payments %>
|
|
||||||
<%= select_tag "payment_type", options_for_select(@payments, :selected => params[:payment_type]), :class => "form-control" %>
|
|
||||||
<% end %>
|
|
||||||
|
|
||||||
<% if defined? shift_name %>
|
|
||||||
<!-- Temporary no needs
|
|
||||||
<select name="shift_name" id="shift_name"></select>
|
|
||||||
-->
|
|
||||||
<% end %>
|
|
||||||
|
|
||||||
<% if defined? cashiers %>
|
|
||||||
<%= select_tag "cashier", options_from_collection_for_select(@cashiers,"id","name"),:prompt => "All Cashier Stations", :class => "form-control" %>
|
|
||||||
<% end %>
|
|
||||||
|
|
||||||
<% if defined? singer %>
|
|
||||||
<%= select_tag "singer", options_from_collection_for_select(singer,"id","name"),:prompt => "All Vocal List", :class => "form-control" %>
|
|
||||||
<% end %>
|
|
||||||
|
|
||||||
<% if defined? bsm %>
|
|
||||||
<%= select_tag "singer", options_from_collection_for_select(bsm,"id","name"),:prompt => "All BSM List", :class => "form-control" %>
|
|
||||||
<% end %>
|
|
||||||
|
|
||||||
<% if defined? guest_role %>
|
|
||||||
<%= select_tag "guest_role", options_from_collection_for_select(@guest_role,"id","name"),:prompt => "Vocal/BSM List", :class => "form-control" %>
|
|
||||||
<% end %>
|
|
||||||
|
|
||||||
<% if defined? list_by_payment_type %> <!-- for report detail by credit and foc -->
|
|
||||||
<%= select_tag "payment_type_list", options_for_select(@payment_list, :selected => params[:payment_type_list]), :class => "form-control" %>
|
|
||||||
<% end %>
|
|
||||||
|
|
||||||
<% if defined? products %>
|
|
||||||
<%= select_tag "product", options_from_collection_for_select(@products,"id","name"),:prompt => "All Products", :class => "form-control" %>
|
|
||||||
<% end %>
|
|
||||||
|
|
||||||
<% if defined? items %>
|
|
||||||
<%= select_tag "item", options_for_select(@items, :selected => params[:item_type]), :class => "form-control" %>
|
|
||||||
<% end %>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- <div class="row">
|
|
||||||
<div class="col-md-12">
|
|
||||||
<input type="submit" value="Generate Report" class='btn btn-primary'>
|
|
||||||
</div>
|
|
||||||
</div> -->
|
|
||||||
|
|
||||||
<% end %>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!--
|
|
||||||
<div class = "row">
|
|
||||||
|
|
||||||
<div class = "span3">
|
|
||||||
<input type="button" value="Filter by Shift" class='btn' onclick = "select_shift(this)">
|
|
||||||
</div>
|
|
||||||
<div class = "span3">
|
|
||||||
<select name="shift" id="shift">
|
|
||||||
<option value="">All Shift</option>
|
|
||||||
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
<div class = "span3">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
-->
|
|
||||||
|
|
||||||
<script type="text/javascript">
|
|
||||||
$(function(){
|
|
||||||
$('#custom_excel').hide();
|
|
||||||
|
|
||||||
$('#custom_excel').click(function(){
|
|
||||||
var url = $('#custom_excel').attr('data-url');
|
|
||||||
$('#frm_report').attr('action',url)
|
|
||||||
$('#frm_report').submit();
|
|
||||||
// window.location = url;
|
|
||||||
});
|
|
||||||
|
|
||||||
function export_to(path)
|
|
||||||
{
|
|
||||||
var form_params = $("#frm_report").serialize();
|
|
||||||
window.location = path+"?"+ form_params;
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
</script>
|
|
||||||
@@ -1,141 +0,0 @@
|
|||||||
<div class="page-header">
|
|
||||||
<ul class="breadcrumb">
|
|
||||||
<li><a href="<%= dashboard_path %>">Home</a></li>
|
|
||||||
<li>Daily Sale Report</li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="container">
|
|
||||||
<%= render :partial=>'shift_sale_report_filter',
|
|
||||||
:locals=>{ :period_type => true, :shift_name => false, :report_path =>reports_sale_items_path} %>
|
|
||||||
<hr />
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- <div class="container">
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-md-12 text-right">
|
|
||||||
<a href="javascript:export_to('<%=reports_sale_items_path%>.xls')" class = "btn btn-default">Export to Excel</a>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div> -->
|
|
||||||
|
|
||||||
<div class="container margin-top-20">
|
|
||||||
<div class="card row">
|
|
||||||
<div class="table-responsive">
|
|
||||||
<table class="table table-striped">
|
|
||||||
<thead>
|
|
||||||
<tr>
|
|
||||||
<th>Date</th>
|
|
||||||
<th id="date"></th>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<th>Menu Category</th>
|
|
||||||
<th>Code</th>
|
|
||||||
<th>Product</th>
|
|
||||||
<th>Total Item</th>
|
|
||||||
<th>Unit Price</th>
|
|
||||||
<th>Revenue</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<script type="text/javascript">
|
|
||||||
$(function(){
|
|
||||||
|
|
||||||
var cate = [];
|
|
||||||
var y;
|
|
||||||
var count = 0;
|
|
||||||
var sub_total = 0;
|
|
||||||
var sub_total_arr = [];
|
|
||||||
|
|
||||||
<% @sale_data.each do |result| %>
|
|
||||||
|
|
||||||
count = count + 1;
|
|
||||||
if(count == 1)
|
|
||||||
$('#date').append('<%= result.date_name rescue '-'%>');
|
|
||||||
|
|
||||||
y = $.inArray(<%= result.menu_category_id %>, cate);
|
|
||||||
if(y == -1){
|
|
||||||
//add sub total row
|
|
||||||
sub_total_arr.push(sub_total);
|
|
||||||
var total_row = '<tr><td colspan="4"></td>'+
|
|
||||||
'<td > Sub Total</td> ' +
|
|
||||||
'<td><span class="underline">'+ sub_total +'</span></td>'+
|
|
||||||
'</tr>';
|
|
||||||
|
|
||||||
|
|
||||||
if(count != 1){
|
|
||||||
$('.table').append(total_row);
|
|
||||||
sub_total = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
cate.push(<%= result.menu_category_id %>);
|
|
||||||
var th = '<tr><td colspan="6"><%= result.menu_category_name rescue '-'%></td></tr>';
|
|
||||||
var tr = '<tr>'+
|
|
||||||
'<td></td>'+
|
|
||||||
'<td><%= result.code rescue '-'%></td>' +
|
|
||||||
'<td><%= result.product_name rescue '-'%></td>' +
|
|
||||||
'<td><%= result.total_item.to_i rescue '-'%></td>' +
|
|
||||||
'<td><%= number_with_precision(result.unit_price, :precision => 0) rescue '-'%></td>'+
|
|
||||||
'<td><%= number_with_precision(result.grand_total, :precision => 0) rescue '-'%>'+
|
|
||||||
'</td>'+
|
|
||||||
'</tr>';
|
|
||||||
|
|
||||||
|
|
||||||
$('.table').append(th);
|
|
||||||
$('.table').append(tr);
|
|
||||||
|
|
||||||
sub_total = parseInt(sub_total) + parseInt(<%= result.grand_total rescue '-'%>);
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
var tr = '<tr>'+
|
|
||||||
'<td></td>'+
|
|
||||||
'<td><%= result.code rescue '-'%></td>' +
|
|
||||||
'<td><%= result.product_name rescue '-'%></td>' +
|
|
||||||
'<td><%= result.total_item.to_i rescue '-'%></td>' +
|
|
||||||
'<td><%= number_with_precision(result.unit_price, :precision => 0) rescue '-'%></td>'+
|
|
||||||
'<td><%= number_with_precision(result.grand_total, :precision => 0) rescue '-'%></td></tr>';
|
|
||||||
$('.table').append(tr);
|
|
||||||
|
|
||||||
sub_total = parseInt(sub_total) + parseInt(<%= result.grand_total rescue '-'%>);
|
|
||||||
}
|
|
||||||
|
|
||||||
<% end %>
|
|
||||||
|
|
||||||
last_line_subtotal(sub_total);
|
|
||||||
sub_total_arr.push(parseInt(sub_total));
|
|
||||||
grand_total(sub_total_arr);
|
|
||||||
})
|
|
||||||
|
|
||||||
function last_line_subtotal(sub_total){
|
|
||||||
|
|
||||||
var total_row = '<tr><td colspan="4"></td>'+
|
|
||||||
'<td > Sub Total</td> ' +
|
|
||||||
'<td><span class="underline">'+ sub_total +'</span></td>'+
|
|
||||||
'</tr>';
|
|
||||||
|
|
||||||
$('.table').append(total_row);
|
|
||||||
}
|
|
||||||
|
|
||||||
function grand_total(sub_total_arr){
|
|
||||||
|
|
||||||
var total = 0;
|
|
||||||
for(var i=0; i< sub_total_arr.length; i++){
|
|
||||||
//total_1 = (total_1) + (sub_total_arr[i]);
|
|
||||||
total = parseInt(total) + parseInt(sub_total_arr[i]);
|
|
||||||
}
|
|
||||||
var row = '<tr><td colspan="4"></td>'+
|
|
||||||
'<td > Grand Total</td> ' +
|
|
||||||
'<td><span class="double_underline">'+ total +'</span></td>'+
|
|
||||||
'</tr>';
|
|
||||||
$('.table').append(row);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
</script>
|
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user