Merge branch 'august_spring' of bitbucket.org:code2lab/sxrestaurant into august_spring

This commit is contained in:
Nweni
2017-08-17 17:41:01 +06:30
34 changed files with 966 additions and 816 deletions

2
.gitignore vendored
View File

@@ -53,4 +53,4 @@ dump.rdb
public/fonts/*
# Ruby-Mine IDE folder
.idea
/.idea

660
.idea/workspace.xml generated
View File

@@ -2,27 +2,11 @@
<project version="4">
<component name="ChangeListManager">
<list default="true" id="89ca96af-a0e4-4fe4-b9a3-9969f22d7079" name="Default" comment="">
<change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/db/migrate/20170814041543_remove_d_bcols_from_print_settings.rb" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/.gitignore" afterPath="$PROJECT_DIR$/.gitignore" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/.idea/workspace.xml" afterPath="$PROJECT_DIR$/.idea/workspace.xml" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/app/controllers/origami/voucher_controller.rb" afterPath="$PROJECT_DIR$/app/controllers/origami/voucher_controller.rb" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/app/controllers/print_settings_controller.rb" afterPath="$PROJECT_DIR$/app/controllers/print_settings_controller.rb" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/app/controllers/settings/dining_charges_controller.rb" afterPath="$PROJECT_DIR$/app/controllers/settings/dining_charges_controller.rb" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/app/models/ability.rb" afterPath="$PROJECT_DIR$/app/models/ability.rb" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/app/models/dining_charge.rb" afterPath="$PROJECT_DIR$/app/models/dining_charge.rb" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/app/pdf/close_cashier_pdf.rb" afterPath="$PROJECT_DIR$/app/pdf/close_cashier_pdf.rb" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/app/pdf/crm_order_pdf.rb" afterPath="$PROJECT_DIR$/app/pdf/crm_order_pdf.rb" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/app/pdf/order_item_pdf.rb" afterPath="$PROJECT_DIR$/app/pdf/order_item_pdf.rb" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/app/pdf/order_summary_pdf.rb" afterPath="$PROJECT_DIR$/app/pdf/order_summary_pdf.rb" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/app/pdf/queue_no_pdf.rb" afterPath="$PROJECT_DIR$/app/pdf/queue_no_pdf.rb" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/app/pdf/receipt_bill_pdf.rb" afterPath="$PROJECT_DIR$/app/pdf/receipt_bill_pdf.rb" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/app/views/origami/voucher/index.html.erb" afterPath="$PROJECT_DIR$/app/views/origami/voucher/index.html.erb" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/app/views/print_settings/_form.html.erb" afterPath="$PROJECT_DIR$/app/views/print_settings/_form.html.erb" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/app/views/print_settings/index.html.erb" afterPath="$PROJECT_DIR$/app/views/print_settings/index.html.erb" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/app/views/print_settings/show.html.erb" afterPath="$PROJECT_DIR$/app/views/print_settings/show.html.erb" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/app/views/settings/employees/index.html.erb" afterPath="$PROJECT_DIR$/app/views/settings/employees/index.html.erb" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/app/views/settings/employees/show.html.erb" afterPath="$PROJECT_DIR$/app/views/settings/employees/show.html.erb" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/app/views/settings/rooms/_form.html.erb" afterPath="$PROJECT_DIR$/app/views/settings/rooms/_form.html.erb" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/app/views/settings/tables/_form.html.erb" afterPath="$PROJECT_DIR$/app/views/settings/tables/_form.html.erb" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/app/controllers/origami/sale_edit_controller.rb" afterPath="$PROJECT_DIR$/app/controllers/origami/sale_edit_controller.rb" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/app/models/sale.rb" afterPath="$PROJECT_DIR$/app/models/sale.rb" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/app/views/origami/sale_edit/edit.html.erb" afterPath="$PROJECT_DIR$/app/views/origami/sale_edit/edit.html.erb" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/config/routes.rb" afterPath="$PROJECT_DIR$/config/routes.rb" />
</list>
<ignored path="$PROJECT_DIR$/.bundle/" />
@@ -39,45 +23,41 @@
</component>
<component name="FileEditorManager">
<leaf SIDE_TABS_SIZE_LIMIT_KEY="300">
<file leaf-file-name="ability.rb" pinned="false" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/app/models/ability.rb">
<file leaf-file-name="sale_edit_controller.rb" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/app/controllers/origami/sale_edit_controller.rb">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="194">
<caret line="273" column="46" lean-forward="false" selection-start-line="273" selection-start-column="46" selection-end-line="273" selection-end-column="46" />
<state relative-caret-position="372">
<caret line="40" column="60" lean-forward="true" selection-start-line="40" selection-start-column="60" selection-end-line="40" selection-end-column="60" />
<folding />
</state>
</provider>
</entry>
</file>
<file leaf-file-name="dashboard.html.erb" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/app/views/home/dashboard.html.erb">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="-252">
<caret line="178" column="42" lean-forward="false" selection-start-line="178" selection-start-column="42" selection-end-line="178" selection-end-column="42" />
<folding>
<element signature="n#style#0;n#div#1;n#!!top" expanded="true" />
<element signature="n#style#0;n#div#0;n#div#2;n#!!top" expanded="true" />
<element signature="n#style#0;n#div#0;n#div#0;n#div#3;n#!!top" expanded="true" />
</folding>
</state>
</provider>
</entry>
</file>
<file leaf-file-name=".gitignore" pinned="false" current-in-tab="false">
<file leaf-file-name=".gitignore" pinned="false" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/.gitignore">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="247">
<caret line="51" column="8" lean-forward="false" selection-start-line="51" selection-start-column="8" selection-end-line="51" selection-end-column="8" />
<state relative-caret-position="254">
<caret line="51" column="8" lean-forward="true" selection-start-line="51" selection-start-column="8" selection-end-line="51" selection-end-column="8" />
<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/home/show.html.erb">
<file leaf-file-name="sale.rb" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/app/models/sale.rb">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="630">
<caret line="35" column="0" lean-forward="false" selection-start-line="35" selection-start-column="0" selection-end-line="35" selection-end-column="0" />
<state relative-caret-position="321">
<caret line="270" column="45" lean-forward="true" selection-start-line="270" selection-start-column="45" selection-end-line="270" selection-end-column="45" />
<folding />
</state>
</provider>
</entry>
</file>
<file leaf-file-name="edit.html.erb" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/app/views/origami/sale_edit/edit.html.erb">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="213">
<caret line="58" column="112" lean-forward="false" selection-start-line="58" selection-start-column="112" selection-end-line="58" selection-end-column="112" />
<folding />
</state>
</provider>
@@ -86,54 +66,8 @@
<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="3402">
<caret line="190" column="21" lean-forward="false" selection-start-line="190" selection-start-column="21" selection-end-line="190" selection-end-column="21" />
<folding>
<marker date="1502705673000" expanded="true" signature="111:227" ph="##..." />
<marker date="1502705673000" expanded="true" signature="2262:6816" ph="do ... end" />
<marker date="1502705673000" expanded="true" signature="3272:3334" ph="##..." />
<marker date="1502705673000" expanded="true" signature="4204:4354" ph="##..." />
<marker date="1502705673000" expanded="true" signature="4408:4685" ph="##..." />
<marker date="1502705673000" expanded="true" signature="6423:6487" ph="##..." />
<marker date="1502705673000" expanded="true" signature="6888:6937" ph="do ... end" />
<marker date="1502705673000" expanded="true" signature="6897:6931" ph="do ... end" />
<marker date="1502705673000" expanded="true" signature="7016:7548" ph="do ... end" />
<marker date="1502705673000" expanded="true" signature="7614:8021" ph="do ... end" />
<marker date="1502705673000" expanded="true" signature="7999:8015" ph="do ... end" />
<marker date="1502705673000" expanded="true" signature="8088:9418" ph="do ... end" />
<marker date="1502705673000" expanded="true" signature="8162:8266" ph="do ... end" />
<marker date="1502705673000" expanded="true" signature="8338:8463" ph="do ... end" />
<marker date="1502705673000" expanded="true" signature="8347:8388" ph="do ... end" />
<marker date="1502705673000" expanded="true" signature="8498:8545" ph="do ... end" />
<marker date="1502705673000" expanded="true" signature="8576:8623" ph="do ... end" />
<marker date="1502705673000" expanded="true" signature="8884:8930" ph="##..." />
<marker date="1502705673000" expanded="true" signature="8967:9037" ph="do ... end" />
<marker date="1502705673000" expanded="true" signature="9233:9411" ph="do ... end" />
<marker date="1502705673000" expanded="true" signature="9274:9320" ph="do ... end" />
<marker date="1502705673000" expanded="true" signature="9357:9403" ph="do ... end" />
<marker date="1502705673000" expanded="true" signature="9495:9866" ph="do ... end" />
<marker date="1502705673000" expanded="true" signature="9944:10338" ph="do ... end" />
<marker date="1502705673000" expanded="true" signature="10342:10652" ph="##..." />
</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/home/index.html.erb">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="246">
<caret line="71" column="81" lean-forward="false" selection-start-line="71" selection-start-column="74" selection-end-line="71" selection-end-column="81" />
<folding />
</state>
</provider>
</entry>
</file>
<file leaf-file-name="home_controller.rb" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/app/controllers/home_controller.rb">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="180">
<caret line="10" column="40" lean-forward="false" selection-start-line="10" selection-start-column="40" selection-end-line="10" selection-end-column="40" />
<state relative-caret-position="204">
<caret line="83" column="43" lean-forward="false" selection-start-line="83" selection-start-column="43" selection-end-line="83" selection-end-column="43" />
<folding />
</state>
</provider>
@@ -147,6 +81,7 @@
<find>table_invoice</find>
<find>sale_id</find>
<find>oqs</find>
<find>void</find>
</findStrings>
</component>
<component name="Git.Settings">
@@ -155,7 +90,6 @@
<component name="IdeDocumentHistory">
<option name="CHANGED_PATHS">
<list>
<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" />
@@ -167,10 +101,14 @@
<option value="$PROJECT_DIR$/app/views/origami/orders/show.html.erb" />
<option value="$PROJECT_DIR$/app/views/origami/sales/show.html.erb" />
<option value="$PROJECT_DIR$/.idea/workspace.xml" />
<option value="$PROJECT_DIR$/.gitignore" />
<option value="$PROJECT_DIR$/app/views/home/show.html.erb" />
<option value="$PROJECT_DIR$/app/models/ability.rb" />
<option value="$PROJECT_DIR$/app/views/home/dashboard.html.erb" />
<option value="$PROJECT_DIR$/config/routes.rb" />
<option value="$PROJECT_DIR$/app/models/sale.rb" />
<option value="$PROJECT_DIR$/app/views/origami/sale_edit/edit.html.erb" />
<option value="$PROJECT_DIR$/app/controllers/origami/sale_edit_controller.rb" />
<option value="$PROJECT_DIR$/.gitignore" />
</list>
</option>
</component>
@@ -183,8 +121,8 @@
<component name="ProjectFrameBounds">
<option name="x" value="1440" />
<option name="y" value="22" />
<option name="width" value="1918" />
<option name="height" value="717" />
<option name="width" value="1920" />
<option name="height" value="724" />
</component>
<component name="ProjectLevelVcsManager">
<ConfirmationsSetting value="1" id="Add" />
@@ -205,6 +143,21 @@
</navigator>
<panes>
<pane id="RailsProjectView" />
<pane id="Scope">
<subPane subId="Project Files">
<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>
</subPane>
</pane>
<pane id="Scratches" />
<pane id="ProjectPane">
<subPane>
<PATH>
@@ -217,46 +170,6 @@
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
</PATH>
<PATH>
<PATH_ELEMENT>
<option name="myItemId" value="sxrestaurant" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="sxrestaurant" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="app" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="views" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
</PATH>
<PATH>
<PATH_ELEMENT>
<option name="myItemId" value="sxrestaurant" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="sxrestaurant" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="app" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="views" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="home" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
</PATH>
<PATH>
<PATH_ELEMENT>
<option name="myItemId" value="sxrestaurant" />
@@ -303,47 +216,14 @@
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="assets" />
<option name="myItemId" value="controllers" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="stylesheets" />
<option name="myItemId" value="origami" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
</PATH>
<PATH>
<PATH_ELEMENT>
<option name="myItemId" value="sxrestaurant" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="sxrestaurant" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="app" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="assets" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
</PATH>
</subPane>
</pane>
<pane id="Scratches" />
<pane id="Scope">
<subPane subId="Project Files">
<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>
</subPane>
</pane>
</panes>
@@ -676,21 +556,22 @@
<workItem from="1498458295318" duration="2552000" />
<workItem from="1498465879846" duration="18792000" />
<workItem from="1502681128282" duration="12098000" />
<workItem from="1502780405774" duration="2251000" />
</task>
<servers />
</component>
<component name="TimeTrackingManager">
<option name="totallyTimeSpent" value="37859000" />
<option name="totallyTimeSpent" value="40110000" />
</component>
<component name="ToolWindowManager">
<frame x="1440" y="22" width="1918" height="717" extended-state="0" />
<frame x="1440" y="22" width="1920" height="724" extended-state="0" />
<editor active="true" />
<layout>
<window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.17377399" sideWeight="0.5" order="0" side_tool="false" content_ui="combo" />
<window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.17518637" sideWeight="0.5" order="0" side_tool="false" content_ui="combo" />
<window_info id="TODO" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="6" side_tool="false" content_ui="tabs" />
<window_info id="Event Log" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="7" side_tool="true" content_ui="tabs" />
<window_info id="Event Log" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.32978722" sideWeight="0.5" order="7" side_tool="true" content_ui="tabs" />
<window_info id="Database" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
<window_info id="Version Control" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.32718894" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
<window_info id="Version Control" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4924012" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
<window_info id="Structure" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
<window_info id="Terminal" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
<window_info id="Favorites" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="2" side_tool="true" content_ui="tabs" />
@@ -717,279 +598,42 @@
<watches-manager />
</component>
<component name="editorHistoryManager">
<entry file="file://$PROJECT_DIR$/app/views/origami/payments/show.html.erb">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="6462">
<caret line="359" column="43" lean-forward="false" selection-start-line="359" selection-start-column="43" selection-end-line="359" selection-end-column="43" />
</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="504">
<caret line="28" column="36" lean-forward="false" selection-start-line="28" selection-start-column="36" selection-end-line="28" selection-end-column="36" />
</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="2592">
<caret line="144" column="16" lean-forward="false" selection-start-line="144" selection-start-column="16" selection-end-line="144" selection-end-column="16" />
</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="36">
<caret line="2" column="0" lean-forward="false" selection-start-line="2" selection-start-column="0" selection-end-line="2" selection-end-column="0" />
</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="504">
<caret line="28" column="128" lean-forward="false" selection-start-line="28" selection-start-column="128" selection-end-line="28" selection-end-column="128" />
</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="504">
<caret line="28" column="128" lean-forward="false" selection-start-line="28" selection-start-column="128" selection-end-line="28" selection-end-column="128" />
</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="363">
<caret line="145" column="19" lean-forward="false" selection-start-line="145" selection-start-column="19" selection-end-line="145" selection-end-column="19" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/app/controllers/origami/sales_controller.rb">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="285">
<caret line="19" column="36" lean-forward="false" selection-start-line="19" selection-start-column="36" selection-end-line="19" selection-end-column="36" />
</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="3720">
<caret line="248" column="50" lean-forward="true" selection-start-line="248" selection-start-column="50" selection-end-line="248" selection-end-column="50" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/app/controllers/origami/void_controller.rb">
<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" />
</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="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" />
</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="4305">
<caret line="287" column="93" lean-forward="false" selection-start-line="287" selection-start-column="93" selection-end-line="287" selection-end-column="93" />
</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="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" />
</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="2070">
<caret line="138" column="0" lean-forward="true" selection-start-line="138" selection-start-column="0" selection-end-line="138" selection-end-column="0" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/app/controllers/application_controller.rb">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="217">
<caret line="18" column="40" lean-forward="false" selection-start-line="18" selection-start-column="40" selection-end-line="18" selection-end-column="40" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/app/views/origami/customers/index.html.erb">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="-2013">
<caret line="0" column="0" lean-forward="false" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/app/controllers/origami/master_controller.rb">
<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" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/app/models/dining_facility.rb">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="285">
<caret line="19" column="0" lean-forward="true" selection-start-line="19" selection-start-column="0" selection-end-line="19" selection-end-column="0" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/app/controllers/origami/movetable_controller.rb">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="750">
<caret line="50" column="25" lean-forward="false" selection-start-line="50" selection-start-column="25" selection-end-line="50" selection-end-column="25" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/app/controllers/origami/orders_controller.rb">
<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" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/app/views/origami/payments/create.json.jbuilder">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="15">
<caret line="1" column="0" lean-forward="true" selection-start-line="1" selection-start-column="0" selection-end-line="1" selection-end-column="0" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/app/models/printer/receipt_printer.rb">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="327">
<caret line="74" column="38" lean-forward="true" selection-start-line="74" selection-start-column="38" selection-end-line="74" selection-end-column="38" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/app/controllers/origami/request_bills_controller.rb">
<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" />
</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" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/app/models/booking.rb">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="315">
<caret line="21" column="20" lean-forward="false" selection-start-line="21" selection-start-column="20" selection-end-line="21" selection-end-column="20" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/app/controllers/origami/sales_controller.rb">
<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" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/app/controllers/origami/table_invoices_controller.rb">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="255">
<caret line="17" column="7" lean-forward="true" selection-start-line="17" selection-start-column="7" selection-end-line="17" selection-end-column="7" />
</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" />
</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" />
</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" />
</state>
</provider>
</entry>
<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" />
</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="486">
<caret line="29" column="42" lean-forward="false" selection-start-line="29" selection-start-column="42" selection-end-line="29" selection-end-column="42" />
</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="7470">
<caret line="415" column="43" lean-forward="false" selection-start-line="415" selection-start-column="43" selection-end-line="415" selection-end-column="43" />
</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="504">
<caret line="28" column="36" lean-forward="false" selection-start-line="28" selection-start-column="36" selection-end-line="28" selection-end-column="36" />
</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="2592">
<caret line="170" column="16" lean-forward="false" selection-start-line="170" selection-start-column="16" selection-end-line="170" selection-end-column="16" />
</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="36">
<caret line="2" column="0" lean-forward="false" selection-start-line="2" selection-start-column="0" selection-end-line="2" selection-end-column="0" />
</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="504">
<caret line="28" column="128" lean-forward="false" selection-start-line="28" selection-start-column="128" selection-end-line="28" selection-end-column="128" />
</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="504">
<caret line="28" column="128" lean-forward="false" selection-start-line="28" selection-start-column="128" selection-end-line="28" selection-end-column="128" />
</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="399">
<caret line="147" column="19" lean-forward="false" selection-start-line="147" selection-start-column="19" selection-end-line="147" selection-end-column="19" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/app/views/origami/home/show.html.erb" />
<entry file="file://$PROJECT_DIR$/app/views/origami/rooms/show.html.erb" />
<entry file="file://$PROJECT_DIR$/app/views/origami/orders/show.html.erb" />
<entry file="file://$PROJECT_DIR$/app/views/origami/sales/show.html.erb" />
<entry file="file://$PROJECT_DIR$/app/controllers/origami/sales_controller.rb" />
<entry file="file://$PROJECT_DIR$/app/models/sale_payment.rb" />
<entry file="file://$PROJECT_DIR$/app/controllers/origami/void_controller.rb" />
<entry file="file://$PROJECT_DIR$/app/views/origami/home/index.html.erb" />
<entry file="file://$PROJECT_DIR$/app/views/origami/home/show.html.erb" />
<entry file="file://$PROJECT_DIR$/app/views/origami/sales/show.html.erb" />
<entry file="file://$PROJECT_DIR$/app/views/origami/orders/show.html.erb" />
<entry file="file://$PROJECT_DIR$/app/controllers/application_controller.rb" />
<entry file="file://$PROJECT_DIR$/app/views/origami/customers/index.html.erb" />
<entry file="file://$PROJECT_DIR$/app/controllers/origami/master_controller.rb" />
<entry file="file://$PROJECT_DIR$/app/models/dining_facility.rb" />
<entry file="file://$PROJECT_DIR$/app/controllers/origami/movetable_controller.rb" />
<entry file="file://$PROJECT_DIR$/app/controllers/origami/orders_controller.rb" />
<entry file="file://$PROJECT_DIR$/app/views/origami/payments/create.json.jbuilder" />
<entry file="file://$PROJECT_DIR$/app/models/printer/receipt_printer.rb" />
<entry file="file://$PROJECT_DIR$/app/controllers/origami/request_bills_controller.rb" />
<entry file="file://$PROJECT_DIR$/app/controllers/api/bill_controller.rb" />
<entry file="file://$PROJECT_DIR$/app/models/booking.rb" />
<entry file="file://$PROJECT_DIR$/app/controllers/origami/sales_controller.rb" />
<entry file="file://$PROJECT_DIR$/app/controllers/origami/table_invoices_controller.rb" />
<entry file="file://$PROJECT_DIR$/app/controllers/origami/payments_controller.rb" />
<entry file="file://$PROJECT_DIR$/app/models/sale_payment.rb" />
<entry file="file://$PROJECT_DIR$/app/models/sale_audit.rb" />
<entry file="file://$PROJECT_DIR$/app/controllers/origami/void_controller.rb" />
<entry file="file://$PROJECT_DIR$/app/controllers/origami/home_controller.rb" />
<entry file="file://$PROJECT_DIR$/app/views/origami/payments/show.html.erb" />
<entry file="file://$PROJECT_DIR$/app/views/origami/home/index.html.erb" />
<entry file="file://$PROJECT_DIR$/app/views/origami/table_invoices/show.html.erb" />
<entry file="file://$PROJECT_DIR$/app/views/origami/home/show.html.erb" />
<entry file="file://$PROJECT_DIR$/app/views/origami/rooms/show.html.erb" />
<entry file="file://$PROJECT_DIR$/app/views/origami/orders/show.html.erb" />
<entry file="file://$PROJECT_DIR$/app/views/origami/sales/show.html.erb" />
<entry file="file://$PROJECT_DIR$/.idea/workspace.xml">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="265">
@@ -1004,112 +648,50 @@
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/app/controllers/home_controller.rb">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="180">
<caret line="10" column="40" lean-forward="false" selection-start-line="10" selection-start-column="40" selection-end-line="10" selection-end-column="40" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/config/database.yml">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="411">
<caret line="45" column="11" lean-forward="true" selection-start-line="45" selection-start-column="11" selection-end-line="45" selection-end-column="11" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/app/views/home/destroy.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/home/create.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/controllers/home_controller.rb" />
<entry file="file://$PROJECT_DIR$/config/database.yml" />
<entry file="file://$PROJECT_DIR$/app/views/home/destroy.html.erb" />
<entry file="file://$PROJECT_DIR$/app/views/home/create.html.erb" />
<entry file="file://$PROJECT_DIR$/app/views/home/index.html.erb" />
<entry file="file://$PROJECT_DIR$/app/views/home/show.html.erb" />
<entry file="file://$PROJECT_DIR$/app/views/home/dashboard.html.erb" />
<entry file="file://$PROJECT_DIR$/app/models/ability.rb" />
<entry file="file://$PROJECT_DIR$/config/routes.rb">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="3402">
<caret line="190" column="21" lean-forward="false" selection-start-line="190" selection-start-column="21" selection-end-line="190" selection-end-column="21" />
<folding>
<marker date="1502705673000" expanded="true" signature="111:227" ph="##..." />
<marker date="1502705673000" expanded="true" signature="2262:6816" ph="do ... end" />
<marker date="1502705673000" expanded="true" signature="3272:3334" ph="##..." />
<marker date="1502705673000" expanded="true" signature="4204:4354" ph="##..." />
<marker date="1502705673000" expanded="true" signature="4408:4685" ph="##..." />
<marker date="1502705673000" expanded="true" signature="6423:6487" ph="##..." />
<marker date="1502705673000" expanded="true" signature="6888:6937" ph="do ... end" />
<marker date="1502705673000" expanded="true" signature="6897:6931" ph="do ... end" />
<marker date="1502705673000" expanded="true" signature="7016:7548" ph="do ... end" />
<marker date="1502705673000" expanded="true" signature="7614:8021" ph="do ... end" />
<marker date="1502705673000" expanded="true" signature="7999:8015" ph="do ... end" />
<marker date="1502705673000" expanded="true" signature="8088:9418" ph="do ... end" />
<marker date="1502705673000" expanded="true" signature="8162:8266" ph="do ... end" />
<marker date="1502705673000" expanded="true" signature="8338:8463" ph="do ... end" />
<marker date="1502705673000" expanded="true" signature="8347:8388" ph="do ... end" />
<marker date="1502705673000" expanded="true" signature="8498:8545" ph="do ... end" />
<marker date="1502705673000" expanded="true" signature="8576:8623" ph="do ... end" />
<marker date="1502705673000" expanded="true" signature="8884:8930" ph="##..." />
<marker date="1502705673000" expanded="true" signature="8967:9037" ph="do ... end" />
<marker date="1502705673000" expanded="true" signature="9233:9411" ph="do ... end" />
<marker date="1502705673000" expanded="true" signature="9274:9320" ph="do ... end" />
<marker date="1502705673000" expanded="true" signature="9357:9403" ph="do ... end" />
<marker date="1502705673000" expanded="true" signature="9495:9866" ph="do ... end" />
<marker date="1502705673000" expanded="true" signature="9944:10338" ph="do ... end" />
<marker date="1502705673000" expanded="true" signature="10342:10652" ph="##..." />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/app/views/home/index.html.erb">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="246">
<caret line="71" column="81" lean-forward="false" selection-start-line="71" selection-start-column="74" selection-end-line="71" selection-end-column="81" />
<state relative-caret-position="204">
<caret line="83" column="43" lean-forward="false" selection-start-line="83" selection-start-column="43" selection-end-line="83" selection-end-column="43" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/app/views/home/show.html.erb">
<entry file="file://$PROJECT_DIR$/app/models/sale.rb">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="630">
<caret line="35" column="0" lean-forward="false" selection-start-line="35" selection-start-column="0" selection-end-line="35" selection-end-column="0" />
<state relative-caret-position="321">
<caret line="270" column="45" lean-forward="true" selection-start-line="270" selection-start-column="45" selection-end-line="270" selection-end-column="45" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/app/views/home/dashboard.html.erb">
<entry file="file://$PROJECT_DIR$/app/views/origami/sale_edit/edit.html.erb">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="-252">
<caret line="178" column="42" lean-forward="false" selection-start-line="178" selection-start-column="42" selection-end-line="178" selection-end-column="42" />
<folding>
<element signature="n#style#0;n#div#1;n#!!top" expanded="true" />
<element signature="n#style#0;n#div#0;n#div#2;n#!!top" expanded="true" />
<element signature="n#style#0;n#div#0;n#div#0;n#div#3;n#!!top" expanded="true" />
</folding>
<state relative-caret-position="213">
<caret line="58" column="112" lean-forward="false" selection-start-line="58" selection-start-column="112" selection-end-line="58" selection-end-column="112" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/app/controllers/origami/sale_edit_controller.rb">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="372">
<caret line="40" column="60" lean-forward="true" selection-start-line="40" selection-start-column="60" selection-end-line="40" selection-end-column="60" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/.gitignore">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="247">
<caret line="51" column="8" lean-forward="false" selection-start-line="51" selection-start-column="8" selection-end-line="51" selection-end-column="8" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/app/models/ability.rb">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="194">
<caret line="273" column="46" lean-forward="false" selection-start-line="273" selection-start-column="46" selection-end-line="273" selection-end-column="46" />
<state relative-caret-position="254">
<caret line="51" column="8" lean-forward="true" selection-start-line="51" selection-start-column="8" selection-end-line="51" selection-end-column="8" />
<folding />
</state>
</provider>

View File

@@ -1,31 +1,50 @@
class Origami::SaleEditController < BaseOrigamiController
authorize_resource :class => false
# Index for sale item void OR edit
def edit
sale_id = params[:sale_id]
@table_id = params[:table_id]
@saleobj = Sale.find(sale_id)
end
# Index for sale item void OR edit
def edit
sale_id = params[:sale_id]
@table_id = params[:table_id]
@saleobj = Sale.find(sale_id)
end
# create item void. make duplicate old record and update qty and price
def item_void
saleitemId = params[:sale_item_id]
saleitemObj = SaleItem.find(saleitemId)
saleitemObj.remark = 'void'
saleitemObj.save
@newsaleitem = SaleItem.new
@newsaleitem = saleitemObj.dup
@newsaleitem.save
@newsaleitem.qty = saleitemObj.qty * -1
@newsaleitem.price = saleitemObj.price * -1
@newsaleitem.is_taxable = 1
@newsaleitem.product_name = saleitemObj.product_name + " - void"
@newsaleitem.save
# create item void. make duplicate old record and update qty and price
def item_void
saleitemId = params[:sale_item_id]
saleitemObj = SaleItem.find(saleitemId)
saleitemObj.remark = 'void'
saleitemObj.save
@newsaleitem = SaleItem.new
@newsaleitem = saleitemObj.dup
@newsaleitem.save
@newsaleitem.qty = saleitemObj.qty * -1
@newsaleitem.price = saleitemObj.price * -1
@newsaleitem.is_taxable = 1
@newsaleitem.product_name = saleitemObj.product_name + " - void"
@newsaleitem.save
# re-calc tax
saleObj = Sale.find(saleitemObj.sale_id)
saleObj.compute_without_void
end
# re-calc tax
saleObj = Sale.find(saleitemObj.sale_id)
saleObj.compute_without_void
end
def item_foc
saleitemId = params[:sale_item_id]
saleitemObj = SaleItem.find(saleitemId)
saleitemObj.remark = 'foc'
saleitemObj.save
@newsaleitem = SaleItem.new
@newsaleitem = saleitemObj.dup
@newsaleitem.save
@newsaleitem.qty = saleitemObj.qty * -1
@newsaleitem.price = saleitemObj.price * -1
@newsaleitem.is_taxable = 1
@newsaleitem.product_name = saleitemObj.product_name + ' foc'
@newsaleitem.save
# re-calc tax
saleObj = Sale.find(saleitemObj.sale_id)
saleObj.compute_without_void
end
# def item_edit
# saleitemId = params[:sale_item_id]
@@ -48,63 +67,63 @@ class Origami::SaleEditController < BaseOrigamiController
# end
def item_edit
saleitemId = params[:sale_item_id]
update_qty = params[:update_qty]
saleitemId = params[:sale_item_id]
update_qty = params[:update_qty]
update_price = params[:update_price]
saleitemObj = SaleItem.find(saleitemId)
saleitemObj = SaleItem.find(saleitemId)
saleitemObj.qty = update_qty
saleitemObj.price = update_qty.to_f * update_price.to_f
saleitemObj.unit_price = update_price
saleitemObj.qty = update_qty
saleitemObj.price = update_qty.to_f * update_price.to_f
saleitemObj.unit_price = update_price
saleitemObj.taxable_price = update_qty.to_f * update_price.to_f
# saleitemObj.remark = 'edit'
saleitemObj.product_name = saleitemObj.product_name + " - updated"
saleitemObj.product_name = saleitemObj.product_name + " - updated"
saleitemObj.save
# re-calc tax
saleObj = Sale.find(saleitemObj.sale_id)
saleObj.compute_without_void
# re-calc tax
saleObj = Sale.find(saleitemObj.sale_id)
saleObj.compute_without_void
end
# make cancel void item
def item_void_cancel
saleitemId = params[:sale_item_id]
saleitemObj = SaleItem.find(saleitemId)
both = SaleItem.where('product_code=?',saleitemObj.product_code)
both.each do |item|
if item.qty.to_i > 0
item.remark = nil
item.save
end
end
saleitemObj.destroy
# make cancel void item
def item_void_cancel
saleitemId = params[:sale_item_id]
saleitemObj = SaleItem.find(saleitemId)
both = SaleItem.where('product_code=?', saleitemObj.product_code)
both.each do |item|
if item.qty.to_i > 0
item.remark = nil
item.save
end
end
saleitemObj.destroy
# re-calc tax
saleObj = Sale.find(saleitemObj.sale_id)
saleObj.compute_without_void
end
# re-calc tax
saleObj = Sale.find(saleitemObj.sale_id)
saleObj.compute_without_void
end
# remove all void items
def cancel_all_void
sale_id = params[:sale_id]
saleObj = Sale.find(sale_id)
saleObj.sale_items.each do |item|
if item.qty.to_i < 0
item.destroy
else
item.remark = nil
end
item.save
end
# remove all void items
def cancel_all_void
sale_id = params[:sale_id]
saleObj = Sale.find(sale_id)
saleObj.sale_items.each do |item|
if item.qty.to_i < 0
item.destroy
else
item.remark = nil
end
item.save
end
# re-calc tax
saleObj.compute_without_void
end
# re-calc tax
saleObj.compute_without_void
end
def apply_void
sale_id = params[:sale_id]
saleObj = Sale.find(sale_id)
saleObj.compute_without_void
end
def apply_void
sale_id = params[:sale_id]
saleObj = Sale.find(sale_id)
saleObj.compute_without_void
end
end

View File

@@ -97,6 +97,6 @@ class Settings::DiningChargesController < ApplicationController
# Never trust parameters from the scary internet, only allow the white list through.
def dining_charge_params
# params.fetch(:dining_charge, {})
params.require(:dining_charge).permit(:item_code, :unit_price, :taxable, :charge_type,:minimum_free_time ,:charge_block,:time_rounding,:time_rounding_block, :zone_id)
params.require(:dining_charge).permit(:item_code, :unit_price, :taxable, :charge_type,:minimum_free_time ,:charge_block,:time_rounding,:time_rounding_block, :zone_id, :time_rounding_block_price)
end
end

View File

@@ -0,0 +1,76 @@
class Settings::ProductsController < ApplicationController
before_action :set_settings_product, only: [:show, :edit, :update, :destroy]
# GET /settings/products
# GET /settings/products.json
def index
@settings_products = Product.all
end
# GET /settings/products/1
# GET /settings/products/1.json
def show
end
# GET /settings/products/new
def new
@settings_product = Product.new
end
# GET /settings/products/1/edit
def edit
end
# POST /settings/products
# POST /settings/products.json
def create
@settings_product = Product.new(settings_product_params)
@settings_product.created_by = current_user.name
respond_to do |format|
if @settings_product.save
format.html { redirect_to settings_products_path, notice: 'Product was successfully created.' }
format.json { render :show, status: :created, location: @settings_product }
else
format.html { render :new }
format.json { render json: @settings_product.errors, status: :unprocessable_entity }
end
end
end
# PATCH/PUT /settings/products/1
# PATCH/PUT /settings/products/1.json
def update
respond_to do |format|
if @settings_product.update(settings_product_params)
format.html { redirect_to settings_product_path, notice: 'Product was successfully updated.' }
format.json { render :show, status: :ok, location: @settings_product }
else
format.html { render :edit }
format.json { render json: @settings_product.errors, status: :unprocessable_entity }
end
end
end
# DELETE /settings/products/1
# DELETE /settings/products/1.json
def destroy
@settings_product.destroy
respond_to do |format|
format.html { redirect_to settings_products_path, notice: 'Product was successfully destroyed.' }
format.json { head :no_content }
end
end
private
# Use callbacks to share common setup or constraints between actions.
def set_settings_product
@settings_product = Product.find(params[:id])
end
# Never trust parameters from the scary internet, only allow the white list through.
def settings_product_params
params.require(:product).permit(:item_code, :name, :alt_name, :unit_price, :image_path, :description, :information, :taxable,:created_by)
end
end

View File

@@ -0,0 +1,76 @@
class Settings::PromotionsController < ApplicationController
before_action :set_promotion, only: [:show, :edit, :update, :destroy]
# GET /promotions
# GET /promotions.json
def index
@promotions = Promotion.all
end
# GET /promotions/1
# GET /promotions/1.json
def show
end
# GET /promotions/new
def new
@promotion = Promotion.new
@promotion.promo_start_date = DateTime.now
@promotion.promo_end_date = DateTime.now
end
# GET /promotions/1/edit
def edit
end
# POST /promotions
# POST /promotions.json
def create
@promotion = Promotion.new(promotion_params)
@promotion.created_by = current_login_employee.id
respond_to do |format|
if @promotion.save
format.html { redirect_to settings_promotions_path, notice: 'Promotion was successfully created.' }
format.json { render :show, status: :created, location: @promotion }
else
format.html { render :new }
format.json { render json: @promotion.errors, status: :unprocessable_entity }
end
end
end
# PATCH/PUT /promotions/1
# PATCH/PUT /promotions/1.json
def update
respond_to do |format|
if @promotion.update(promotion_params)
format.html { redirect_to settings_promotions_path, notice: 'Promotion was successfully updated.' }
format.json { render :show, status: :ok, location: @promotion }
else
format.html { render :edit }
format.json { render json: @promotion.errors, status: :unprocessable_entity }
end
end
end
# DELETE /promotions/1
# DELETE /promotions/1.json
def destroy
@promotion.destroy
respond_to do |format|
format.html { redirect_to settings_promotions_path, notice: 'Promotion was successfully destroyed.' }
format.json { head :no_content }
end
end
private
# Use callbacks to share common setup or constraints between actions.
def set_promotion
@promotion = Promotion.find(params[:id])
end
# Never trust parameters from the scary internet, only allow the white list through.
def promotion_params
params.require(:promotion).permit(:promo_code, :promo_start_date, :promo_end_date, :promo_start_hour,:promo_end_hour ,:promo_day, :promo_type,:original_product ,:min_qty ,:created_by)
end
end

View File

@@ -0,0 +1,2 @@
module Settings::PromotionsHelper
end

3
app/models/product.rb Normal file
View File

@@ -0,0 +1,3 @@
class Product < ApplicationRecord
validates_presence_of :name
end

2
app/models/promotion.rb Normal file
View File

@@ -0,0 +1,2 @@
class Promotion < ApplicationRecord
end

View File

@@ -267,7 +267,7 @@ class Sale < ApplicationRecord
rounding_adjustment = 0
sales_items.each do |item|
if item.remark != 'void'
if item.remark != 'void' && item.remark != 'foc'
#compute each item and added to total
subtotal_price = subtotal_price + item.price
total_taxable = total_taxable + item.price

View File

@@ -28,6 +28,9 @@
<li><%= link_to "Employees", settings_employees_path, :tabindex =>"-1" %></li>
<hr class="hr_advance" />
<li><%= link_to "Accounts", settings_accounts_path, :tabindex =>"-1" %></li>
<hr class="hr_advance" />
<li><%= link_to "Promotion", settings_promotions_path, :tabindex =>"-1" %></li>]
<li><%= link_to "Products", settings_products_path, :tabindex =>"-1" %></li>
</ul>
</li>

View File

@@ -1,216 +1,235 @@
<div class="row">
<!-- Column Two -->
<!-- Column Two -->
<div class="col-lg-10 col-md-10 col-sm-10">
<div class="card" >
<div class="card-header">
<div><strong id="order-title">INVOICE 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> Receipt No: <span id="receipt_no">
<div class="card">
<div class="card-header">
<div><strong id="order-title">INVOICE 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> Receipt No: <span id="receipt_no">
<%= @saleobj.receipt_no rescue '' %>
</span></p>
</div>
<div class="col-lg-6 col-md-6 col-sm-6 text-right">
<p>Date: <span id="receipt_date"><%= @saleobj.created_at.utc.getlocal.strftime("%d/%m/%Y - %I:%M %p") rescue '-'%></span></p>
</div>
</div>
<div class="card-title row customer_detail hide">
<div class="col-lg-6 col-md-6 col-sm-6">
<p>Customer : <span id="customer_name"></span></p>
</div>
</div>
<div class="col-lg-6 col-md-6 col-sm-6 text-right">
<p>Date:
<span id="receipt_date"><%= @saleobj.created_at.utc.getlocal.strftime("%d/%m/%Y - %I:%M %p") rescue '-' %></span>
</p>
</div>
</div>
<div class="card-title row customer_detail hide">
<div class="col-lg-6 col-md-6 col-sm-6">
<p>Customer : <span id="customer_name"></span></p>
</div>
</div>
<div class="card-text" style="min-height:500px; max-height:500px; overflow-x:scroll">
<table class="table " id="order-items-table">
<thead>
<tr>
<th width="4%">#</th>
<th class="" width="30%">Items</th>
<th style="" width="13%">QTY</td>
<th class="" width="13%">Price</td>
<!-- <th class='' width="17%"> Total </th> -->
<th class='' width="17%"> Action </th>
</tr>
</thead>
<tbody>
<%
count = 0
sub_total = 0
@saleobj.sale_items.each do |sale_item|
count += 1
sub_total = sub_total + sale_item.price
%>
<input type="hidden" id="sale_id" value="<%= @saleobj.sale_id %>">
<%
# Can't check for discount
unless sale_item.price == 0
</div>
<div class="card-text" style="min-height:500px; max-height:500px; overflow-x:scroll">
<table class="table " id="order-items-table">
<thead>
<tr>
<th width="4%">#</th>
<th class="" width="30%">Items</th>
<th style="" width="13%">QTY
</td>
<th class="" width="13%">Price
</td>
<!-- <th class='' width="17%"> Total </th> -->
<th class='' width="17%"> Action</th>
</tr>
</thead>
<tbody>
<%
count = 0
sub_total = 0
@saleobj.sale_items.each do |sale_item|
count += 1
sub_total = sub_total + sale_item.price
%>
<input type="hidden" id="sale_id" value="<%= @saleobj.sale_id %>">
<%
# Can't check for discount
unless sale_item.price == 0
%>
<tr>
<td width="4%"><%= count %></td>
<td class='' width="30%">
<%= sale_item.product_name %>
</td>
<% if sale_item.remark != 'void' && sale_item.remark != 'edit' %>
<td class='' width="13%">
<input id="<%= sale_item.id%>_qty" data-id ="<%= sale_item.id %>" type="text" value="<%= sale_item.qty %>" class="form-control "/>
</td>
<td class='' width="13%">
<input id="<%= sale_item.id%>_price" data-id ="<%= sale_item.id %>" type="text" value="<%= sale_item.unit_price %>" class="form-control"/>
</td>
<!-- <td class='' width="17%">
<input id="<%= sale_item.id%>_price" data-id ="<%= sale_item.id %>" type="text" value="<%= sale_item.price %>" class="form-control"/>
<tr>
<td width="4%"><%= count %></td>
<td class='' width="30%">
<%= sale_item.product_name %>
</td>
<% if sale_item.remark != 'void' && sale_item.remark != 'edit' && sale_item.remark != 'foc' %>
<td class='' width="13%">
<input id="<%= sale_item.id %>_qty" data-id="<%= sale_item.id %>" type="text" value="<%= sale_item.qty %>" class="form-control "/>
</td>
<td class='' width="13%">
<input id="<%= sale_item.id %>_price" data-id="<%= sale_item.id %>" type="text" value="<%= sale_item.unit_price %>" class="form-control"/>
</td>
<!-- <td class='' width="17%">
<input id="<%= sale_item.id %>_price" data-id ="<%= sale_item.id %>" type="text" value="<%= sale_item.price %>" class="form-control"/>
</td> -->
<td class='' width="17%">
<button data-id ="<%= sale_item.id %>" class='btn btn-primary btn-md update'>Update
</button>
<button data-id ="<%= sale_item.id %>" class='btn btn-danger btn-md void'>Void</button>
</td>
<td class='' width="17%">
<button data-id="<%= sale_item.id %>" class='btn btn-primary btn-md update'>Update</button>
<button data-id="<%= sale_item.id %>" class='btn btn-danger btn-md void'>Void</button>
<button data-id="<%= sale_item.id %>" class='btn btn-info btn-md foc'>FOC</button>
</td>
<% elsif sale_item.qty.to_i < 0 || sale_item.remark == 'edit' %>
<td class='' width="13%">
<input data-id ="<%= sale_item.id %>" type="text" value="<%= sale_item.qty %>" class="form-control" disabled/>
</td>
<td class='' width="13%">
<input data-id ="<%= sale_item.id %>" type="text" value="<%= sale_item.unit_price %>" class="form-control" disabled/>
</td>
<!-- <td class='' width="17%">
<% elsif sale_item.qty.to_i < 0 || sale_item.remark == 'edit' %>
<td class='' width="13%">
<input data-id="<%= sale_item.id %>" type="text" value="<%= sale_item.qty %>" class="form-control" disabled/>
</td>
<td class='' width="13%">
<input data-id="<%= sale_item.id %>" type="text" value="<%= sale_item.unit_price %>" class="form-control" disabled/>
</td>
<!-- <td class='' width="17%">
<input data-id ="<%= sale_item.id %>" type="text" value="<%= sale_item.price %>" class="form-control" disabled/>
</td> -->
<td class='' width="17%">
<button data-id ="<%= sale_item.id %>" class='btn btn-primary btn-md cancel'>Cancel Void/Update</button>
</td>
<% else %>
<td class='' width="13%">
<input data-id ="<%= sale_item.id %>" type="text" value="<%= sale_item.qty %>" class="form-control" disabled/>
</td>
<td class='' width="13%">
<input data-id ="<%= sale_item.id %>" type="text" value="<%= sale_item.price %>" class="form-control" disabled/>
</td>
<td></td>
<% end %>
</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 class="rebate_amount"></tr>
</table>
</div>
</div>
</div>
<td class='' width="17%">
<button data-id="<%= sale_item.id %>" class='btn btn-primary btn-md cancel'>Cancel
Void/Update
</button>
</td>
<% else %>
<td class='' width="13%">
<input data-id="<%= sale_item.id %>" type="text" value="<%= sale_item.qty %>" class="form-control" disabled/>
</td>
<td class='' width="13%">
<input data-id="<%= sale_item.id %>" type="text" value="<%= sale_item.price %>" class="form-control" disabled/>
</td>
<td></td>
<% end %>
</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 class="rebate_amount"></tr>
</table>
</div>
</div>
</div>
</div>
<!-- Column Three -->
<div class="col-lg-2 col-md-2 col-sm-2">
<!-- 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='cancel_all_void' >Cancel All Void</button>
<button type="button" class="btn btn-primary btn-block" id='apply' >Apply</button>
</div>
<!-- Column Three -->
<div class="col-lg-2 col-md-2 col-sm-2">
<!-- 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='cancel_all_void'>Cancel All Void</button>
<button type="button" class="btn btn-primary btn-block" id='apply'>Apply</button>
</div>
</div>
<script>
// Bill Request
$(document).ready(function(){
$(".update").on('click',function() {
var sale_item_id = $(this).attr('data-id');
var qty = $('#'+sale_item_id + "_qty").val();
var price = $('#'+ sale_item_id + "_price").val();
console.log(qty + "|" + price)
var ajax_url = "/origami/item_edit";
$.ajax({
type: "POST",
url: ajax_url,
data: 'sale_item_id='+ sale_item_id + "&update_qty="+qty + "&update_price="+ price,
success:function(result){
$.confirm({
title: 'Alert!',
content: 'Qty and Price was successfully Updated',
buttons: {
// Bill Request
$(document).ready(function () {
confirm: {
text: 'Ok',
btnClass: 'btn-green btn-lg',
action: function(){
location.reload();
$(".update").on('click', function () {
var sale_item_id = $(this).attr('data-id');
var qty = $('#' + sale_item_id + "_qty").val();
var price = $('#' + sale_item_id + "_price").val();
console.log(qty + "|" + price)
var ajax_url = "/origami/item_edit";
$.ajax({
type: "POST",
url: ajax_url,
data: 'sale_item_id=' + sale_item_id + "&update_qty=" + qty + "&update_price=" + price,
success: function (result) {
$.confirm({
title: 'Alert!',
content: 'Qty and Price was successfully Updated',
buttons: {
confirm: {
text: 'Ok',
btnClass: 'btn-green btn-lg',
action: function () {
location.reload();
}
}
}
});
}
});
});
$('.void').on('click', function () {
var sale_item_id = $(this).attr('data-id');
var ajax_url = "/origami/item_void";
$.ajax({
type: "POST",
url: ajax_url,
data: 'sale_item_id=' + sale_item_id,
success: function (result) {
location.reload();
}
});
})
$('.foc').on('click', function () {
var sale_item_id = $(this).attr('data-id');
var ajax_url = "/origami/item_foc";
$.ajax({
type: "POST",
url: ajax_url,
data: 'sale_item_id=' + sale_item_id,
success: function (result) {
location.reload();
}
});
})
$('.cancel').on('click', function () {
var sale_item_id = $(this).attr('data-id');
var ajax_url = "/origami/item_void_cancel";
$.ajax({
type: "POST",
url: ajax_url,
data: 'sale_item_id=' + sale_item_id,
success: function (result) {
location.reload();
}
});
})
})
$('#back').on('click', function () {
var table_id = '<%= @table_id %>'
window.location.href = '/origami/table/' + table_id;
})
$('#cancel_all_void').on('click', function () {
var sale_id = "<%= @saleobj.sale_id %>"
var ajax_url = "/origami/cancel_all_void";
$.ajax({
type: "POST",
url: ajax_url,
data: 'sale_id=' + sale_id,
success: function (result) {
location.reload();
}
}
}
});
});
})
}
});
});
$('.void').on('click',function(){
var sale_item_id = $(this).attr('data-id');
var ajax_url = "/origami/item_void";
$.ajax({
type: "POST",
url: ajax_url,
data: 'sale_item_id='+ sale_item_id,
success:function(result){
location.reload();
}
});
})
$('.cancel').on('click',function(){
var sale_item_id = $(this).attr('data-id');
var ajax_url = "/origami/item_void_cancel";
$.ajax({
type: "POST",
url: ajax_url,
data: 'sale_item_id='+ sale_item_id,
success:function(result){
location.reload();
}
});
})
})
$('#back').on('click',function(){
var table_id = '<%= @table_id %>'
window.location.href = '/origami/table/'+ table_id;
})
$('#cancel_all_void').on('click',function(){
var sale_id = "<%= @saleobj.sale_id %>"
var ajax_url = "/origami/cancel_all_void";
$.ajax({
type: "POST",
url: ajax_url,
data: 'sale_id='+ sale_id,
success:function(result){
location.reload();
}
});
})
$('#apply').on('click',function(){
var sale_id = "<%= @saleobj.sale_id %>"
var ajax_url = "/origami/apply_void";
var table_id = '<%= @table_id %>'
$.ajax({
type: "POST",
url: ajax_url,
data: 'sale_id='+ sale_id,
success:function(result){
window.location.href = '/origami/table/'+ table_id ;
}
});
})
$('#apply').on('click', function () {
var sale_id = "<%= @saleobj.sale_id %>"
var ajax_url = "/origami/apply_void";
var table_id = '<%= @table_id %>'
$.ajax({
type: "POST",
url: ajax_url,
data: 'sale_id=' + sale_id,
success: function (result) {
window.location.href = '/origami/table/' + table_id;
}
});
})
</script>

View File

@@ -3,13 +3,14 @@
<div class="form-inputs">
<%= f.input :item_code, :input_html => { :id => 'item_code' } %>
<%= f.input :unit_price %>
<%= f.input :unit_price, :input_html => { :id => 'unit_price'} %>
<%= f.input :taxable %>
<%= f.input :charge_type, :collection => [:hr, :day] %>
<%= f.input :minimum_free_time %>
<%= f.input :charge_block %>
<%= f.input :charge_block, :input_html => { :id => 'charge_block'} %>
<%= f.input :time_rounding %>
<%= f.input :time_rounding_block %>
<%= f.input :time_rounding_block, :input_html => { :id => 'time_rounding_block'} %>
<%= f.input :time_rounding_block_price, :input_html => { :id => 'time_rounding_block_price'} %>
</div>
<div class="form-actions">
@@ -17,3 +18,39 @@
</div>
<% end %>
<script>
function price(){
var unit_price = $("#unit_price").val();
var hour1 = $("select[name='dining_charge[time_rounding_block(4i)]']").val();
var min1 = $("select[name='dining_charge[time_rounding_block(5i)]']").val();
var time1=(parseInt(hour1)*60)+parseInt(min1);
var hour2 = $("select[name='dining_charge[charge_block(4i)]']").val();
var min2 = $("select[name='dining_charge[charge_block(5i)]']").val();
var time2=(parseInt(hour2)*60)+parseInt(min2);
var result=(unit_price*time1)/time2;
$("#time_rounding_block_price").val(result);
// return result;
}
$( "#unit_price" ).change(function() {
price();
});
$( "select[name='dining_charge[time_rounding_block(4i)]']" ).change(function() {
price();
});
$( "select[name='dining_charge[time_rounding_block(5i)]']" ).change(function() {
price();
});
$( "select[name='dining_charge[charge_block(4i)]']" ).change(function() {
price();
});
$( "select[name='dining_charge[charge_block(5i)]']" ).change(function() {
price();
});
</script>

View File

@@ -16,8 +16,9 @@
</div>
<%= render 'form', dining_charge: @dining_charge %>
</div>
<script>
function randomNumber(len) {
function randomNumber(len) {
var randomNumber;
var n = '';
@@ -27,6 +28,5 @@ function randomNumber(len) {
}
return n;
}
document.getElementById("item_code").value = "<%= @zone.id %>"+"<%= @settings_dining_facility.id %>"+"_"+randomNumber(5);
document.getElementById("item_code").value = "<%= @zone.id %>"+"<%= @settings_dining_facility.id %>"+"_"+randomNumber(5);
</script>

View File

@@ -0,0 +1,18 @@
<%= simple_form_for([:settings,@settings_product]) do |f| %>
<%= f.error_notification %>
<div class="form-inputs">
<%= f.input :item_code, :input_html => { :id => 'item_code' } %>
<%= f.input :name %>
<%= f.input :alt_name %>
<%= f.input :unit_price %>
<%= f.input :image_path %>
<%= f.input :description %>
<%= f.input :information %>
<label><%= f.check_box :taxable %>Taxable</label>
</div>
<div class="form-actions">
<%= f.button :submit %>
</div>
<% end %>

View File

@@ -0,0 +1,2 @@
json.extract! settings_product, :id, :created_at, :updated_at
json.url settings_product_url(settings_product, format: :json)

View File

@@ -0,0 +1,10 @@
<div class="span12">
<div class="page-header">
<ul class="breadcrumb">
<li><a href="<%= root_path %>">Home</a></li>
<li><a href="<%= settings_products_path %>">Products</a></li>
<li>Edit</li>
</ul>
</div>
<%= render 'form', settings_product: @settings_product %>
</div>

View File

@@ -0,0 +1,45 @@
<div class="page-header">
<ul class="breadcrumb">
<li><a href="<%= %>">Home</a></li>
<li>Product</li>
<span style="float: right">
<%= link_to t('.new', :default => t("helpers.links.new")),new_settings_product_path,:class => 'btn btn-primary btn-sm' %>
</span>
</ul>
</div>
<br>
<div class="card">
<table class="table table-striped">
<thead>
<tr>
<th>Item Code</th>
<th>Name</th>
<th>Alt Name</th>
<th>Unit Price</th>
<!-- <th style="width:20%">image_path</th> -->
<th>Description</th>
<th>Information</th>
<th>Taxable</th>
<th colspan="3"></th>
</tr>
</thead>
<tbody>
<% @settings_products.each do |settings_product| %>
<tr>
<td><%= settings_product.item_code %></td>
<td><%= settings_product.name %></td>
<td><%= settings_product.alt_name %></td>
<td><%= settings_product.unit_price %></td>
<td><%= settings_product.description %></td>
<td><%= settings_product.information %></td>
<td><%= settings_product.taxable %></td>
<td><%= link_to 'Show', settings_product_path(settings_product) %></td>
<td><%= link_to 'Edit', edit_settings_product_path(settings_product) %></td>
<td><%= link_to 'Destroy', settings_product_path(settings_product), method: :delete, data: { confirm: 'Are you sure?' } %></td>
</tr>
<% end %>
</tbody>
</table>
</div>

View File

@@ -0,0 +1 @@
json.array! @settings_products, partial: 'settings_products/settings_product', as: :settings_product

View File

@@ -0,0 +1,26 @@
<div class="span12">
<div class="page-header">
<ul class="breadcrumb">
<li><a href="<%= root_path %>">Home</a></li>
<li><a href="<%= settings_products_path %>">Products</a></li>
<li>New</li>
</ul>
</div>
<%= render 'form', settings_product: @settings_product %>
</div>
<script>
function randomNumber(len) {
var sValidCharacters = "01234ABCDEFGHIJabcdefghijk56789lmnKLMNOPQRSTUVWXYZopqrstuvwxyz";
var sCharCode = "";
for (i = 1; i <= len; i++) {
sCharCode = sCharCode + sValidCharacters.charAt(parseInt(Math.random() * sValidCharacters.length));
if ((i === 4) || (i === 8)) {
sCharCode = sCharCode + "-";
}
}
return sCharCode;
}
document.getElementById("item_code").value = randomNumber(12);
</script>

View File

@@ -0,0 +1,33 @@
<div class="page-header">
<ul class="breadcrumb">
<li><a href="<%= root_path %>">Home</a></li>
<li><a href="<%= settings_products_path %>">Products</a></li>
<span style="float: right">
</span>
</ul>
</div>
<div class="card">
<div class="card-block">
<h4 class="card-title">Product</h4>
<table class="table">
<tbody>
<tr><td style="width:20%">Item code</td><td><%= @settings_product.item_code %></td></tr>
<tr><td style="width:20%">Name</td><td><%= @settings_product.name %></td></tr>
<tr><td style="width:20%">Alt name</td><td><%= @settings_product.alt_name %></td></tr>
<tr><td style="width:20%">Unit price</td><td><%= @settings_product.unit_price %></td></tr>
<tr><td style="width:20%">Image path</td><td><%= image_tag @settings_product.image_path, :size => '200x200'%></td></tr>
<tr><td style="width:20%">Description</td><td><%= @settings_product.description %></td></tr>
<tr><td style="width:20%">Information</td><td><%= @settings_product.information %></td></tr>
<tr><td style="width:20%">Taxable</td><td><%= @settings_product.taxable %></td></tr>
<tr><td style="width:20%"><%= link_to 'Edit', edit_settings_product_path(@settings_product) %></td><td><%= link_to 'Destroy', settings_product_path(@settings_product), method: :delete, data: { confirm: 'Are you sure?' } %></td></tr>
</tbody>
</table>
</div>
</div>
</div>

View File

@@ -0,0 +1 @@
json.partial! "settings_products/settings_product", settings_product: @settings_product

View File

@@ -0,0 +1,48 @@
<%= simple_form_for([:settings,@promotion]) do |f| %>
<%= f.error_notification %>
<div class="form-inputs">
<div class="div-border">
<div class="row">
<div class="col-md-6"><%= f.input :promo_code %></div>
<div class="col-md-6"></div>
</div>
<div class="row">
<div class="col-md-6">
<span>Promo Start Date</span>
<%= f.date_field :promo_start_date, :placeholder => "From Date" , :class => "form-control"%>
<br>
</div>
<div class="col-md-6">
<span>Promo End Date</span>
<%= f.date_field :promo_end_date ,:placeholder => "To Date" , :class => "form-control"%>
</div>
</div>
<div class="row">
<div class="col-md-6">
<%= f.input :promo_start_hour %>
<!-- <span>Promo Start Hour</span>
<%= text_field_tag :promo_start_hour , nil, :placeholder => "From Time", :id => "fromtime", :class => 'form-control' %> -->
</div>
<div class="col-md-6"><%= f.input :promo_end_hour %></div>
</div>
<div class="row">
<div class="col-md-12"><%= f.input :promo_day %></div>
</div>
<div class="row">
<div class="col-md-6">
<%= f.input :promo_type,input_html: { class: "" },
collection: %w{Quantity Net_off Net_price Percentage},:class => 'form-control' ,:label => "" %>
</div>
</div>
<div class="row">
<div class="col-md-6"><%= f.input :original_product,collection: MenuItem.order("name desc"),input_html: { selected: 2 } %></div>
<div class="col-md-6"><%= f.input :min_qty %></div>
</div>
</div>
</div>
<div class="form-actions">
<%= f.button :submit %>
</div>
<% end %>

View File

@@ -0,0 +1,2 @@
json.extract! promotion, :id, :created_at, :updated_at
json.url promotion_url(promotion, format: :json)

View File

@@ -0,0 +1,10 @@
<div class="span12">
<div class="page-header">
<ul class="breadcrumb">
<li><a href="<%= root_path %>">Home</a></li>
<li><a href="<%= settings_promotions_path %>">Promotions</a></li>
<li>Edit</li>
</ul>
</div>
<%= render 'form', promotion: @promotion %>
</div>

View File

@@ -0,0 +1,58 @@
<p id="notice"><%= notice %></p>
<div class="page-header">
<ul class="breadcrumb">
<li><a href="<%= root_path %>">Home</a></li>
<li>Promotions</li>
<span style="float: right">
<%= link_to t('.new', :default => t("helpers.links.new")),new_settings_promotion_path,:class => 'btn btn-primary btn-sm' %>
</span>
</ul>
</div>
<br>
<div class="card">
<table class="table table-striped">
<thead>
<tr>
<th>Promotion Code</th>
<th>Start Date</th>
<th>End Date</th>
<th>Start Time</th>
<th>End Time</th>
<th>Promotion Day</th>
<th>Original Product</th>
<th>Created By</th>
<th>Created At</th>
<th colspan="2"></th>
</tr>
</thead>
<tbody>
<% @promotions.each do |pro| %>
<tr>
<td><%= link_to pro.promo_code, settings_promotion_path(pro) %></td>
<td><%= pro.promo_start_date %></td>
<td><%= pro.promo_end_date %></td>
<td><%= pro.promo_start_hour.strftime("%I:%M %P") rescue "-" %></td>
<td><%= pro.promo_end_hour.strftime("%I:%M %P") rescue "-" %></td>
<td><%= pro.promo_day %></td>
<td>
<% if MenuItem.exists?(pro.original_product) %>
<%= MenuItem.find(pro.original_product).name %>
<% end %>
</td>
<% if Employee.exists?(pro.created_by) %>
<td><%= Employee.find(pro.created_by).name %></td>
<% else %>
<td><%= pro.created_by %></td>
<% end %>
<td><%= pro.created_at.utc.getlocal.strftime("%Y-%m-%d/%I:%M %p") %></td>
<td><%= link_to 'Edit', edit_settings_promotion_path(pro) %></td>
<td><%= link_to 'Destroy', settings_promotion_path(pro), method: :delete, data: { confirm: 'Are you sure?' } %></td>
</tr>
<% end %>
</tbody>
</table>
</div>

View File

@@ -0,0 +1 @@
json.array! @promotions, partial: 'promotions/promotion', as: :promotion

View File

@@ -0,0 +1,17 @@
<div class="span12">
<div class="page-header">
<ul class="breadcrumb">
<li><a href="<%= root_path %>">Home</a></li>
<li><a href="<%= settings_promotions_path %>">Promotions</a></li>
<li>New</li>
</ul>
</div>
<%= render 'form', promotion: @promotion %>
</div>
<script>
$("#promotion_promo_code").val(Math.random().toString(36).slice(5) + Math.random().toString(36).slice(5));
// $( "#fromtime" ).timepicker();
// $( "#totime" ).timepicker({ 'scrollDefault': 'now' });
$('#scrollDefaultExample').timepicker({ 'scrollDefault': 'now' });
</script>

View File

@@ -0,0 +1,4 @@
<p id="notice"><%= notice %></p>
<%= link_to 'Edit', edit_promotion_path(@promotion) %> |
<%= link_to 'Back', promotions_path %>

View File

@@ -0,0 +1 @@
json.partial! "promotions/promotion", promotion: @promotion

View File

@@ -80,6 +80,7 @@ Rails.application.routes.draw do
post 'moving' => "movetable#moving"
get "/table/:table_id/sale/:sale_id/edit" => "sale_edit#edit"
post 'item_void' => "sale_edit#item_void"
post 'item_foc' => "sale_edit#item_foc"
post 'item_edit' => "sale_edit#item_edit"
post 'item_void_cancel' => "sale_edit#item_void_cancel"
post 'cancel_all_void' => 'sale_edit#cancel_all_void'
@@ -236,6 +237,8 @@ Rails.application.routes.draw do
resources :menu_item_options
#tax_profiles
resources :tax_profiles
#products
resources :products
#lookups
resources :lookups
#cashier_terminals
@@ -264,6 +267,9 @@ Rails.application.routes.draw do
end
end
#promotion
resources :promotions
end
#--------- Transactions Sections ------------#

View File

@@ -0,0 +1,18 @@
class CreatePromotion < ActiveRecord::Migration[5.1]
def change
create_table :promotions do |t|
t.string :promo_code, :limit => 16
t.date :promo_start_date, :null => false
t.date :promo_end_date, :null => false
t.time :promo_start_hour, :null => false
t.time :promo_end_hour, :null => false
t.string :promo_day, :null => false, :default => "[0,1,2,3,4,5,6]"
t.string :promo_type, :null => false, :default => "Quantity"
t.string :original_product
t.integer :min_qty
t.string :created_by, :null => false
t.timestamps
end
end
end

View File

@@ -0,0 +1,13 @@
class CreatePromotionProduct < ActiveRecord::Migration[5.1]
def change
create_table :promotion_products do |t|
t.references :promotion, foreign_key: true
t.string :item_code, :null => false
t.integer :min_qty
t.integer :net_off
t.integer :net_price
t.integer :percentage
t.timestamps
end
end
end

View File

@@ -0,0 +1,17 @@
class SettingsProducts < ActiveRecord::Migration[5.1]
def change
create_table :products do |t|
t.string :item_code, :limit => 16
t.string :name, :null => false
t.string :alt_name
t.integer :unit_price
t.string :image_path
t.string :description
t.string :information
t.boolean :taxable
t.string :created_by, :null => false
t.timestamps
end
end
end