diff --git a/.idea/.generators b/.idea/.generators new file mode 100644 index 00000000..16189766 --- /dev/null +++ b/.idea/.generators @@ -0,0 +1,8 @@ + + diff --git a/.idea/.rakeTasks b/.idea/.rakeTasks new file mode 100644 index 00000000..3577d8ad --- /dev/null +++ b/.idea/.rakeTasks @@ -0,0 +1,7 @@ + + diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 00000000..157739d4 --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 00000000..21ecc838 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/sxrestaurant.iml b/.idea/sxrestaurant.iml new file mode 100644 index 00000000..586fd380 --- /dev/null +++ b/.idea/sxrestaurant.iml @@ -0,0 +1,236 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 00000000..94a25f7f --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/.idea/workspace.xml b/.idea/workspace.xml new file mode 100644 index 00000000..34b4f3b1 --- /dev/null +++ b/.idea/workspace.xml @@ -0,0 +1,1262 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + origami + table_invoice + sale_id + + + + + + + + + + + true + DEFINITION_ORDER + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + project + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 1498458293643 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Gemfile b/Gemfile index 99489d5b..227cfa72 100644 --- a/Gemfile +++ b/Gemfile @@ -66,6 +66,8 @@ gem 'kaminari', '~> 1.0.1' # Datatable gem 'filterrific' +gem 'cancancan', '~> 1.10' + # Use Capistrano for deployment # gem 'capistrano-rails', group: :development diff --git a/Gemfile.lock b/Gemfile.lock index e6f683f6..7e27774a 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -39,7 +39,7 @@ GEM minitest (~> 5.1) tzinfo (~> 1.1) arel (8.0.0) - autoprefixer-rails (7.1.1) + autoprefixer-rails (7.1.1.2) execjs bcrypt (3.1.11) bindex (0.5.0) @@ -50,6 +50,7 @@ GEM railties (>= 3.0) builder (3.2.3) byebug (9.0.6) + cancancan (1.17.0) coffee-rails (4.2.2) coffee-script (>= 2.2.0) railties (>= 4.0.0) @@ -159,8 +160,8 @@ GEM thor (>= 0.18.1, < 2.0) rake (12.0.0) rb-fsevent (0.9.8) - rb-inotify (0.9.8) - ffi (>= 0.5.0) + rb-inotify (0.9.10) + ffi (>= 0.5.0, < 2) redis (3.3.3) rspec-core (3.6.0) rspec-support (~> 3.6.0) @@ -191,7 +192,7 @@ GEM activesupport (>= 3.2.1) shoulda-matchers (3.1.1) activesupport (>= 4.0.0) - sidekiq (5.0.2) + sidekiq (5.0.3) concurrent-ruby (~> 1.0) connection_pool (~> 2.2, >= 2.2.0) rack-protection (>= 1.5.0) @@ -245,6 +246,7 @@ DEPENDENCIES bootstrap (~> 4.0.0.alpha3) bootstrap-datepicker-rails byebug + cancancan (~> 1.10) coffee-rails (~> 4.2) cups (~> 0.0.7) database_cleaner diff --git a/app/assets/images/profile-1.png b/app/assets/images/profile-1.png new file mode 100644 index 00000000..bc020542 Binary files /dev/null and b/app/assets/images/profile-1.png differ diff --git a/app/assets/images/profile-2.png b/app/assets/images/profile-2.png new file mode 100644 index 00000000..b56112e2 Binary files /dev/null and b/app/assets/images/profile-2.png differ diff --git a/app/assets/images/profile-3.png b/app/assets/images/profile-3.png new file mode 100644 index 00000000..f2f65cc6 Binary files /dev/null and b/app/assets/images/profile-3.png differ diff --git a/app/assets/javascripts/OQS.js b/app/assets/javascripts/OQS.js index e7b85110..ce21f509 100644 --- a/app/assets/javascripts/OQS.js +++ b/app/assets/javascripts/OQS.js @@ -26,7 +26,7 @@ $(document).ready(function(){ $('.queue_station').on('click',function(){ var orderZone=$(this).children().children().children('.order-zone').text().trim(); // var orderItem=$(this).children().children().children('.order-item').text(); - //var assigned_item_id = $(this).children().find(".assigned-order-item").text(); + var assigned_item_id = $(this).children().find(".assigned-order-item").text(); var orderQty = $(this).children().children().children('.order-qty').text(); var orderBy = $(this).children().children().children().children('.order-by').text(); var orderAt = $(this).children().children().children().children('.order-at').text(); @@ -67,6 +67,12 @@ $(document).ready(function(){ $(this).addClass('selected-item'); }); + $(".order-item-edit").on('click', function(){ + var _self = $(this); // To know in ajax return + var assigned_item_id=$(this).attr('id').substr(5); + window.location.href = '/oqs/'+ assigned_item_id + "/edit" + }); + // complete for queue item $('.order-complete').on('click',function(e){ //e.preventDefault(); @@ -111,8 +117,9 @@ $(document).ready(function(){ // Print Order Item $('#print_order_item').on('click',function(){ - var assigned_item_id=$('.selected-item').children('.card-block').children('.assigned-order-item').text(); - var params = { 'id':assigned_item_id }; + var assigned_item_id = $('.selected-item').children('.card-block').children('.assigned-order-item').text(); + var options = $('.selected-item').children('.card-block').find('.item-options').text(); + var params = { 'options':options }; $.ajax({ type: 'GET', url: '/oqs/print/print/'+assigned_item_id, @@ -122,12 +129,31 @@ $(document).ready(function(){ // Print Order Summary $('#print_order_summary').on('click',function(){ + var table_name=$('.selected-item').children().children().children('.order-zone').text().trim(); var assigned_item_id=$('.selected-item').children('.card-block').children('.assigned-order-item').text(); - var params = { 'id':assigned_item_id }; + var params = { 'table_name':table_name }; $.ajax({ type: 'GET', url: '/oqs/print/print_order_summary/'+assigned_item_id, + data: params, success: function(data){ } }); }); + + // Qty update for OQS Edit Controller + $('#qty-update').on('click', function(){ + var qty_weight = $("input[name='qty_weight']").val(); + var remarks = $("textarea[name='remarks']").val(); + var order_items_id = $(this).attr('data-id'); + var params = { 'order_items_id': order_items_id, 'qty_weight': qty_weight, 'remarks': remarks } + $.ajax({ + type: 'POST', + url: '/oqs/' + order_items_id, + data: params, + success: function(result){ + alert("Updated!"); + window.location.href = '/oqs'; + } + }); + }); }); diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.js index 202d4387..63c871d9 100644 --- a/app/assets/javascripts/application.js +++ b/app/assets/javascripts/application.js @@ -25,6 +25,12 @@ $(document).on("focus", "[data-behaviour~='datepicker']", function(e){ $('.dropdown-toggle').dropdown(); }); +function export_to(path) +{ + var form_params = $("#frm_report").serialize(); + window.location = path+"?"+ form_params; +} + /* * ToDo Move to here from pages * diff --git a/app/assets/javascripts/cash_mgmt.coffee b/app/assets/javascripts/cash_mgmt.coffee new file mode 100644 index 00000000..24f83d18 --- /dev/null +++ b/app/assets/javascripts/cash_mgmt.coffee @@ -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/ diff --git a/app/assets/javascripts/jquery-confirm.js b/app/assets/javascripts/jquery-confirm.js new file mode 100644 index 00000000..43d8889b --- /dev/null +++ b/app/assets/javascripts/jquery-confirm.js @@ -0,0 +1,10 @@ +/*! + * jquery-confirm v3.2.3 (http://craftpip.github.io/jquery-confirm/) + * Author: Boniface Pereira + * Website: www.craftpip.com + * Contact: hey@craftpip.com + * + * Copyright 2013-2017 jquery-confirm + * Licensed under MIT (https://github.com/craftpip/jquery-confirm/blob/master/LICENSE) + */ +if(typeof jQuery==="undefined"){throw new Error("jquery-confirm requires jQuery");}var jconfirm,Jconfirm;(function($,window){$.fn.confirm=function(options,option2){if(typeof options==="undefined"){options={};}if(typeof options==="string"){options={content:options,title:(option2)?option2:false};}$(this).each(function(){var $this=$(this);$this.on("click",function(e){e.preventDefault();var jcOption=$.extend({},options);if($this.attr("data-title")){jcOption.title=$this.attr("data-title");}if($this.attr("data-content")){jcOption.content=$this.attr("data-content");}if(typeof jcOption.buttons=="undefined"){jcOption.buttons={};}jcOption["$target"]=$this;if($this.attr("href")&&Object.keys(jcOption.buttons).length==0){var buttons=$.extend(true,{},jconfirm.pluginDefaults.defaultButtons,(jconfirm.defaults||{}).defaultButtons||{});var firstBtn=Object.keys(buttons)[0];jcOption.buttons=buttons;jcOption.buttons[firstBtn].action=function(){location.href=$this.attr("href");};}jcOption.closeIcon=false;$.confirm(jcOption);});});return $(this);};$.confirm=function(options,option2){if(typeof options==="undefined"){options={};}if(typeof options==="string"){options={content:options,title:(option2)?option2:false};}if(typeof options.buttons!="object"){options.buttons={};}if(Object.keys(options.buttons).length==0){var buttons=$.extend(true,{},jconfirm.pluginDefaults.defaultButtons,(jconfirm.defaults||{}).defaultButtons||{});options.buttons=buttons;}return jconfirm(options);};$.alert=function(options,option2){if(typeof options==="undefined"){options={};}if(typeof options==="string"){options={content:options,title:(option2)?option2:false};}if(typeof options.buttons!="object"){options.buttons={};}if(Object.keys(options.buttons).length==0){var buttons=$.extend(true,{},jconfirm.pluginDefaults.defaultButtons,(jconfirm.defaults||{}).defaultButtons||{});var firstBtn=Object.keys(buttons)[0];options.buttons[firstBtn]=buttons[firstBtn];}return jconfirm(options);};$.dialog=function(options,option2){if(typeof options==="undefined"){options={};}if(typeof options==="string"){options={content:options,title:(option2)?option2:false,closeIcon:function(){}};}options.buttons={};if(typeof options.closeIcon=="undefined"){options.closeIcon=function(){};}options.confirmKeys=[13];return jconfirm(options);};jconfirm=function(options){if(typeof options==="undefined"){options={};}var pluginOptions=$.extend(true,{},jconfirm.pluginDefaults);if(jconfirm.defaults){pluginOptions=$.extend(true,pluginOptions,jconfirm.defaults);}pluginOptions=$.extend(true,{},pluginOptions,options);var instance=new Jconfirm(pluginOptions);jconfirm.instances.push(instance);return instance;};Jconfirm=function(options){$.extend(this,options);this._init();};Jconfirm.prototype={_init:function(){var that=this;if(!jconfirm.instances.length){jconfirm.lastFocused=$("body").find(":focus");}this._id=Math.round(Math.random()*99999);if(!this.lazyOpen){setTimeout(function(){that.open();},0);}},_buildHTML:function(){var that=this;this._parseAnimation(this.animation,"o");this._parseAnimation(this.closeAnimation,"c");this._parseBgDismissAnimation(this.backgroundDismissAnimation);this._parseColumnClass(this.columnClass);this._parseTheme(this.theme);this._parseType(this.type);var template=$(this.template);template.find(".jconfirm-box").addClass(this.animationParsed).addClass(this.backgroundDismissAnimationParsed).addClass(this.typeParsed);if(this.typeAnimated){template.find(".jconfirm-box").addClass("jconfirm-type-animated");}if(this.useBootstrap){template.find(".jc-bs3-row").addClass(this.bootstrapClasses.row);template.find(".jc-bs3-row").addClass("justify-content-md-center justify-content-sm-center justify-content-xs-center justify-content-lg-center");template.find(".jconfirm-box-container").addClass(this.columnClassParsed);if(this.containerFluid){template.find(".jc-bs3-container").addClass(this.bootstrapClasses.containerFluid);}else{template.find(".jc-bs3-container").addClass(this.bootstrapClasses.container);}}else{template.find(".jconfirm-box").css("width",this.boxWidth);}if(this.titleClass){template.find(".jconfirm-title-c").addClass(this.titleClass);}template.addClass(this.themeParsed);var ariaLabel="jconfirm-box"+this._id;template.find(".jconfirm-box").attr("aria-labelledby",ariaLabel).attr("tabindex",-1);template.find(".jconfirm-content").attr("id",ariaLabel);if(this.bgOpacity!=null){template.find(".jconfirm-bg").css("opacity",this.bgOpacity);}if(this.rtl){template.addClass("jconfirm-rtl");}this.$el=template.appendTo(this.container);this.$jconfirmBoxContainer=this.$el.find(".jconfirm-box-container");this.$jconfirmBox=this.$body=this.$el.find(".jconfirm-box");this.$jconfirmBg=this.$el.find(".jconfirm-bg");this.$title=this.$el.find(".jconfirm-title");this.$titleContainer=this.$el.find(".jconfirm-title-c");this.$content=this.$el.find("div.jconfirm-content");this.$contentPane=this.$el.find(".jconfirm-content-pane");this.$icon=this.$el.find(".jconfirm-icon-c");this.$closeIcon=this.$el.find(".jconfirm-closeIcon");this.$btnc=this.$el.find(".jconfirm-buttons");this.$scrollPane=this.$el.find(".jconfirm-scrollpane");this._contentReady=$.Deferred();this._modalReady=$.Deferred();this.setTitle();this.setIcon();this._setButtons();this._parseContent();this.initDraggable();if(this.isAjax){this.showLoading(false);}$.when(this._contentReady,this._modalReady).then(function(){if(that.isAjaxLoading){setTimeout(function(){that.isAjaxLoading=false;that.setContent();that.setTitle();that.setIcon();setTimeout(function(){that.hideLoading(false);},100);if(typeof that.onContentReady=="function"){that.onContentReady();}},50);}else{that.setContent();that.setTitle();that.setIcon();if(typeof that.onContentReady=="function"){that.onContentReady();}}if(that.autoClose){that._startCountDown();}});that._contentHash=this._hash(that.$content.html());that._contentHeight=this.$content.height();this._watchContent();this.setDialogCenter();if(this.animation=="none"){this.animationSpeed=1;this.animationBounce=1;}this.$body.css(this._getCSS(this.animationSpeed,this.animationBounce));this.$contentPane.css(this._getCSS(this.animationSpeed,1));this.$jconfirmBg.css(this._getCSS(this.animationSpeed,1));},_typePrefix:"jconfirm-type-",typeParsed:"",_parseType:function(type){this.typeParsed=this._typePrefix+type;},setType:function(type){var oldClass=this.typeParsed;this._parseType(type);this.$jconfirmBox.removeClass(oldClass).addClass(this.typeParsed);},themeParsed:"",_themePrefix:"jconfirm-",setTheme:function(theme){var previous=this.theme;this.theme=theme||this.theme;this._parseTheme(this.theme);if(previous){this.$el.removeClass(previous);}this.$el.addClass(this.themeParsed);this.theme=theme;},_parseTheme:function(theme){var that=this;theme=theme.split(",");$.each(theme,function(k,a){if(a.indexOf(that._themePrefix)==-1){theme[k]=that._themePrefix+$.trim(a);}});this.themeParsed=theme.join(" ").toLowerCase();},backgroundDismissAnimationParsed:"",_bgDismissPrefix:"jconfirm-hilight-",_parseBgDismissAnimation:function(bgDismissAnimation){var animation=bgDismissAnimation.split(",");var that=this;$.each(animation,function(k,a){if(a.indexOf(that._bgDismissPrefix)==-1){animation[k]=that._bgDismissPrefix+$.trim(a);}});this.backgroundDismissAnimationParsed=animation.join(" ").toLowerCase();},animationParsed:"",closeAnimationParsed:"",_animationPrefix:"jconfirm-animation-",setAnimation:function(animation){this.animation=animation||this.animation;this._parseAnimation(this.animation,"o");},_parseAnimation:function(animation,which){which=which||"o";var animations=animation.split(",");var that=this;$.each(animations,function(k,a){if(a.indexOf(that._animationPrefix)==-1){animations[k]=that._animationPrefix+$.trim(a);}});var a_string=animations.join(" ").toLowerCase();if(which=="o"){this.animationParsed=a_string;}else{this.closeAnimationParsed=a_string;}return a_string;},setCloseAnimation:function(closeAnimation){this.closeAnimation=closeAnimation||this.closeAnimation;this._parseAnimation(this.closeAnimation,"c");},setAnimationSpeed:function(speed){this.animationSpeed=speed||this.animationSpeed;},columnClassParsed:"",setColumnClass:function(colClass){if(!this.useBootstrap){console.warn("cannot set columnClass, useBootstrap is set to false");return;}this.columnClass=colClass||this.columnClass;this._parseColumnClass(this.columnClass);this.$jconfirmBoxContainer.addClass(this.columnClassParsed);},setBoxWidth:function(){if(this.useBootstrap){console.warn("cannot set boxWidth, useBootstrap is set to true");return;}this.$jconfirmBox.css("width",this.boxWidth);},_parseColumnClass:function(colClass){colClass=colClass.toLowerCase();var p;switch(colClass){case"xl":case"xlarge":p="col-md-12";break;case"l":case"large":p="col-md-8 col-md-offset-2";break;case"m":case"medium":p="col-md-6 col-md-offset-3";break;case"s":case"small":p="col-md-4 col-md-offset-4";break;case"xs":case"xsmall":p="col-md-2 col-md-offset-5";break;default:p=colClass;}this.columnClassParsed=p;},initDraggable:function(){var that=this;var $t=this.$titleContainer;this.resetDrag();if(this.draggable){$t.addClass("jconfirm-hand");$t.on("mousedown",function(e){that.mouseX=e.clientX;that.mouseY=e.clientY;that.isDrag=true;});$(window).on("mousemove."+this._id,function(e){if(that.isDrag){that.movingX=e.clientX-that.mouseX+that.initialX;that.movingY=e.clientY-that.mouseY+that.initialY;that.setDrag();}});$(window).on("mouseup."+this._id,function(){if(that.isDrag){that.isDrag=false;that.initialX=that.movingX;that.initialY=that.movingY;}});}},resetDrag:function(){this.isDrag=false;this.initialX=0;this.initialY=0;this.movingX=0;this.movingY=0;this.movingXCurrent=0;this.movingYCurrent=0;this.mouseX=0;this.mouseY=0;this.$jconfirmBoxContainer.css("transform","translate("+0+"px, "+0+"px)");},setDrag:function(){if(!this.draggable){return;}this.alignMiddle=false;this._boxWidth=this.$jconfirmBox.outerWidth();var ww=$(window).width();var that=this;if(that.movingX%2==0||that.movingY%2==0){var tb=that._boxTopMargin-that.dragWindowGap;if(tb+that.movingY<0){that.movingY=-tb;}else{that.movingYCurrent=that.movingY;}var lb=(ww/2)-that._boxWidth/2;var rb=(ww/2)+(that._boxWidth/2)-that._boxWidth;rb-=that.dragWindowGap;lb-=that.dragWindowGap;if(lb+that.movingX<0){that.movingX=-lb;}else{if(rb-that.movingX<0){that.movingX=rb;}else{that.movingXCurrent=that.movingX;}}that.$jconfirmBoxContainer.css("transform","translate("+that.movingX+"px, "+that.movingY+"px)");}},_hash:function(a){var string=a.toString();var h=0;if(string.length==0){return h;}for(var i=0;i').html(that.buttons[key].text).addClass(that.buttons[key].btnClass).prop("disabled",that.buttons[key].isDisabled).css("display",that.buttons[key].isHidden?"none":"").click(function(e){e.preventDefault();var res=that.buttons[key].action.apply(that);that.onAction(key);that._stopCountDown();if(typeof res==="undefined"||res){that.close();}});that.buttons[key].el=button_element;that.buttons[key].setText=function(text){button_element.html(text);};that.buttons[key].addClass=function(className){button_element.addClass(className);};that.buttons[key].removeClass=function(className){button_element.removeClass(className);};that.buttons[key].disable=function(){that.buttons[key].isDisabled=true;button_element.prop("disabled",true);};that.buttons[key].enable=function(){that.buttons[key].isDisabled=false;button_element.prop("disabled",false);};that.buttons[key].show=function(){that.buttons[key].isHidden=false;button_element.css("display","");that.setDialogCenter();};that.buttons[key].hide=function(){that.buttons[key].isHidden=true;button_element.css("display","none");that.setDialogCenter();};that["$_"+key]=that["$$"+key]=button_element;that.$btnc.append(button_element);});if(total_buttons===0){this.$btnc.hide();}if(this.closeIcon===null&&total_buttons===0){this.closeIcon=true;}if(this.closeIcon){if(this.closeIconClass){var closeHtml='';this.$closeIcon.html(closeHtml);}this.$closeIcon.click(function(e){e.preventDefault();var buttonName=false;var shouldClose=false;var str;if(typeof that.closeIcon=="function"){str=that.closeIcon();}else{str=that.closeIcon;}if(typeof str=="string"&&typeof that.buttons[str]!="undefined"){buttonName=str;shouldClose=false;}else{if(typeof str=="undefined"||!!(str)==true){shouldClose=true;}else{shouldClose=false;}}if(buttonName){var btnResponse=that.buttons[buttonName].action.apply(that);shouldClose=(typeof btnResponse=="undefined")||!!(btnResponse);}if(shouldClose){that.close();}});this.$closeIcon.show();}else{this.$closeIcon.hide();}},setTitle:function(string,force){force=force||false;if(typeof string!=="undefined"){if(typeof string=="string"){this.title=string;}else{if(typeof string=="function"){if(typeof string.promise=="function"){console.error("Promise was returned from title function, this is not supported.");}var response=string();if(typeof response=="string"){this.title=response;}else{this.title=false;}}else{this.title=false;}}}if(this.isAjaxLoading&&!force){return;}this.$title.html(this.title||"");},setIcon:function(iconClass,force){force=force||false;if(typeof iconClass!=="undefined"){if(typeof iconClass=="string"){this.icon=iconClass;}else{if(typeof iconClass==="function"){var response=iconClass();if(typeof response=="string"){this.icon=response;}else{this.icon=false;}}else{this.icon=false;}}}if(this.isAjaxLoading&&!force){return;}this.$icon.html(this.icon?'':"");},setContentPrepend:function(string,force){this.contentParsed=string+this.contentParsed;if(this.isAjaxLoading&&!force){return;}this.$content.prepend(string);},setContentAppend:function(string,force){this.contentParsed=this.contentParsed+string;if(this.isAjaxLoading&&!force){return;}this.$content.append(string);},setContent:function(string,force){force=force||false;var that=this;this.contentParsed=(typeof string=="undefined")?this.contentParsed:string;if(this.isAjaxLoading&&!force){return;}this.$content.html(this.contentParsed);this.setDialogCenter();setTimeout(function(){that.$body.find("input[autofocus]:visible:first").focus();},100);},loadingSpinner:false,showLoading:function(disableButtons){this.loadingSpinner=true;this.$jconfirmBox.addClass("loading");if(disableButtons){this.$btnc.find("button").prop("disabled",true);}this.setDialogCenter();},hideLoading:function(enableButtons){this.loadingSpinner=false;this.$jconfirmBox.removeClass("loading");if(enableButtons){this.$btnc.find("button").prop("disabled",false);}this.setDialogCenter();},ajaxResponse:false,contentParsed:"",isAjax:false,isAjaxLoading:false,_parseContent:function(){var that=this;var e=" ";if(typeof this.content=="function"){var res=this.content.apply(this);if(typeof res=="string"){this.content=res;}else{if(typeof res=="object"&&typeof res.always=="function"){this.isAjax=true;this.isAjaxLoading=true;res.always(function(data,status,xhr){that.ajaxResponse={data:data,status:status,xhr:xhr};that._contentReady.resolve(data,status,xhr);if(typeof that.contentLoaded=="function"){that.contentLoaded(data,status,xhr);}});this.content=e;}else{this.content=e;}}}if(typeof this.content=="string"&&this.content.substr(0,4).toLowerCase()==="url:"){this.isAjax=true;this.isAjaxLoading=true;var u=this.content.substring(4,this.content.length);$.get(u).done(function(html){that.contentParsed=html;}).always(function(data,status,xhr){that.ajaxResponse={data:data,status:status,xhr:xhr};that._contentReady.resolve(data,status,xhr);if(typeof that.contentLoaded=="function"){that.contentLoaded(data,status,xhr);}});}if(!this.content){this.content=e;}if(!this.isAjax){this.contentParsed=this.content;this.setContent(this.contentParsed);that._contentReady.resolve();}},_stopCountDown:function(){clearInterval(this.autoCloseInterval);if(this.$cd){this.$cd.remove();}},_startCountDown:function(){var that=this;var opt=this.autoClose.split("|");if(opt.length!==2){console.error("Invalid option for autoClose. example 'close|10000'");return false;}var button_key=opt[0];var time=parseInt(opt[1]);if(typeof this.buttons[button_key]==="undefined"){console.error("Invalid button key '"+button_key+"' for autoClose");return false;}var seconds=Math.ceil(time/1000);this.$cd=$(' ('+seconds+")").appendTo(this["$_"+button_key]);this.autoCloseInterval=setInterval(function(){that.$cd.html(" ("+(seconds-=1)+") ");if(seconds<=0){that["$$"+button_key].trigger("click");that._stopCountDown();}},1000);},_getKey:function(key){switch(key){case 192:return"tilde";case 13:return"enter";case 16:return"shift";case 9:return"tab";case 20:return"capslock";case 17:return"ctrl";case 91:return"win";case 18:return"alt";case 27:return"esc";case 32:return"space";}var initial=String.fromCharCode(key);if(/^[A-z0-9]+$/.test(initial)){return initial.toLowerCase();}else{return false;}},reactOnKey:function(e){var that=this;var a=$(".jconfirm");if(a.eq(a.length-1)[0]!==this.$el[0]){return false;}var key=e.which;if(this.$content.find(":input").is(":focus")&&/13|32/.test(key)){return false;}var keyChar=this._getKey(key);if(keyChar==="esc"&&this.escapeKey){if(this.escapeKey===true){this.$scrollPane.trigger("click");}else{if(typeof this.escapeKey==="string"||typeof this.escapeKey==="function"){var buttonKey;if(typeof this.escapeKey==="function"){buttonKey=this.escapeKey();}else{buttonKey=this.escapeKey;}if(buttonKey){if(typeof this.buttons[buttonKey]==="undefined"){console.warn("Invalid escapeKey, no buttons found with key "+buttonKey);}else{this["$_"+buttonKey].trigger("click");}}}}}$.each(this.buttons,function(key,button){if(button.keys.indexOf(keyChar)!=-1){that["$_"+key].trigger("click");}});},_boxTopMargin:0,_boxBottomMargin:0,_boxWidth:0,setDialogCenter:function(){var contentHeight;var paneHeight;var style;contentHeight=0;paneHeight=0;if(this.$contentPane.css("display")!="none"){contentHeight=this.$content.outerHeight()||0;paneHeight=this.$contentPane.height()||0;}var children=this.$content.children();if(children.length!=0){var marginTopChild=parseInt(children.eq(0).css("margin-top"));if(marginTopChild){contentHeight+=marginTopChild;}}if(paneHeight==0){paneHeight=contentHeight;}var windowHeight=$(window).height();var boxHeight;boxHeight=(this.$body.outerHeight()-paneHeight)+contentHeight;var topMargin=(windowHeight-boxHeight)/2;if(boxHeight>(windowHeight-(this.offsetTop+this.offsetBottom))||!this.alignMiddle){style={"margin-top":this.offsetTop,"margin-bottom":this.offsetBottom};this._boxTopMargin=this.offsetTop;this._boxBottomMargin=this.offsetBottom;$("body").addClass("jconfirm-no-scroll-"+this._id);}else{style={"margin-top":topMargin,"margin-bottom":this.offsetBottom};this._boxTopMargin=topMargin;this._boxBottomMargin=this.offsetBottom;$("body").removeClass("jconfirm-no-scroll-"+this._id);}this.$contentPane.css({height:contentHeight}).scrollTop(0);this.$body.css(style);this.setDrag();},_unwatchContent:function(){clearInterval(this._timer);},close:function(){var that=this;if(typeof this.onClose==="function"){this.onClose();}this._unwatchContent();clearInterval(this.imageLoadInterval);$(window).unbind("resize."+this._id);$(window).unbind("keyup."+this._id);$(window).unbind("jcKeyDown."+this._id);if(this.draggable){$(window).unbind("mousemove."+this._id);$(window).unbind("mouseup."+this._id);this.$titleContainer.unbind("mousedown");}$("body").removeClass("jconfirm-no-scroll-"+this._id);this.$body.addClass(this.closeAnimationParsed);this.$jconfirmBg.addClass("jconfirm-bg-h");var closeTimer=(this.closeAnimation=="none")?1:this.animationSpeed;that.$el.removeClass(that.loadedClass);setTimeout(function(){that.$el.remove();var l=jconfirm.instances;var i=jconfirm.instances.length-1;for(i;i>=0;i--){if(jconfirm.instances[i]._id==that._id){jconfirm.instances.splice(i,1);}}if(!jconfirm.instances.length){if(that.scrollToPreviousElement&&jconfirm.lastFocused&&jconfirm.lastFocused.length&&$.contains(document,jconfirm.lastFocused[0])){var $lf=jconfirm.lastFocused;if(that.scrollToPreviousElementAnimate){var st=$(window).scrollTop();var ot=jconfirm.lastFocused.offset().top;var wh=$(window).height();if(!(ot>st&&ot<(st+wh))){var scrollTo=(ot-Math.round((wh/3)));$("html, body").animate({scrollTop:scrollTo},that.animationSpeed,"swing",function(){$lf.focus();});}else{$lf.focus();}}else{$lf.focus();}jconfirm.lastFocused=false;}}if(typeof that.onDestroy=="function"){that.onDestroy();}},closeTimer*0.4);return true;},open:function(){if(this.isOpen()){return false;}this._buildHTML();this._bindEvents();this._open();return true;},_open:function(){var that=this;if(typeof that.onOpenBefore=="function"){that.onOpenBefore();}this.$body.removeClass(this.animationParsed);this.$jconfirmBg.removeClass("jconfirm-bg-h");this.$body.focus();setTimeout(function(){that.$body.css(that._getCSS(that.animationSpeed,1));that.$body.css({"transition-property":that.$body.css("transition-property")+", margin"});that._modalReady.resolve();if(typeof that.onOpen==="function"){that.onOpen();}that.$el.addClass(that.loadedClass);},this.animationSpeed);},loadedClass:"jconfirm-open",isClosed:function(){return !this.$el||this.$el.css("display")==="";},isOpen:function(){return !this.isClosed();},toggle:function(){if(!this.isOpen()){this.open();}else{this.close();}}};jconfirm.instances=[];jconfirm.lastFocused=false;jconfirm.pluginDefaults={template:'
',title:"Hello",titleClass:"",type:"default",typeAnimated:true,draggable:false,alignMiddle:true,content:"Are you sure to continue?",buttons:{},defaultButtons:{ok:{action:function(){}},close:{action:function(){}}},contentLoaded:function(){},icon:"",lazyOpen:false,bgOpacity:null,theme:"light",animation:"zoom",closeAnimation:"scale",animationSpeed:400,animationBounce:1.2,escapeKey:true,rtl:false,container:"body",containerFluid:false,backgroundDismiss:false,backgroundDismissAnimation:"shake",autoClose:false,closeIcon:null,closeIconClass:false,watchInterval:100,columnClass:"col-md-4 col-md-offset-4 col-sm-6 col-sm-offset-3 col-xs-10 col-xs-offset-1",boxWidth:"50%",scrollToPreviousElement:true,scrollToPreviousElementAnimate:true,useBootstrap:true,offsetTop:50,offsetBottom:50,dragWindowGap:15,bootstrapClasses:{container:"container",containerFluid:"container-fluid",row:"row"},onContentReady:function(){},onOpenBefore:function(){},onOpen:function(){},onClose:function(){},onDestroy:function(){},onAction:function(){}};var keyDown=false;$(window).on("keydown",function(e){if(!keyDown){var $target=$(e.target);var pass=false;if($target.closest(".jconfirm-box").length){pass=true;}if(pass){$(window).trigger("jcKeyDown");}keyDown=true;}});$(window).on("keyup",function(e){keyDown=false;});})(jQuery,window); \ No newline at end of file diff --git a/app/assets/javascripts/origami.js b/app/assets/javascripts/origami.js index 78a21c3b..0886d04e 100644 --- a/app/assets/javascripts/origami.js +++ b/app/assets/javascripts/origami.js @@ -1,15 +1,3 @@ -// This is a manifest file that'll be compiled into application.js, which will include all the files -// listed below. -// -// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts, -// or any plugin's vendor/assets/javascripts directory can be referenced here using a relative path. -// -// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the -// compiled file. JavaScript code in this file should be added after the last require_* statement. -// -// Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details -// about supported directives. -// //= require jquery //= require tether //= require bootstrap @@ -55,7 +43,7 @@ $(document).ready(function(){ var cashier=""; var receipt_date=""; - var sub_total=0; + var sub_total=0.0; var discount_amount=0; var tax_amount=0; var grand_total_amount=0; @@ -69,11 +57,11 @@ $(document).ready(function(){ type: "POST", url: "/origami/" + unique_id, data: { 'booking_id' : unique_id }, - success:function(result){ + success:function(result){ for (i = 0; i < result.length; i++) { var data = JSON.stringify(result[i]); var parse_data = JSON.parse(data); - var show_date = ""; + var show_date = ""; // Receipt Header receipt_no = result[i].receipt_no; @@ -81,36 +69,37 @@ $(document).ready(function(){ if(result[i].receipt_date != null){ receipt_date = new Date(result[i].receipt_date); show_date = receipt_date.getDate() + "-" + receipt_date.getMonth() + "-" + receipt_date.getFullYear() + ' ' + receipt_date.getHours()+ ':' + receipt_date.getMinutes() - } - - $("#receipt_no").text(receipt_no); - $("#cashier").text(cashier == null ? "" : cashier); - $("#receipt_date").text(show_date); - + } //Receipt Charges - sub_total += (parse_data.qty*parse_data.price); + sub_total += parseFloat(parse_data.price); discount_amount = parse_data.discount_amount == null? '0.0' : parse_data.discount_amount; tax_amount = parse_data.tax_amount; - grand_total_amount = parse_data.grand_total_amount; - - $("#order-sub-total").text(sub_total); - // $("#order-food").text(''); - // $("#order-beverage").text(''); - $("#order-discount").text(discount_amount); - $("#order-Tax").text(tax_amount); - $("#order-grand-total").text(grand_total_amount); + grand_total_amount = parse_data.grand_total_amount; // Ordered Items var order_items_rows = "" + "" + parse_data.item_name + "" + "" + parse_data.qty + "" + - "" + parse_data.qty*parse_data.price + "" + + "" + parse_data.price + "" + ""; $("#order-items-table").children("tbody").append(order_items_rows); } + + // Cashier Info + $("#receipt_no").text(receipt_no); + $("#cashier").text(cashier == null ? "" : cashier); + $("#receipt_date").text(show_date); + + // Payment Info + $("#order-sub-total").text(sub_total); + // $("#order-food").text(''); + // $("#order-beverage").text(''); + $("#order-discount").text(discount_amount); + $("#order-Tax").text(tax_amount); + $("#order-grand-total").text(grand_total_amount); } }); // End AJAX Call @@ -303,49 +292,9 @@ $(document).ready(function(){ $(this).addClass('selected-item'); }); + // $(".orders").on('click', function(){ + // var dining_id = $(this).attr("data-id"); + // window.location.href = '/origami/' + dining_id; + // }) + }); - -/* Button Control by Status */ -function control_button(order_status){ - if(order_status=="billed"){ - $("#customer").prop('disabled', false); - $("#request_bills").prop('disabled', true); - $("#discount").prop('disabled', false); - $("#pay-bill").prop('disabled', false); - $("#re-print").prop('disabled', true); - } - else if(order_status=="new") { - $("#customer").prop('disabled', false); - $("#request_bills").prop('disabled', false); - $("#discount").prop('disabled', true); - $("#pay-bill").prop('disabled', true); - $("#re-print").prop('disabled', true); - }else if(order_status=="completed"){ - $("#re-print").prop('disabled', false); - } - else { - $("#customer").prop('disabled', true); - $("#request_bills").prop('disabled', true); - $("#discount").prop('disabled', true); - $("#pay-bill").prop('disabled', true); - $("#re-print").prop('disabled', true); - } - -} - -/* For Receipt - Update Balance */ -function update_balance(){ - var discount_type = $('#discount-type').val(); - var discount_amount = $('#discount-amount').val(); - var sub_total = $('#order-sub-total').text(); - var tax = $('#order-Tax').text(); - - // For Percentage Discount - if(discount_type == 1){ - discount_amount=(sub_total*discount_amount)/100; - } - - var total = (parseFloat(sub_total) + parseFloat(tax)) - discount_amount; - $('#order-discount').text(discount_amount); - $('#order-grand-total').text(total); -} diff --git a/app/assets/javascripts/origami/shifts.coffee b/app/assets/javascripts/origami/shifts.coffee new file mode 100644 index 00000000..24f83d18 --- /dev/null +++ b/app/assets/javascripts/origami/shifts.coffee @@ -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/ diff --git a/app/assets/javascripts/origami_bk.js b/app/assets/javascripts/origami_bk.js new file mode 100644 index 00000000..d4071432 --- /dev/null +++ b/app/assets/javascripts/origami_bk.js @@ -0,0 +1,352 @@ +// This is a manifest file that'll be compiled into application.js, which will include all the files +// listed below. +// +// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts, +// or any plugin's vendor/assets/javascripts directory can be referenced here using a relative path. +// +// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the +// compiled file. JavaScript code in this file should be added after the last require_* statement. +// +// Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details +// about supported directives. +// +//= require jquery +//= require tether +//= require bootstrap +//= require jquery_ujs +//= require turbolinks +//= require cable +//= require jquery-ui +//= require bootstrap-datepicker + +$(document).ready(function(){ + // auto refresh every 60 seconds + // setTimeout(function(){ + // window.location.reload(1); + // }, 60000); + + // For selected order return + var order_status = ""; + order_status = $(".selected-item").children().find(".orders-order-status").text().substr(0,6).trim(); + + // Enable/Disable Button + control_button(order_status); + + $(".orders").on('click', function(){ + $("#order-sub-total").text(''); + // $("#order-food").text(''); + // $("#order-beverage").text(''); + $("#order-discount").text(''); + $("#order-Tax").text(''); + $("#order-grand-total").text(''); + + var zone_name=$(this).find(".orders-table").text(); + var receipt_no=$(this).find(".orders-receipt-no").text(); + var unique_id = $(this).find(".orders-id").text(); + var order_status=$(this).find(".orders-order-status").text().trim(); + + // Enable/Disable Button + control_button(order_status); + + var customer_id=$(this).find(".customer-id").text(); + show_customer_details(customer_id); + + $("#re-print").val(unique_id); + + var cashier=""; + var receipt_date=""; + var sub_total=0.0; + var discount_amount=0; + var tax_amount=0; + var grand_total_amount=0; + + $("#order-title").text("ORDER DETAILS - " + zone_name); + // clear order items + $("#order-items-table").children("tbody").empty(); + + // AJAX call for order + $.ajax({ + type: "POST", + url: "/origami/" + unique_id, + data: { 'booking_id' : unique_id }, + success:function(result){ + for (i = 0; i < result.length; i++) { + var data = JSON.stringify(result[i]); + var parse_data = JSON.parse(data); + var show_date = ""; + + // Receipt Header + receipt_no = result[i].receipt_no; + cashier = result[i].cashier_name; + if(result[i].receipt_date != null){ + receipt_date = new Date(result[i].receipt_date); + show_date = receipt_date.getDate() + "-" + receipt_date.getMonth() + "-" + receipt_date.getFullYear() + ' ' + receipt_date.getHours()+ ':' + receipt_date.getMinutes() + } + + //Receipt Charges + sub_total += parseFloat(parse_data.price); + + discount_amount = parse_data.discount_amount == null? '0.0' : parse_data.discount_amount; + tax_amount = parse_data.tax_amount; + grand_total_amount = parse_data.grand_total_amount; + + // Ordered Items + var order_items_rows = "" + + "" + parse_data.item_name + "" + + "" + parse_data.qty + "" + + "" + parse_data.price + "" + + ""; + + $("#order-items-table").children("tbody").append(order_items_rows); + } + + // Cashier Info + $("#receipt_no").text(receipt_no); + $("#cashier").text(cashier == null ? "" : cashier); + $("#receipt_date").text(show_date); + + // Payment Info + $("#order-sub-total").text(sub_total); + // $("#order-food").text(''); + // $("#order-beverage").text(''); + $("#order-discount").text(discount_amount); + $("#order-Tax").text(tax_amount); + $("#order-grand-total").text(grand_total_amount); + } + }); + // End AJAX Call + + $('.orders').removeClass('selected-item'); + $(this).addClass('selected-item'); + }); + + // Bill Request + $('#request_bills').click(function() { + var order_id=$(".selected-item").find(".orders-id").text().substr(0,16); + if(order_id!=""){ + window.location.href = '/origami/' + order_id + '/request_bills' + } + else { + alert("Please select an order!"); + } + return false; + }); + + // Discount for Payment + $('#discount').click(function() { + var order_id=$(".selected-item").find(".orders-id").text().substr(0,16); + + if(order_id!=""){ + window.location.href = '/origami/' + order_id + '/discount' + } + else { + alert("Please select an order!"); + } + + return false; + }); + + // Pay Discount for Payment + $("#pay-discount").on('click', function(e){ + e.preventDefault(); + var sale_id = $('#sale-id').text(); + var sale_item_id = $('.selected-item').attr('id').substr(0,16); + var sub_total = $('#order-sub-total').text(); + var grand_total = $('#order-grand-total').text(); + var discount_type = $('#discount-type').val(); + var discount_value = $('#discount-amount').val(); + var discount_amount = discount_value; + var ajax_url = "/origami/" + sale_id + "/discount"; + + if(sale_item_id != null){ + ajax_url = "/origami/" + sale_item_id + "/discount"; + sub_total = $("#"+sale_item_id).children().find("#item-total-price").text(); + } + + // For Percentage Discount + if(discount_type == 1){ + discount_amount=(sub_total*discount_value)/100; + } + + var params = {'sale_id': sale_id, 'sale_item_id': sale_item_id, 'grand_total' : grand_total, 'discount_type':discount_type, 'discount_value':discount_value, 'discount_amount':discount_amount}; + $.ajax({ + type: "POST", + url: ajax_url, + data: params, + success:function(result){ } + }); + }); + + + // Payment for Bill + $('#pay-bill').click(function() { + var sale_id=$(".selected-item").find(".orders-id").text().substr(0,16); + if(sale_id!=""){ + window.location.href = '/origami/sale/'+ sale_id + "/payment" + } + else { + alert("Please select an order!"); + } + + return false; + }); + + $('#customer').click(function() { + var sale = $(".selected-item").find(".orders-id").text().substr(0,16); + if (sale.substring(0, 3)=="SAL") { + var sale_id = sale + }else{ + var sale_id = $(".selected-item").find(".order-cid").text(); + } + window.location.href = '/origami/'+ sale_id + "/customers" + + return false; + }); + + $('#re-print').click(function() { + var sale_id = $(".selected-item").find(".orders-id").text().substr(0,16); + + window.location.href = '/origami/'+ sale_id + "/reprint" + + return false; + }); + + function show_customer_details(customer_id){ + + if(window.location.pathname.substring(0, 12) == "/origami/SAL"){ + var url = customer_id+"/get_customer/" + }else{ + var url = "origami/"+customer_id+"/get_customer/" + } + + $('.customer_detail').removeClass('hide'); + + //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 = + '' + data["response_data"]["data"][i]["accountable_type"] +'' + +'' + balance + ''; + + $(".rebate_amount").html(row); + } + + } + }); + }else{ + $('.rebate_amount').addClass('hide'); + } + } + }); + //End Ajax + } + + /* For Receipt - Calculate discount or tax */ + $('.cashier_number').on('click', function(event){ + if(event.handled !== true) { + var original_value=0; + original_value = $('#discount-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"){ + $('#discount-amount').val(input_value); + update_balance(); + } + else{ + $('#discount-amount').val(original_value + '' + input_value); + update_balance(); + } + break; + + case 'add': + var input_value = $(this).attr("data-value"); + amount = parseInt(input_value); + $('#discount-amount').val(amount); + $('#discount-type').val(1); + update_balance(); + break; + + case 'del' : + var discount_text=$('#discount-amount').val(); + $('#discount-amount').val(discount_text.substr(0,discount_text.length-1)); + update_balance(); + break; + + case 'clr': + $('#discount-amount').val("0.0"); + update_balance(); + break; + } + + event.handled = true; + } else { + return false; + } + }); + + $('.discount-item-row').on('click',function(){ + $('.discount-item-row').removeClass('selected-item'); + $(this).addClass('selected-item'); + }); + +}); + +/* Button Control by Status */ +function control_button(order_status){ + if(order_status=="billed"){ + $("#customer").prop('disabled', false); + $("#request_bills").prop('disabled', true); + $("#discount").prop('disabled', false); + $("#pay-bill").prop('disabled', false); + $("#re-print").prop('disabled', true); + } + else if(order_status=="new") { + $("#customer").prop('disabled', false); + $("#request_bills").prop('disabled', false); + $("#discount").prop('disabled', true); + $("#pay-bill").prop('disabled', true); + $("#re-print").prop('disabled', true); + }else if(order_status=="completed"){ + $("#re-print").prop('disabled', false); + } + else { + $("#customer").prop('disabled', true); + $("#request_bills").prop('disabled', true); + $("#discount").prop('disabled', true); + $("#pay-bill").prop('disabled', true); + $("#re-print").prop('disabled', true); + } + +} + +/* For Receipt - Update Balance */ +function update_balance(){ + var discount_type = $('#discount-type').val(); + var discount_amount = $('#discount-amount').val(); + var sub_total = $('#order-sub-total').text(); + var tax = $('#order-Tax').text(); + + // For Percentage Discount + if(discount_type == 1){ + discount_amount=(sub_total*discount_amount)/100; + } + + var total = (parseFloat(sub_total) + parseFloat(tax)) - discount_amount; + $('#order-discount').text(discount_amount); + $('#order-grand-total').text(total); +} diff --git a/app/assets/javascripts/reports/daily_sales.coffee b/app/assets/javascripts/reports/daily_sales.coffee new file mode 100644 index 00000000..24f83d18 --- /dev/null +++ b/app/assets/javascripts/reports/daily_sales.coffee @@ -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/ diff --git a/app/assets/javascripts/reports/dailysales.coffee b/app/assets/javascripts/reports/dailysales.coffee new file mode 100644 index 00000000..24f83d18 --- /dev/null +++ b/app/assets/javascripts/reports/dailysales.coffee @@ -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/ diff --git a/app/assets/javascripts/reports/sale_items.coffee b/app/assets/javascripts/reports/sale_items.coffee new file mode 100644 index 00000000..24f83d18 --- /dev/null +++ b/app/assets/javascripts/reports/sale_items.coffee @@ -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/ diff --git a/app/assets/javascripts/settings/processing_items.js b/app/assets/javascripts/settings/processing_items.js index 445b46d5..60c53ba4 100644 --- a/app/assets/javascripts/settings/processing_items.js +++ b/app/assets/javascripts/settings/processing_items.js @@ -40,7 +40,7 @@ $(document).on('turbolinks:load', function() { items.push($(value).attr("data-id")); }); - $("#order_queue_station_processing_items").val(items); + $("#order_queue_station_processing_items").val(JSON.stringify(items)); //$(this).submit(); }) }) diff --git a/app/assets/stylesheets/CRM.scss b/app/assets/stylesheets/CRM.scss index 8ddc1605..9ab3730c 100644 --- a/app/assets/stylesheets/CRM.scss +++ b/app/assets/stylesheets/CRM.scss @@ -23,3 +23,17 @@ .assign .text-muted{ color: #fff !important; } +.red{ + color: #fff !important; + background-color: red; +} +.green{ + color: #fff !important; + background-color: green; +} +.required abbr{ + color: red !important; +} +.jconfirm-box-container{ + margin-left:-40px !important +} \ No newline at end of file diff --git a/app/assets/stylesheets/OQS.scss b/app/assets/stylesheets/OQS.scss index b516836a..57c5a36d 100644 --- a/app/assets/stylesheets/OQS.scss +++ b/app/assets/stylesheets/OQS.scss @@ -19,3 +19,9 @@ color: #fff !important; background-color: blue; } + +.order-item { + width: 49%; + font-size: 18px; + margin: 0px 0px 5px 0px; +} \ No newline at end of file diff --git a/app/assets/stylesheets/cash_mgmt.scss b/app/assets/stylesheets/cash_mgmt.scss new file mode 100644 index 00000000..dfec4c04 --- /dev/null +++ b/app/assets/stylesheets/cash_mgmt.scss @@ -0,0 +1,3 @@ +// Place all the styles related to the cash_mgmt controller here. +// They will automatically be included in application.css. +// You can use Sass (SCSS) here: http://sass-lang.com/ diff --git a/app/assets/stylesheets/jquery-confirm.scss b/app/assets/stylesheets/jquery-confirm.scss new file mode 100644 index 00000000..3c16dc8d --- /dev/null +++ b/app/assets/stylesheets/jquery-confirm.scss @@ -0,0 +1,10 @@ +/*! + * jquery-confirm v3.2.3 (http://craftpip.github.io/jquery-confirm/) + * Author: boniface pereira + * Website: www.craftpip.com + * Contact: hey@craftpip.com + * + * Copyright 2013-2017 jquery-confirm + * Licensed under MIT (https://github.com/craftpip/jquery-confirm/blob/master/LICENSE) + */@-webkit-keyframes + jconfirm-spin{from{-webkit-transform:rotate(0deg);transform:rotate(0deg)}to{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}@keyframes jconfirm-spin{from{-webkit-transform:rotate(0deg);transform:rotate(0deg)}to{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}body[class*=jconfirm-no-scroll-]{overflow:hidden!important}.jconfirm{position:fixed;top:0;left:0;right:0;bottom:0;z-index:99999999;font-family:inherit;overflow:hidden}.jconfirm .jconfirm-bg{position:fixed;top:0;left:0;right:0;bottom:0;-webkit-transition:opacity .4s;transition:opacity .4s}.jconfirm .jconfirm-bg.jconfirm-bg-h{opacity:0!important}.jconfirm .jconfirm-scrollpane{position:fixed;top:0;left:0;right:0;bottom:0;overflow-y:auto;-webkit-perspective:500px;perspective:500px;-webkit-perspective-origin:center;perspective-origin:center}.jconfirm .jconfirm-box{background:white;border-radius:4px;position:relative;outline:0;padding:15px 15px 0;overflow:hidden;margin-left:auto;margin-right:auto}@-webkit-keyframes type-blue{1%,100%{border-color:#3498db}50%{border-color:#5faee3}}@keyframes type-blue{1%,100%{border-color:#3498db}50%{border-color:#5faee3}}@-webkit-keyframes type-green{1%,100%{border-color:#2ecc71}50%{border-color:#54d98c}}@keyframes type-green{1%,100%{border-color:#2ecc71}50%{border-color:#54d98c}}@-webkit-keyframes type-red{1%,100%{border-color:#e74c3c}50%{border-color:#ed7669}}@keyframes type-red{1%,100%{border-color:#e74c3c}50%{border-color:#ed7669}}@-webkit-keyframes type-orange{1%,100%{border-color:#f1c40f}50%{border-color:#f4d03f}}@keyframes type-orange{1%,100%{border-color:#f1c40f}50%{border-color:#f4d03f}}@-webkit-keyframes type-purple{1%,100%{border-color:#9b59b6}50%{border-color:#b07cc6}}@keyframes type-purple{1%,100%{border-color:#9b59b6}50%{border-color:#b07cc6}}@-webkit-keyframes type-dark{1%,100%{border-color:#34495e}50%{border-color:#46627f}}@keyframes type-dark{1%,100%{border-color:#34495e}50%{border-color:#46627f}}.jconfirm .jconfirm-box.jconfirm-type-animated{-webkit-animation-duration:2s;animation-duration:2s;-webkit-animation-iteration-count:infinite;animation-iteration-count:infinite}.jconfirm .jconfirm-box.jconfirm-type-blue{border-top:solid 7px #3498db;-webkit-animation-name:type-blue;animation-name:type-blue}.jconfirm .jconfirm-box.jconfirm-type-green{border-top:solid 7px #2ecc71;-webkit-animation-name:type-green;animation-name:type-green}.jconfirm .jconfirm-box.jconfirm-type-red{border-top:solid 7px #e74c3c;-webkit-animation-name:type-red;animation-name:type-red}.jconfirm .jconfirm-box.jconfirm-type-orange{border-top:solid 7px #f1c40f;-webkit-animation-name:type-orange;animation-name:type-orange}.jconfirm .jconfirm-box.jconfirm-type-purple{border-top:solid 7px #9b59b6;-webkit-animation-name:type-purple;animation-name:type-purple}.jconfirm .jconfirm-box.jconfirm-type-dark{border-top:solid 7px #34495e;-webkit-animation-name:type-dark;animation-name:type-dark}.jconfirm .jconfirm-box.loading{height:120px}.jconfirm .jconfirm-box.loading:before{content:'';position:absolute;left:0;background:white;right:0;top:0;bottom:0;border-radius:10px;z-index:1}.jconfirm .jconfirm-box.loading:after{opacity:.6;content:'';height:30px;width:30px;border:solid 3px transparent;position:absolute;left:50%;margin-left:-15px;border-radius:50%;-webkit-animation:jconfirm-spin 1s infinite linear;animation:jconfirm-spin 1s infinite linear;border-bottom-color:dodgerblue;top:50%;margin-top:-15px;z-index:2}.jconfirm .jconfirm-box div.jconfirm-closeIcon{height:20px;width:20px;position:absolute;top:5px;right:5px;cursor:pointer;opacity:.6;text-align:center;-webkit-transition:opacity .3s ease-in;transition:opacity .3s ease-in;font-size:27px!important;line-height:14px!important;display:none}.jconfirm .jconfirm-box div.jconfirm-closeIcon:empty{display:none}.jconfirm .jconfirm-box div.jconfirm-closeIcon .fa{font-size:16px}.jconfirm .jconfirm-box div.jconfirm-closeIcon .glyphicon{font-size:16px}.jconfirm .jconfirm-box div.jconfirm-closeIcon .zmdi{font-size:16px}.jconfirm .jconfirm-box div.jconfirm-closeIcon:hover{opacity:1}.jconfirm .jconfirm-box div.jconfirm-title-c{display:block;font-size:22px;line-height:20px;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.jconfirm .jconfirm-box div.jconfirm-title-c.jconfirm-hand{cursor:move}.jconfirm .jconfirm-box div.jconfirm-title-c .jconfirm-icon-c{font-size:inherit;padding-bottom:15px;display:inline-block;vertical-align:middle}.jconfirm .jconfirm-box div.jconfirm-title-c .jconfirm-icon-c i{vertical-align:middle}.jconfirm .jconfirm-box div.jconfirm-title-c .jconfirm-icon-c:empty{display:none}.jconfirm .jconfirm-box div.jconfirm-title-c .jconfirm-title{-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;font-size:inherit;font-family:inherit;display:inline-block;vertical-align:middle;padding-bottom:15px}.jconfirm .jconfirm-box div.jconfirm-title-c .jconfirm-title:empty{display:none}.jconfirm .jconfirm-box div.jconfirm-content-pane{margin-bottom:15px;height:auto;-webkit-transition:height .4s ease-in;transition:height .4s ease-in;display:inline-block;width:100%;position:relative;overflow:hidden}.jconfirm .jconfirm-box div.jconfirm-content-pane .jconfirm-content img{max-width:100%;height:auto}.jconfirm .jconfirm-box div.jconfirm-content-pane .jconfirm-content:empty{display:none}.jconfirm .jconfirm-box .jconfirm-buttons{padding-bottom:11px}.jconfirm .jconfirm-box .jconfirm-buttons>button{margin-bottom:4px;margin-left:2px;margin-right:2px}.jconfirm .jconfirm-box .jconfirm-buttons button{display:inline-block;padding:6px 12px;font-size:14px;font-weight:400;line-height:1.42857143;text-align:center;white-space:nowrap;vertical-align:middle;-ms-touch-action:manipulation;touch-action:manipulation;cursor:pointer;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;border-radius:4px;min-height:1em;outline:0;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;-webkit-transition:opacity .1s ease,background-color .1s ease,color .1s ease,box-shadow .1s ease,background .1s ease;transition:opacity .1s ease,background-color .1s ease,color .1s ease,box-shadow .1s ease,background .1s ease;-webkit-tap-highlight-color:transparent;border:0;background-image:none}.jconfirm .jconfirm-box .jconfirm-buttons button.btn-blue{background-color:#3498db;color:#FFF;text-shadow:none;-webkit-transition:background .2s;transition:background .2s}.jconfirm .jconfirm-box .jconfirm-buttons button.btn-blue:hover{background-color:#2980b9;color:#FFF}.jconfirm .jconfirm-box .jconfirm-buttons button.btn-green{background-color:#2ecc71;color:#FFF;text-shadow:none;-webkit-transition:background .2s;transition:background .2s}.jconfirm .jconfirm-box .jconfirm-buttons button.btn-green:hover{background-color:#27ae60;color:#FFF}.jconfirm .jconfirm-box .jconfirm-buttons button.btn-red{background-color:#e74c3c;color:#FFF;text-shadow:none;-webkit-transition:background .2s;transition:background .2s}.jconfirm .jconfirm-box .jconfirm-buttons button.btn-red:hover{background-color:#c0392b;color:#FFF}.jconfirm .jconfirm-box .jconfirm-buttons button.btn-orange{background-color:#f1c40f;color:#FFF;text-shadow:none;-webkit-transition:background .2s;transition:background .2s}.jconfirm .jconfirm-box .jconfirm-buttons button.btn-orange:hover{background-color:#f39c12;color:#FFF}.jconfirm .jconfirm-box .jconfirm-buttons button.btn-default{background-color:#ecf0f1;color:#000;text-shadow:none;-webkit-transition:background .2s;transition:background .2s}.jconfirm .jconfirm-box .jconfirm-buttons button.btn-default:hover{background-color:#bdc3c7;color:#000}.jconfirm .jconfirm-box .jconfirm-buttons button.btn-purple{background-color:#9b59b6;color:#FFF;text-shadow:none;-webkit-transition:background .2s;transition:background .2s}.jconfirm .jconfirm-box .jconfirm-buttons button.btn-purple:hover{background-color:#8e44ad;color:#FFF}.jconfirm .jconfirm-box .jconfirm-buttons button.btn-dark{background-color:#34495e;color:#FFF;text-shadow:none;-webkit-transition:background .2s;transition:background .2s}.jconfirm .jconfirm-box .jconfirm-buttons button.btn-dark:hover{background-color:#2c3e50;color:#FFF}.jconfirm .jconfirm-box.jconfirm-type-red .jconfirm-title-c .jconfirm-icon-c{color:#e74c3c!important}.jconfirm .jconfirm-box.jconfirm-type-blue .jconfirm-title-c .jconfirm-icon-c{color:#3498db!important}.jconfirm .jconfirm-box.jconfirm-type-green .jconfirm-title-c .jconfirm-icon-c{color:#2ecc71!important}.jconfirm .jconfirm-box.jconfirm-type-purple .jconfirm-title-c .jconfirm-icon-c{color:#9b59b6!important}.jconfirm .jconfirm-box.jconfirm-type-orange .jconfirm-title-c .jconfirm-icon-c{color:#f1c40f!important}.jconfirm .jconfirm-box.jconfirm-type-dark .jconfirm-title-c .jconfirm-icon-c{color:#34495e!important}.jconfirm .jconfirm-clear{clear:both}.jconfirm.jconfirm-rtl{direction:rtl}.jconfirm.jconfirm-rtl div.jconfirm-closeIcon{left:5px;right:auto}.jconfirm.jconfirm-white .jconfirm-bg,.jconfirm.jconfirm-light .jconfirm-bg{background-color:#444;opacity:.2}.jconfirm.jconfirm-white .jconfirm-box,.jconfirm.jconfirm-light .jconfirm-box{box-shadow:0 2px 6px rgba(0,0,0,0.2);border-radius:5px}.jconfirm.jconfirm-white .jconfirm-box .jconfirm-title-c .jconfirm-icon-c,.jconfirm.jconfirm-light .jconfirm-box .jconfirm-title-c .jconfirm-icon-c{margin-right:8px;margin-left:0}.jconfirm.jconfirm-white .jconfirm-box .jconfirm-buttons,.jconfirm.jconfirm-light .jconfirm-box .jconfirm-buttons{float:right}.jconfirm.jconfirm-white .jconfirm-box .jconfirm-buttons button,.jconfirm.jconfirm-light .jconfirm-box .jconfirm-buttons button{text-transform:uppercase;font-size:14px;font-weight:bold;text-shadow:none}.jconfirm.jconfirm-white .jconfirm-box .jconfirm-buttons button.btn-default,.jconfirm.jconfirm-light .jconfirm-box .jconfirm-buttons button.btn-default{box-shadow:none;color:#333}.jconfirm.jconfirm-white .jconfirm-box .jconfirm-buttons button.btn-default:hover,.jconfirm.jconfirm-light .jconfirm-box .jconfirm-buttons button.btn-default:hover{background:#ddd}.jconfirm.jconfirm-white.jconfirm-rtl .jconfirm-title-c .jconfirm-icon-c,.jconfirm.jconfirm-light.jconfirm-rtl .jconfirm-title-c .jconfirm-icon-c{margin-left:8px;margin-right:0}.jconfirm.jconfirm-black .jconfirm-bg,.jconfirm.jconfirm-dark .jconfirm-bg{background-color:darkslategray;opacity:.4}.jconfirm.jconfirm-black .jconfirm-box,.jconfirm.jconfirm-dark .jconfirm-box{box-shadow:0 2px 6px rgba(0,0,0,0.2);background:#444;border-radius:5px;color:white}.jconfirm.jconfirm-black .jconfirm-box .jconfirm-title-c .jconfirm-icon-c,.jconfirm.jconfirm-dark .jconfirm-box .jconfirm-title-c .jconfirm-icon-c{margin-right:8px;margin-left:0}.jconfirm.jconfirm-black .jconfirm-box .jconfirm-buttons,.jconfirm.jconfirm-dark .jconfirm-box .jconfirm-buttons{float:right}.jconfirm.jconfirm-black .jconfirm-box .jconfirm-buttons button,.jconfirm.jconfirm-dark .jconfirm-box .jconfirm-buttons button{border:0;background-image:none;text-transform:uppercase;font-size:14px;font-weight:bold;text-shadow:none;-webkit-transition:background .1s;transition:background .1s;color:white}.jconfirm.jconfirm-black .jconfirm-box .jconfirm-buttons button.btn-default,.jconfirm.jconfirm-dark .jconfirm-box .jconfirm-buttons button.btn-default{box-shadow:none;color:#fff;background:0}.jconfirm.jconfirm-black .jconfirm-box .jconfirm-buttons button.btn-default:hover,.jconfirm.jconfirm-dark .jconfirm-box .jconfirm-buttons button.btn-default:hover{background:#666}.jconfirm.jconfirm-black.jconfirm-rtl .jconfirm-title-c .jconfirm-icon-c,.jconfirm.jconfirm-dark.jconfirm-rtl .jconfirm-title-c .jconfirm-icon-c{margin-left:8px;margin-right:0}.jconfirm .jconfirm-box.hilight.jconfirm-hilight-shake{-webkit-animation:shake .82s cubic-bezier(0.36,0.07,0.19,0.97) both;animation:shake .82s cubic-bezier(0.36,0.07,0.19,0.97) both;-webkit-transform:translate3d(0,0,0);transform:translate3d(0,0,0)}.jconfirm .jconfirm-box.hilight.jconfirm-hilight-glow{-webkit-animation:glow .82s cubic-bezier(0.36,0.07,0.19,0.97) both;animation:glow .82s cubic-bezier(0.36,0.07,0.19,0.97) both;-webkit-transform:translate3d(0,0,0);transform:translate3d(0,0,0)}@-webkit-keyframes shake{10%,90%{-webkit-transform:translate3d(-2px,0,0);transform:translate3d(-2px,0,0)}20%,80%{-webkit-transform:translate3d(4px,0,0);transform:translate3d(4px,0,0)}30%,50%,70%{-webkit-transform:translate3d(-8px,0,0);transform:translate3d(-8px,0,0)}40%,60%{-webkit-transform:translate3d(8px,0,0);transform:translate3d(8px,0,0)}}@keyframes shake{10%,90%{-webkit-transform:translate3d(-2px,0,0);transform:translate3d(-2px,0,0)}20%,80%{-webkit-transform:translate3d(4px,0,0);transform:translate3d(4px,0,0)}30%,50%,70%{-webkit-transform:translate3d(-8px,0,0);transform:translate3d(-8px,0,0)}40%,60%{-webkit-transform:translate3d(8px,0,0);transform:translate3d(8px,0,0)}}@-webkit-keyframes glow{0%,100%{box-shadow:0 0 3px red}50%{box-shadow:0 0 30px red}}@keyframes glow{0%,100%{box-shadow:0 0 3px red}50%{box-shadow:0 0 30px red}}.jconfirm{-webkit-perspective:400px;perspective:400px}.jconfirm .jconfirm-box{opacity:1;-webkit-transition-property:all;transition-property:all}.jconfirm .jconfirm-box.jconfirm-animation-top,.jconfirm .jconfirm-box.jconfirm-animation-left,.jconfirm .jconfirm-box.jconfirm-animation-right,.jconfirm .jconfirm-box.jconfirm-animation-bottom,.jconfirm .jconfirm-box.jconfirm-animation-opacity,.jconfirm .jconfirm-box.jconfirm-animation-zoom,.jconfirm .jconfirm-box.jconfirm-animation-scale,.jconfirm .jconfirm-box.jconfirm-animation-none,.jconfirm .jconfirm-box.jconfirm-animation-rotate,.jconfirm .jconfirm-box.jconfirm-animation-rotatex,.jconfirm .jconfirm-box.jconfirm-animation-rotatey,.jconfirm .jconfirm-box.jconfirm-animation-scaley,.jconfirm .jconfirm-box.jconfirm-animation-scalex{opacity:0}.jconfirm .jconfirm-box.jconfirm-animation-rotate{-webkit-transform:rotate(90deg);-ms-transform:rotate(90deg);transform:rotate(90deg)}.jconfirm .jconfirm-box.jconfirm-animation-rotatex{-webkit-transform:rotateX(90deg);transform:rotateX(90deg);-webkit-transform-origin:center;-ms-transform-origin:center;transform-origin:center}.jconfirm .jconfirm-box.jconfirm-animation-rotatexr{-webkit-transform:rotateX(-90deg);transform:rotateX(-90deg);-webkit-transform-origin:center;-ms-transform-origin:center;transform-origin:center}.jconfirm .jconfirm-box.jconfirm-animation-rotatey{-webkit-transform:rotatey(90deg);-ms-transform:rotatey(90deg);transform:rotatey(90deg);-webkit-transform-origin:center;-ms-transform-origin:center;transform-origin:center}.jconfirm .jconfirm-box.jconfirm-animation-rotateyr{-webkit-transform:rotatey(-90deg);-ms-transform:rotatey(-90deg);transform:rotatey(-90deg);-webkit-transform-origin:center;-ms-transform-origin:center;transform-origin:center}.jconfirm .jconfirm-box.jconfirm-animation-scaley{-webkit-transform:scaley(1.5);-ms-transform:scaley(1.5);transform:scaley(1.5);-webkit-transform-origin:center;-ms-transform-origin:center;transform-origin:center}.jconfirm .jconfirm-box.jconfirm-animation-scalex{-webkit-transform:scalex(1.5);-ms-transform:scalex(1.5);transform:scalex(1.5);-webkit-transform-origin:center;-ms-transform-origin:center;transform-origin:center}.jconfirm .jconfirm-box.jconfirm-animation-top{-webkit-transform:translate(0px,-100px);-ms-transform:translate(0px,-100px);transform:translate(0px,-100px)}.jconfirm .jconfirm-box.jconfirm-animation-left{-webkit-transform:translate(-100px,0px);-ms-transform:translate(-100px,0px);transform:translate(-100px,0px)}.jconfirm .jconfirm-box.jconfirm-animation-right{-webkit-transform:translate(100px,0px);-ms-transform:translate(100px,0px);transform:translate(100px,0px)}.jconfirm .jconfirm-box.jconfirm-animation-bottom{-webkit-transform:translate(0px,100px);-ms-transform:translate(0px,100px);transform:translate(0px,100px)}.jconfirm .jconfirm-box.jconfirm-animation-zoom{-webkit-transform:scale(1.2);-ms-transform:scale(1.2);transform:scale(1.2)}.jconfirm .jconfirm-box.jconfirm-animation-scale{-webkit-transform:scale(0.5);-ms-transform:scale(0.5);transform:scale(0.5)}.jconfirm .jconfirm-box.jconfirm-animation-none{visibility:hidden}.jconfirm.jconfirm-supervan .jconfirm-bg{background-color:rgba(54,70,93,0.95)}.jconfirm.jconfirm-supervan .jconfirm-box{background-color:transparent}.jconfirm.jconfirm-supervan .jconfirm-box.jconfirm-type-blue{border:0}.jconfirm.jconfirm-supervan .jconfirm-box.jconfirm-type-green{border:0}.jconfirm.jconfirm-supervan .jconfirm-box.jconfirm-type-red{border:0}.jconfirm.jconfirm-supervan .jconfirm-box.jconfirm-type-orange{border:0}.jconfirm.jconfirm-supervan .jconfirm-box.jconfirm-type-purple{border:0}.jconfirm.jconfirm-supervan .jconfirm-box.jconfirm-type-dark{border:0}.jconfirm.jconfirm-supervan .jconfirm-box div.jconfirm-closeIcon{color:white}.jconfirm.jconfirm-supervan .jconfirm-box div.jconfirm-title-c{text-align:center;color:white;font-size:28px;font-weight:normal}.jconfirm.jconfirm-supervan .jconfirm-box div.jconfirm-title-c>*{padding-bottom:25px}.jconfirm.jconfirm-supervan .jconfirm-box div.jconfirm-title-c .jconfirm-icon-c{margin-right:8px;margin-left:0}.jconfirm.jconfirm-supervan .jconfirm-box div.jconfirm-content-pane{margin-bottom:25px}.jconfirm.jconfirm-supervan .jconfirm-box div.jconfirm-content{text-align:center;color:white}.jconfirm.jconfirm-supervan .jconfirm-box .jconfirm-buttons{text-align:center}.jconfirm.jconfirm-supervan .jconfirm-box .jconfirm-buttons button{font-size:16px;border-radius:2px;background:#303f53;text-shadow:none;border:0;color:white;padding:10px;min-width:100px}.jconfirm.jconfirm-supervan.jconfirm-rtl .jconfirm-box div.jconfirm-title-c .jconfirm-icon-c{margin-left:8px;margin-right:0}.jconfirm.jconfirm-material .jconfirm-bg{background-color:rgba(0,0,0,0.67)}.jconfirm.jconfirm-material .jconfirm-box{background-color:white;box-shadow:0 7px 8px -4px rgba(0,0,0,0.2),0 13px 19px 2px rgba(0,0,0,0.14),0 5px 24px 4px rgba(0,0,0,0.12);padding:30px 25px 10px 25px}.jconfirm.jconfirm-material .jconfirm-box .jconfirm-title-c .jconfirm-icon-c{margin-right:8px;margin-left:0}.jconfirm.jconfirm-material .jconfirm-box div.jconfirm-closeIcon{color:rgba(0,0,0,0.87)}.jconfirm.jconfirm-material .jconfirm-box div.jconfirm-title-c{color:rgba(0,0,0,0.87);font-size:22px;font-weight:bold}.jconfirm.jconfirm-material .jconfirm-box div.jconfirm-content{color:rgba(0,0,0,0.87)}.jconfirm.jconfirm-material .jconfirm-box .jconfirm-buttons{text-align:right}.jconfirm.jconfirm-material .jconfirm-box .jconfirm-buttons button{text-transform:uppercase;font-weight:500}.jconfirm.jconfirm-material.jconfirm-rtl .jconfirm-title-c .jconfirm-icon-c{margin-left:8px;margin-right:0}.jconfirm.jconfirm-bootstrap .jconfirm-bg{background-color:rgba(0,0,0,0.21)}.jconfirm.jconfirm-bootstrap .jconfirm-box{background-color:white;box-shadow:0 3px 8px 0 rgba(0,0,0,0.2);border:solid 1px rgba(0,0,0,0.4);padding:15px 0 0}.jconfirm.jconfirm-bootstrap .jconfirm-box .jconfirm-title-c .jconfirm-icon-c{margin-right:8px;margin-left:0}.jconfirm.jconfirm-bootstrap .jconfirm-box div.jconfirm-closeIcon{color:rgba(0,0,0,0.87)}.jconfirm.jconfirm-bootstrap .jconfirm-box div.jconfirm-title-c{color:rgba(0,0,0,0.87);font-size:22px;font-weight:bold;padding-left:15px;padding-right:15px}.jconfirm.jconfirm-bootstrap .jconfirm-box div.jconfirm-content{color:rgba(0,0,0,0.87);padding:0 15px}.jconfirm.jconfirm-bootstrap .jconfirm-box .jconfirm-buttons{text-align:right;padding:10px;margin:-5px 0 0;border-top:solid 1px #ddd;overflow:hidden;border-radius:0 0 4px 4px}.jconfirm.jconfirm-bootstrap .jconfirm-box .jconfirm-buttons button{font-weight:500}.jconfirm.jconfirm-bootstrap.jconfirm-rtl .jconfirm-title-c .jconfirm-icon-c{margin-left:8px;margin-right:0}.jconfirm.jconfirm-modern .jconfirm-bg{background-color:slategray;opacity:.6}.jconfirm.jconfirm-modern .jconfirm-box{background-color:white;box-shadow:0 7px 8px -4px rgba(0,0,0,0.2),0 13px 19px 2px rgba(0,0,0,0.14),0 5px 24px 4px rgba(0,0,0,0.12);padding:30px 30px 15px}.jconfirm.jconfirm-modern .jconfirm-box div.jconfirm-closeIcon{color:rgba(0,0,0,0.87);top:15px;right:15px}.jconfirm.jconfirm-modern .jconfirm-box div.jconfirm-title-c{color:rgba(0,0,0,0.87);font-size:24px;font-weight:bold;text-align:center;margin-bottom:10px}.jconfirm.jconfirm-modern .jconfirm-box div.jconfirm-title-c .jconfirm-icon-c{-webkit-transition:-webkit-transform .5s;transition:transform .5s;-webkit-transform:scale(0);-ms-transform:scale(0);transform:scale(0);display:block;margin-right:0;margin-left:0;margin-bottom:10px;font-size:69px;color:#aaa}.jconfirm.jconfirm-modern .jconfirm-box div.jconfirm-content{text-align:center;font-size:15px;color:#777;margin-bottom:25px}.jconfirm.jconfirm-modern .jconfirm-box .jconfirm-buttons{text-align:center}.jconfirm.jconfirm-modern .jconfirm-box .jconfirm-buttons button{font-weight:bold;text-transform:uppercase;-webkit-transition:background .1s;transition:background .1s;padding:10px 20px}.jconfirm.jconfirm-modern .jconfirm-box .jconfirm-buttons button+button{margin-left:4px}.jconfirm.jconfirm-modern.jconfirm-open .jconfirm-box .jconfirm-title-c .jconfirm-icon-c{-webkit-transform:scale(1);-ms-transform:scale(1);transform:scale(1)} \ No newline at end of file diff --git a/app/assets/stylesheets/origami.scss b/app/assets/stylesheets/origami.scss index c96237fa..2ba6fe52 100644 --- a/app/assets/stylesheets/origami.scss +++ b/app/assets/stylesheets/origami.scss @@ -9,6 +9,9 @@ // min-height: 75rem; // padding-top: 4.5rem; // } +.card-columns { + font-size: 18px !important;} + .others-payment{ line-height:100px; text-align:center; @@ -41,17 +44,50 @@ .pay{ width: 98%; - height:211px; + height:211px; line-height:211px; text-align:center; font-size:20px; color:white; } +.payment{ + height:70px;line-height:70px;align:center;color:white;font-size:16px;margin-bottom:1px; +} + +.cash-color{ + background-color:#80CBC4; +} + +.credit-color{ + background-color:#FFCCBC; +} + +.other-payment-color{ + background-color:#E1BEE7; +} + .cashier_number:hover{ background:#A9F5F2; } +.action-btn { + height: 60px; + margin-bottom: 5px; +} + +.bottom-5 { + margin-bottom: 5px; +} + +.fluid { + width: 100%; +} + +.style2 { + border-top: 3px double #8c8b8b; +} + .long{ width:49%; } @@ -69,6 +105,11 @@ background-color: blue !important; } +.selected-account { + color: #fff !important; + background-color: blue !important; +} + /* Reciept Style */ #order-charges-table td { border-top: none !important; @@ -89,6 +130,18 @@ text-align: right; } +.item-attr-edit{ + width: 10%; + text-align: left; +} + +.display-none{ + display: none; +} + +.text-white{ + color: #fff; +} /* Colors */ .purple { @@ -107,6 +160,14 @@ background-color: #009900 } +.orange{ + background-color: #FF8C00 +} + +.blue{ + background-color: blue +} + .left{ margin-left:1px; } @@ -133,3 +194,11 @@ select.form-control { tr.discount-item-row:hover { background-color: #e3e3e3 !important; } +.required abbr{ + color: red !important; +} +/* Jquery Confirm */ + +.jconfirm-box-container{ + margin-left:-40px !important +} diff --git a/app/assets/stylesheets/origami/shifts.scss b/app/assets/stylesheets/origami/shifts.scss new file mode 100644 index 00000000..ee1b2c4e --- /dev/null +++ b/app/assets/stylesheets/origami/shifts.scss @@ -0,0 +1,3 @@ +// Place all the styles related to the origami/shifts controller here. +// They will automatically be included in application.css. +// You can use Sass (SCSS) here: http://sass-lang.com/ diff --git a/app/assets/stylesheets/reports/daily_sales.scss b/app/assets/stylesheets/reports/daily_sales.scss new file mode 100644 index 00000000..79ed876a --- /dev/null +++ b/app/assets/stylesheets/reports/daily_sales.scss @@ -0,0 +1,3 @@ +// Place all the styles related to the reports/daily_sales controller here. +// They will automatically be included in application.css. +// You can use Sass (SCSS) here: http://sass-lang.com/ diff --git a/app/assets/stylesheets/reports/dailysales.scss b/app/assets/stylesheets/reports/dailysales.scss new file mode 100644 index 00000000..cfc48374 --- /dev/null +++ b/app/assets/stylesheets/reports/dailysales.scss @@ -0,0 +1,3 @@ +// Place all the styles related to the reports/dailysales controller here. +// They will automatically be included in application.css. +// You can use Sass (SCSS) here: http://sass-lang.com/ diff --git a/app/assets/stylesheets/reports/sale_items.scss b/app/assets/stylesheets/reports/sale_items.scss new file mode 100644 index 00000000..b9692327 --- /dev/null +++ b/app/assets/stylesheets/reports/sale_items.scss @@ -0,0 +1,3 @@ +// Place all the styles related to the reports/sale_items controller here. +// They will automatically be included in application.css. +// You can use Sass (SCSS) here: http://sass-lang.com/ diff --git a/app/controllers/api/bill_controller.rb b/app/controllers/api/bill_controller.rb index 03909dc4..4fdd0c35 100644 --- a/app/controllers/api/bill_controller.rb +++ b/app/controllers/api/bill_controller.rb @@ -9,15 +9,17 @@ class Api::BillController < Api::ApiController #create Bill by Booking ID if (params[:booking_id]) booking = Booking.find(params[:booking_id]) - if booking - if booking.sale_id.nil? - @sale = Sale.new - @status, @sale_id = @sale.generate_invoice_from_booking(params[:booking_id], current_login_employee) - else - @status = true - @sale_id = booking.sale_id + + if booking + if booking.sale_id.nil? + @sale = Sale.new + @status, @sale_id = @sale.generate_invoice_from_booking(params[:booking_id], current_login_employee) + else + @status = true + @sale_id = booking.sale_id + end end - end + elsif (params[:order_id]) @sale = Sale.new @status, @sale_id = @sale.generate_invoice_from_order(params[:order_id], current_login_employee) @@ -27,17 +29,16 @@ class Api::BillController < Api::ApiController @sale_items = SaleItem.where("sale_id=?",@sale_id) unique_code = "ReceiptBillPdf" - customer= Customer.where('customer_id=' + @sale_data.customer_id) + customer= Customer.find(@sale_data.customer_id) # get printer info print_settings=PrintSetting.find_by_unique_code(unique_code) - # Calculate Food and Beverage Total - - food_total, beverage_total = SaleItem.calculate_food_beverage(@sale_items) + # 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, food_total, beverage_total) + printer.print_receipt_bill(print_settings,@sale_items,@sale_data,customer.name, item_price_by_accounts) end diff --git a/app/controllers/api/bookings_controller.rb b/app/controllers/api/bookings_controller.rb index 401cd4a8..24973d63 100644 --- a/app/controllers/api/bookings_controller.rb +++ b/app/controllers/api/bookings_controller.rb @@ -6,11 +6,9 @@ class Api::BookingsController < Api::ApiController end def show - @booking = Booking.find(params[:id]) + booking = Booking.find(params[:id]) + if booking.dining_facility_id.to_i == params[:table_id].to_i + @booking = booking + end end - - # private - # def Bookings_params - # params.permit(:id, :order_id) - # end end diff --git a/app/controllers/api/orders_controller.rb b/app/controllers/api/orders_controller.rb index c383fafb..1eba8c56 100644 --- a/app/controllers/api/orders_controller.rb +++ b/app/controllers/api/orders_controller.rb @@ -7,11 +7,37 @@ class Api::OrdersController < Api::ApiController order = Order.find(params[:order_id]) order.order_items end + def get_order order = Order.find(params[:order_id]) order.order_items end + # API - This api will retrive current booking for android with table or room id + def view_orders + booking_id = params[:booking_id] + table_id = params[:table_id] + if Booking.exists?(booking_id) + booking = Booking.find(booking_id) + + if booking + if booking.dining_facility_id.to_i == table_id.to_i + if booking.booking_status == 'assign' + if booking.sale_id.nil? + @booking = booking + end + end + else + table = DiningFacility.find(table_id) + @booking = table.get_booking + end + end + else + table = DiningFacility.find(table_id) + @booking = table.get_booking + end + end + # Description # This API allow new order creation # Input Params @@ -38,23 +64,48 @@ class Api::OrdersController < Api::ApiController if !params["booking_id"].nil? # check booking id is already completed. booking = Booking.find(params[:booking_id]) - if !booking.sale_id.nil? - if booking.sale.sale_status == "completed" || booking.sale.sale_status == "billed" - @order.new_booking = true + if booking + if booking.dining_facility_id.to_i == params[:table_id].to_i && booking.booking_status != 'moved' + if !booking.sale_id.nil? + check_order_with_booking(booking) + else + @order.new_booking = false + @order.booking_id = params[:booking_id] + end else - @order.new_booking = false - @order.booking_id = params[:booking_id] + check_order_with_table(params[:table_id]) end - else - @order.new_booking = false - @order.booking_id = params[:booking_id] - puts "booking sale is null" - end - end + end #booking exists + else + check_order_with_table(params[:table_id]) + end @status, @booking = @order.generate end + def check_order_with_table(table_id) + table = DiningFacility.find(table_id) + if table + booking = table.get_current_booking + if booking + if booking.sale.sale_status == "completed" || booking.sale.sale_status == "billed" + @order.new_booking = true + else + @order.new_booking = false + @order.booking_id = booking.booking_id + end + end + end + end + + def check_order_with_booking(booking) + if booking.sale.sale_status == "completed" || booking.sale.sale_status == "billed" + @order.new_booking = true + else + @order.new_booking = false + @order.booking_id = params[:booking_id] + end + end # Description # This API - allow order to add new items to existing orders, does not allow you to remove confirm items # Update customer info, Guest Info diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index bfde77c9..691c6648 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -3,11 +3,23 @@ class ApplicationController < ActionController::Base #before_action :check_installation protect_from_forgery with: :exception - helper_method :current_company,:current_login_employee - + helper_method :current_company,:current_login_employee,:current_user + # alias_method :current_user, :current_login_employee,:current_user #this is base api base controller to need to inherit. #all token authentication must be done here #response format must be set to JSON + + + rescue_from CanCan::AccessDenied do |exception| + flash[:warning] = exception.message + redirect_to root_path + end + + + def current_user + @current_user ||= Employee.find_by_token_session(session[:session_token]) if session[:session_token] + end + def current_company begin return Company.first @@ -18,7 +30,9 @@ class ApplicationController < ActionController::Base end def current_login_employee - @employee = Employee.find_by_token_session(session[:session_token]) + if (!session[:session_token].nil?) + @employee = Employee.find_by_token_session(session[:session_token]) + end end private diff --git a/app/controllers/base_crm_controller.rb b/app/controllers/base_crm_controller.rb index a6bf7754..38f0df3d 100644 --- a/app/controllers/base_crm_controller.rb +++ b/app/controllers/base_crm_controller.rb @@ -1,9 +1,17 @@ class BaseCrmController < ActionController::Base - include LoginVerification - layout "CRM" + include LoginVerification + layout "CRM" #before_action :check_installation protect_from_forgery with: :exception + rescue_from CanCan::AccessDenied do |exception| + flash[:warning] = exception.message + redirect_to root_path + end + + def current_user + @current_user ||= Employee.find_by_token_session(session[:session_token]) if session[:session_token] + end end diff --git a/app/controllers/base_oqs_controller.rb b/app/controllers/base_oqs_controller.rb index 16fe9b07..50d7bd55 100644 --- a/app/controllers/base_oqs_controller.rb +++ b/app/controllers/base_oqs_controller.rb @@ -5,5 +5,13 @@ class BaseOqsController < ActionController::Base #before_action :check_installation protect_from_forgery with: :exception + rescue_from CanCan::AccessDenied do |exception| + flash[:warning] = exception.message + redirect_to root_path + end + + def current_user + @current_user ||= Employee.find_by_token_session(session[:session_token]) if session[:session_token] + end end diff --git a/app/controllers/base_origami_controller.rb b/app/controllers/base_origami_controller.rb index b250303d..2af895da 100644 --- a/app/controllers/base_origami_controller.rb +++ b/app/controllers/base_origami_controller.rb @@ -5,5 +5,14 @@ class BaseOrigamiController < ActionController::Base #before_action :check_installation protect_from_forgery with: :exception + rescue_from CanCan::AccessDenied do |exception| + flash[:warning] = exception.message + redirect_to root_path + end + + def current_user + @current_user ||= Employee.find_by_token_session(session[:session_token]) if session[:session_token] + end + end diff --git a/app/controllers/base_report_controller.rb b/app/controllers/base_report_controller.rb index c1ae1a01..28ba5c2b 100644 --- a/app/controllers/base_report_controller.rb +++ b/app/controllers/base_report_controller.rb @@ -5,6 +5,15 @@ class BaseReportController < ActionController::Base #before_action :check_installation protect_from_forgery with: :exception + rescue_from CanCan::AccessDenied do |exception| + flash[:warning] = exception.message + redirect_to root_path + end + + def current_user + @current_user ||= Employee.find_by_token_session(session[:session_token]) if session[:session_token] + end + PERIOD = { "today" => 0, "yesterday" => 1, @@ -23,55 +32,117 @@ class BaseReportController < ActionController::Base period = params[:period] from = params[:from] to = params[:to] - day_ref = Time.now - if period_type.to_i == 1 - if params[:from] && params[:to] - if params[:from] != "" && params[:to] !="" - from = DateTime.strptime(params[:from], "%m/%d/%Y") - to = DateTime.strptime(params[:to], "%m/%d/%Y") - else + day_ref = Time.now.utc.getlocal + + if params[:report_type] == "daily_sale" + + if from != "" && to != "" + + f_date = DateTime.parse(params[:from]) + t_date = DateTime.parse(params[:to]) + f_time = Time.mktime(f_date.year,f_date.month,f_date.day,f_date.hour,f_date.min,f_date.sec) + t_time = Time.mktime(t_date.year,t_date.month,t_date.day,t_date.hour,t_date.min,t_date.sec) + from = f_time.beginning_of_day.utc.getlocal + to = t_time.end_of_day.utc.getlocal + + else + + case period.to_i + when PERIOD["today"] + from = day_ref.beginning_of_day.utc to = day_ref.end_of_day.utc - end - end - else - case period.to_i - when PERIOD["today"] - from = day_ref.beginning_of_day.utc - to = day_ref.end_of_day.utc + when PERIOD["yesterday"] + from = (day_ref - 1.day).beginning_of_day.utc + to = (day_ref - 1.day).end_of_day.utc - when PERIOD["yesterday"] - from = (day_ref - 1.day).beginning_of_day.utc - to = (day_ref - 1.day).end_of_day.utc + when PERIOD["this_week"] + from = Time.now.beginning_of_week.utc + to = Time.now.utc + when PERIOD["last_week"] + from = (day_ref - 7.day).beginning_of_week.utc + to = (day_ref - 7.day).end_of_week.utc + when PERIOD["last_7"] + from = (day_ref - 7.day).utc + to = Time.now.utc + when PERIOD["this_month"] + from = Time.now.beginning_of_month.utc + to = Time.now.utc + when PERIOD["last_month"] + from = (day_ref - 1.month).beginning_of_month.utc + to = (day_ref - 1.month).end_of_month.utc + when PERIOD["last_30"] + from = (day_ref - 30.day).utc + to = Time.now.utc + when PERIOD["this_year"] + from = Time.now.beginning_of_year.utc + to = Time.now.utc + when PERIOD["last_year"] + from = (day_ref - 1.year).beginning_of_year.utc + to = (day_ref - 1.year).end_of_year.utc + end + end + else # end daily sale report + if period_type.to_i == 1 + + if params[:from] && params[:to] - when PERIOD["this_week"] - from = Time.now.beginning_of_week.utc - to = Time.now.utc - when PERIOD["last_week"] - from = (day_ref - 7.day).beginning_of_week.utc - to = (day_ref - 7.day).end_of_week.utc - when PERIOD["last_7"] - from = (day_ref - 7.day).utc - to = Time.now.utc - when PERIOD["this_month"] - from = Time.now.beginning_of_month.utc - to = Time.now.utc - when PERIOD["last_month"] - from = (day_ref - 1.month).beginning_of_month.utc - to = (day_ref - 1.month).end_of_month.utc - when PERIOD["last_30"] - from = (day_ref - 30.day).utc - to = Time.now.utc - when PERIOD["this_year"] - from = Time.now.beginning_of_year.utc - to = Time.now.utc - when PERIOD["last_year"] - from = (day_ref - 1.year).beginning_of_year.utc - to = (day_ref - 1.year).end_of_year.utc - end + if params[:from] != "" && params[:to] !="" + + f_date = DateTime.parse(params[:from]) + t_date = DateTime.parse(params[:to]) + f_time = Time.mktime(f_date.year,f_date.month,f_date.day,f_date.hour,f_date.min,f_date.sec) + t_time = Time.mktime(t_date.year,t_date.month,t_date.day,t_date.hour,t_date.min,t_date.sec) + from = f_time.beginning_of_day.utc.getlocal + to = t_time.end_of_day.utc.getlocal + else + from = day_ref.beginning_of_day.utc + to = day_ref.end_of_day.utc + end + end + else + case period.to_i + when PERIOD["today"] + + from = day_ref.beginning_of_day.utc + to = day_ref.end_of_day.utc + + when PERIOD["yesterday"] + from = (day_ref - 1.day).beginning_of_day.utc + to = (day_ref - 1.day).end_of_day.utc + + when PERIOD["this_week"] + from = Time.now.beginning_of_week.utc + to = Time.now.utc + when PERIOD["last_week"] + from = (day_ref - 7.day).beginning_of_week.utc + to = (day_ref - 7.day).end_of_week.utc + when PERIOD["last_7"] + from = (day_ref - 7.day).utc + to = Time.now.utc + when PERIOD["this_month"] + from = Time.now.beginning_of_month.utc + to = Time.now.utc + when PERIOD["last_month"] + from = (day_ref - 1.month).beginning_of_month.utc + to = (day_ref - 1.month).end_of_month.utc + when PERIOD["last_30"] + from = (day_ref - 30.day).utc + to = Time.now.utc + when PERIOD["this_year"] + from = Time.now.beginning_of_year.utc + to = Time.now.utc + when PERIOD["last_year"] + from = (day_ref - 1.year).beginning_of_year.utc + to = (day_ref - 1.year).end_of_year.utc + end + end end + return from, to + + end end diff --git a/app/controllers/crm/bookings_controller.rb b/app/controllers/crm/bookings_controller.rb index 65511512..efaa5419 100644 --- a/app/controllers/crm/bookings_controller.rb +++ b/app/controllers/crm/bookings_controller.rb @@ -1,5 +1,5 @@ class Crm::BookingsController < BaseCrmController - + load_and_authorize_resource def update_booking booking = Booking.find(params[:booking_id]) diff --git a/app/controllers/crm/customers_controller.rb b/app/controllers/crm/customers_controller.rb index 290f6ca1..f2846c12 100644 --- a/app/controllers/crm/customers_controller.rb +++ b/app/controllers/crm/customers_controller.rb @@ -1,4 +1,5 @@ class Crm::CustomersController < BaseCrmController + load_and_authorize_resource except: [:create] before_action :set_crm_customer, only: [:show, :edit, :update, :destroy] # GET /crm/customers @@ -7,23 +8,19 @@ class Crm::CustomersController < BaseCrmController filter = params[:filter] if filter.nil? - @crm_customers = Customer.order("customer_id").page(params[:page]) - #@products = Product.order("name").page(params[:page]).per(5) + @crm_customers = Customer.all else @crm_customers = Customer.search(filter) end #@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) @crm_customer = Customer.new + @count_customer = Customer.count_customer # if flash["errors"] # @crm_customer.valid? # end - # @membership = Customer.get_member_group - # if @membership["status"] == true - # @member_group = @membership["data"] - # end respond_to do |format| format.html # index.html.erb format.json { render json: @crm_customers } @@ -50,15 +47,9 @@ class Crm::CustomersController < BaseCrmController end #get customer amount - @customer = Customer.find(params[:id]) - response = Customer.get_member_account(@customer) - - if(response["status"] == true) - @membership = response["data"] - else - @membership = 0 - end - + @customer = Customer.find(params[:id]) + @response = Customer.get_membership_transactions(@customer) + # @response = "" #end customer amount end @@ -74,54 +65,64 @@ class Crm::CustomersController < BaseCrmController def edit end - # POST /crm/customers + # POST /crm/customers # POST /crm/customers.json def create @crm_customers = Customer.new(customer_params) - + respond_to do |format| - puts @crm_customers.errors.to_json if @crm_customers.save - name = customer_params[:name] - phone = customer_params[:contact_no] - email = customer_params[:email] - dob = customer_params[:date_of_birth] - member_group_id = params[:member_group_id] - - membership = MembershipSetting.find_by_membership_type("paypar_url") - memberaction = MembershipAction.find_by_membership_type("create_membership_customer") - merchant_uid = memberaction.merchant_account_id.to_s - auth_token = memberaction.auth_token.to_s - url = membership.gateway_url.to_s + memberaction.gateway_url.to_s - - response = HTTParty.post(url, :body => { name: name,phone: phone,email: email, - dob: dob, - member_group_id: member_group_id,merchant_uid:merchant_uid,auth_token:auth_token}.to_json, - :headers => { - 'Content-Type' => 'application/json', - 'Accept' => 'application/json' - } - ) - - if response["status"] == true + name = customer_params[:name] + phone = customer_params[:contact_no] + email = customer_params[:email] + dob = customer_params[:date_of_birth] + address = customer_params[:address] + nrc = customer_params[:nrc_no] + card_no = customer_params[:card_no] + member_group_id = params[:member_group_id] - customer = Customer.find(@crm_customers.customer_id) - status = customer.update_attributes(membership_id: response["customer_datas"]["id"]) - - if params[:sale_id] - format.html { redirect_to '/origami/'+params[:sale_id]+'/customers', notice: 'Customer was successfully created.' } - else - format.html { redirect_to crm_customers_path, notice: 'Customer was successfully created'} - end - # format.json { render :index, status: :created, location: @crm_customers } - else - - # @crm_customers.destroy - if params[:sale_id] - format.html { redirect_to '/origami/'+params[:sale_id]+'/customers'} + if !member_group_id.nil? + membership = MembershipSetting.find_by_membership_type("paypar_url") + memberaction = MembershipAction.find_by_membership_type("create_membership_customer") + merchant_uid = memberaction.merchant_account_id.to_s + auth_token = memberaction.auth_token.to_s + url = membership.gateway_url.to_s + memberaction.gateway_url.to_s + + begin + response = HTTParty.post(url, + :body => {name: name,phone: phone,email: email, + dob: dob,address: address,nrc:nrc,card_no:card_no, + member_group_id: member_group_id, + merchant_uid:merchant_uid,auth_token:auth_token}.to_json, + :headers => { + 'Content-Type' => 'application/json', + 'Accept' => 'application/json' + }, + :timeout => 10 + ) + rescue Net::OpenTimeout + response = { status: false } + end + + if response["status"] == true + + customer = Customer.find(@crm_customers.customer_id) + status = customer.update_attributes(membership_id: response["customer_datas"]["id"],membership_type:member_group_id ) + + if params[:sale_id] + format.html { redirect_to '/origami/'+params[:sale_id]+'/customers', notice: 'Customer was successfully created.' } + else + format.html { redirect_to crm_customers_path, notice: 'Customer was successfully created'} + end + # format.json { render :index, status: :created, location: @crm_customers } else - format.html { redirect_to crm_customers_path, notice: response["message"] } + # @crm_customers.destroy + if params[:sale_id] + format.html { redirect_to '/origami/'+params[:sale_id]+'/customers'} + else + format.html { redirect_to crm_customers_path, notice: response["message"] } + end end end else @@ -139,7 +140,6 @@ class Crm::CustomersController < BaseCrmController end end - # PATCH/PUT /crm/customers/1 # PATCH/PUT /crm/customers/1.json def update @@ -151,30 +151,80 @@ end phone = customer_params[:contact_no] email = customer_params[:email] dob = customer_params[:date_of_birth] + address = customer_params[:address] + nrc = customer_params[:nrc_no] + card_no = customer_params[:card_no] id = @crm_customer.membership_id member_group_id = params[:member_group_id] - membership = MembershipSetting.find_by_membership_type("paypar_url") - memberaction = MembershipAction.find_by_membership_type("update_membership_customer") - merchant_uid = memberaction.merchant_account_id.to_s - auth_token = memberaction.auth_token.to_s - url = membership.gateway_url.to_s + memberaction.gateway_url.to_s - - response = HTTParty.post(url, :body => { name: name,phone: phone,email: email, - dob: dob, - id: id,member_group_id:member_group_id,merchant_uid:merchant_uid,auth_token:auth_token}.to_json, - :headers => { - 'Content-Type' => 'application/json', - 'Accept' => 'application/json' - } - ) + if id.nil? && !member_group_id.nil? - format.html { redirect_to crm_customers_path, notice: 'Customer was successfully updated.' } - format.json { render :show, status: :ok, location: @crm_customer } + membership = MembershipSetting.find_by_membership_type("paypar_url") + memberaction = MembershipAction.find_by_membership_type("create_membership_customer") + merchant_uid = memberaction.merchant_account_id.to_s + auth_token = memberaction.auth_token.to_s + url = membership.gateway_url.to_s + memberaction.gateway_url.to_s + + begin + response = HTTParty.post(url, + :body => { name: name,phone: phone,email: email, + dob: dob,address: address,nrc:nrc, + card_no:card_no,member_group_id: member_group_id, + merchant_uid:merchant_uid,auth_token:auth_token}.to_json, + :headers => { + 'Content-Type' => 'application/json', + 'Accept' => 'application/json' + }, + :timeout => 10 + ) + rescue Net::OpenTimeout + response = { status: false } + end + + if response["status"] == true + + customer = Customer.find(@crm_customer.customer_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'} + else + format.html { redirect_to crm_customers_path, notice: response["message"] } + end + + else + + membership = MembershipSetting.find_by_membership_type("paypar_url") + memberaction = MembershipAction.find_by_membership_type("update_membership_customer") + merchant_uid = memberaction.merchant_account_id.to_s + auth_token = memberaction.auth_token.to_s + url = membership.gateway_url.to_s + memberaction.gateway_url.to_s + begin + response = HTTParty.post(url, + :body => {name: name,phone: phone,email: email, + 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, + :headers => { + 'Content-Type' => 'application/json', + 'Accept' => 'application/json' + }, + :timeout => 10 + ) + rescue Net::OpenTimeout + response = { status: false } + end + + if response["status"] == true + format.html { redirect_to crm_customers_path, notice: 'Customer was successfully updated.' } + format.json { render :show, status: :ok, location: @crm_customer } + else + format.html { redirect_to crm_customers_path, notice: response["message"] } + end + + end else - flash[:errors] = @crm_customers.errors + flash[:errors] = @crm_customer.errors format.html { redirect_to crm_customers_path} format.json { render json: @crm_customer.errors, status: :unprocessable_entity } end @@ -201,6 +251,7 @@ end # Never trust parameters from the scary internet, only allow the white list through. def customer_params - params.require(:customer).permit(:name, :company, :contact_no, :email, :date_of_birth) + params.require(:customer).permit(:name, :company, :contact_no, :email, + :date_of_birth,:salutation,:gender,:nrc_no,:address,:card_no) end end diff --git a/app/controllers/crm/dining_queues_controller.rb b/app/controllers/crm/dining_queues_controller.rb index 251b0781..b4f902fc 100644 --- a/app/controllers/crm/dining_queues_controller.rb +++ b/app/controllers/crm/dining_queues_controller.rb @@ -1,4 +1,5 @@ class Crm::DiningQueuesController < BaseCrmController + load_and_authorize_resource before_action :set_dining_queue, only: [:show, :edit, :update, :destroy] # GET /crm/dining_queues @@ -84,12 +85,15 @@ class Crm::DiningQueuesController < BaseCrmController queue = DiningQueue.find(params[:id]) table_id = params[:table_id] - queue.update_attributes(dining_facility_id: table_id,status:"Assign") - DiningFacility.find(table_id).update_attributes(status: "occupied") - respond_to do |format| - format.html { redirect_to crm_dining_queues_path, notice: 'Table was successfully assigned.' } - format.json { head :no_content } - end + status = queue.update_attributes(dining_facility_id: table_id,status:"Assign") + status = DiningFacility.find(table_id).update_attributes(status: "occupied") + + + if status == true + render json: JSON.generate({:status => true , notice: 'Dining queue was successfully assigned .'}) + else + render json: JSON.generate({:status => false, :error_message => "Record not found"}) + end end @@ -101,6 +105,6 @@ class Crm::DiningQueuesController < BaseCrmController # Never trust parameters from the scary internet, only allow the white list through. def dining_queue_params - params.require(:dining_queue).permit(:name, :contact_no, :queue_no,:status) + params.require(:dining_queue).permit(:name, :contact_no, :queue_no,:status,:seater,:remark) end end diff --git a/app/controllers/crm/home_controller.rb b/app/controllers/crm/home_controller.rb index c05e7cf3..6866ddf1 100644 --- a/app/controllers/crm/home_controller.rb +++ b/app/controllers/crm/home_controller.rb @@ -1,12 +1,12 @@ class Crm::HomeController < BaseCrmController def index - @booking = Booking.all - @customer = Customer.all - from = Time.now.beginning_of_day.utc - to = Time.now.end_of_day.utc - @queue = DiningQueue.where('created_at BETWEEN ? AND ?', from, to).order('queue_no ASC') - + # @booking = Booking.all + # @customer = Customer.all + # from = Time.now.beginning_of_day.utc + # to = Time.now.end_of_day.utc + # @queue = DiningQueue.where('created_at BETWEEN ? AND ?', from, to).order('queue_no ASC') + redirect_to crm_customers_path # .where("dining_facilities.is_active=? and orders.date between ? and ?",true,from,to) end diff --git a/app/controllers/home_controller.rb b/app/controllers/home_controller.rb index 29e9082a..84d72f66 100644 --- a/app/controllers/home_controller.rb +++ b/app/controllers/home_controller.rb @@ -1,10 +1,34 @@ class HomeController < ApplicationController - skip_before_action :authenticate, only: [:index, :create, :destroy] + skip_before_action :authenticate, only: [:index, :show, :create, :update, :destroy] def index + @employees = Employee.all_emp_except_waiter.order("name asc") @login_form = LoginForm.new() end + def show + @login_form = LoginForm.new() + @login_form.emp_id = params[:emp_id] + end + + def update + @login_form = LoginForm.new() + @login_form.emp_id = params[:emp_id] + @login_form.password = params[:login_form][:password] + @employee = Employee.login(@login_form.emp_id, @login_form.password) + + if @employee != nil + session[:session_token] = @employee.token_session + + #if cashier => already opening cahshier? + + redirect_to origami_root_path + route_by_role(@employee) + else + render :show, flash[:notice] => "Invalid PIN for Employee. Please try again!" + end + end + def create @login_form = LoginForm.new() @login_form.emp_id = params[:login_form][:emp_id] @@ -18,12 +42,18 @@ class HomeController < ApplicationController elsif @employee.role == "cashier" session[:session_token] = @employee.token_session redirect_to origami_root_path + elsif @employee.role == "manager" + session[:session_token] = @employee.token_session + redirect_to dashboard_path + elsif @employee.role == "accountant" + session[:session_token] = @employee.token_session + redirect_to dashboard_path else render :index end - else + else redirect_to origami_root_path, :notice => "Username and Password dosn't match!" - end + end end @@ -48,4 +78,25 @@ class HomeController < ApplicationController def settings_home_params params.require(:login_form).permit(:emp_id, :password) 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 + + # if !ShiftSale.current_open_shift(employee).nil? + # redirect_to origami_root_path + # else + redirect_to new_origami_shift_path + # end + elsif employee.role == "checker" + 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 diff --git a/app/controllers/oqs/edit_controller.rb b/app/controllers/oqs/edit_controller.rb new file mode 100644 index 00000000..d2236caa --- /dev/null +++ b/app/controllers/oqs/edit_controller.rb @@ -0,0 +1,18 @@ +class Oqs::EditController < BaseOqsController + def index + assigned_item_id = params[:id] + assigned_item = AssignedOrderItem.find(assigned_item_id) + @order_item = OrderItem.where("order_id='#{ assigned_item.order_id }' AND item_code='#{ assigned_item.item_code }'"); + end + + def update + order_items_id = params[:order_items_id] + qty_weight = params[:qty_weight] + remarks = params[:remarks] + + order_item = OrderItem.find(order_items_id); + order_item.qty = qty_weight + order_item.remark = remarks + order_item.save + end +end diff --git a/app/controllers/oqs/home_controller.rb b/app/controllers/oqs/home_controller.rb index 58aac67c..0d4d07dc 100644 --- a/app/controllers/oqs/home_controller.rb +++ b/app/controllers/oqs/home_controller.rb @@ -2,9 +2,11 @@ class Oqs::HomeController < BaseOqsController def index queue_stations=OrderQueueStation.all - @queue_items_details = queue_items_query(0) + # Query for OQS with delivery status false + @queue_items_details = queue_items_query(false) - @queue_completed_item = queue_items_query(1) + # Query for OQS with delivery status true + @queue_completed_item = queue_items_query(true) @queue_stations_items=Array.new @@ -30,14 +32,14 @@ class Oqs::HomeController < BaseOqsController dining = DiningFacility.find_by_name(table_name); # oqpz = OrderQueueProcessByZone.find_by_zone_id(dining.zone_id) # if status == "" - # AssignedOrderItem.where("order_queue_station_id=#{ oqpz.order_queue_station_id } AND delivery_status=0").find_each do |aoi| - # oi = OrderItem.find_by_item_code(aoi.item_code) - # items.push(oi) + # AssignedOrderItem.where("order_queue_station_id=#{ oqpz.order_queue_station_id } AND delivery_status=0").find_each do |aoi| + # oi = OrderItem.find_by_item_code(aoi.item_code) + # items.push(oi) # end # else - # AssignedOrderItem.where("order_queue_station_id=#{ oqpz.order_queue_station_id } AND delivery_status=1").find_each do |aoi| - # oi = OrderItem.find_by_item_code(aoi.item_code) - # items.push(oi) + # AssignedOrderItem.where("order_queue_station_id=#{ oqpz.order_queue_station_id } AND delivery_status=1").find_each do |aoi| + # oi = OrderItem.find_by_item_code(aoi.item_code) + # items.push(oi) # end # end @@ -49,7 +51,7 @@ class Oqs::HomeController < BaseOqsController end end - # booking_id = dining.get_new_booking + # booking_id = dining.get_new_booking # BookingOrder.where("booking_id='#{ booking_id }'").find_each do |bo| # order=Order.find(bo.order_id); # order.order_items.each do |oi| @@ -79,27 +81,43 @@ class Oqs::HomeController < BaseOqsController render :json => removed_item.to_json end - # Query for OQS with status - def queue_items_query(status) - # AssignedOrderItem.select("assigned_order_items.assigned_order_item_id, oqs.station_name, oqs.is_active, df.name as zone, odt.item_code, odt.item_name, odt.price, odt.qty, odt.item_order_by, cus.name as customer_name, odt.created_at") - # .joins(" left join order_queue_process_by_zones as oqpz ON oqpz.order_queue_station_id = assigned_order_items.order_queue_station_id - # left join dining_facilities as df on df.zone_id = oqpz.zone_id - # left join order_queue_stations as oqs ON oqs.id = assigned_order_items.order_queue_station_id - # left join orders as od ON od.order_id = assigned_order_items.order_id - # left join order_items as odt ON odt.item_code = assigned_order_items.item_code - # left join customers as cus ON cus.customer_id = od.customer_id") - # .where("assigned_order_items.delivery_status = #{status}") - # .group("assigned_order_items.assigned_order_item_id") - # .order("odt.item_name DESC") - AssignedOrderItem.select("assigned_order_items.assigned_order_item_id, oqs.station_name, oqs.is_active, df.name as zone, odt.item_code, odt.item_name, odt.price, odt.qty, odt.item_order_by, cus.name as customer_name, odt.created_at") + # Query for OQS with delivery status + def queue_items_query(status) + # queue_items = [] + # AssignedOrderItem.all.each do |aoi| + # oqs = OrderQueueStation.find(aoi.order_queue_station_id) + # order = Order.find(aoi.order_id) + # order_items = OrderItem.find_by_order_id(aoi.order_id) + # booking_orders = BookingOrder.find_by_order_id(aoi.order_id) + # booking = Booking.find(booking_orders.booking_id) + # dining = DiningFacility.find(booking.dining_facility_id) + # customer = Customer.find_by_customer_id(order.customer_id) + # queue_item = { + # :assigned_order_item_id => aoi.assigned_order_item_id, + # :station_name => oqs.station_name, + # :is_active => oqs.is_active, + # :zone => dining.name, + # :item_code => aoi.item_code, + # :item_name => order_items.item_name, + # :price => order_items.price, + # :qty => order_items.qty, + # :item_order_by => order_items.item_order_by, + # :options => order_items.options, + # :customer_name => customer.name, + # :created_at => order_items.created_at + # } + # queue_items.push(queue_item) + # end + # return queue_items + AssignedOrderItem.select("assigned_order_items.assigned_order_item_id, oqs.station_name, oqs.is_active, df.name as zone, df.type, odt.order_id, odt.item_code, odt.item_name, odt.price, odt.qty, odt.item_order_by, odt.options, cus.name as customer_name, odt.created_at") .joins(" left join order_queue_stations as oqs on oqs.id = assigned_order_items.order_queue_station_id left join orders as od ON od.order_id = assigned_order_items.order_id - left join order_items as odt ON odt.item_code = assigned_order_items.item_code + left join order_items as odt ON odt.item_code = assigned_order_items.item_code AND odt.order_id = assigned_order_items.order_id left join customers as cus ON cus.customer_id = od.customer_id left join booking_orders as bo on bo.order_id = assigned_order_items.order_id left join bookings as bk on bk.booking_id = bo.booking_id left join dining_facilities as df on df.id = bk.dining_facility_id") - .where("assigned_order_items.delivery_status = #{status}") + .where("assigned_order_items.delivery_status = #{status} AND odt.price <> 0") .group("assigned_order_items.assigned_order_item_id") end end diff --git a/app/controllers/oqs/print_controller.rb b/app/controllers/oqs/print_controller.rb index 9fc2a2d7..f3fd5675 100644 --- a/app/controllers/oqs/print_controller.rb +++ b/app/controllers/oqs/print_controller.rb @@ -2,17 +2,21 @@ class Oqs::PrintController < ApplicationController # Print Order Item def print unique_code="OrderItemPdf" - assigned_item_id=params[:id] - assigned_item=AssignedOrderItem.find(assigned_item_id) - assigned_items=AssignedOrderItem.where("item_code='" + assigned_item.item_code + "' AND " + "order_id='" + assigned_item.order_id + "'"); + assigned_item_id = params[:id] + options = params[:options] + assigned_item = AssignedOrderItem.find(assigned_item_id) + assigned_items = AssignedOrderItem.where("item_code='" + assigned_item.item_code + "' AND " + "order_id='" + assigned_item.order_id + "'"); # order queue stations oqs = assigned_item.order_queue_station + # Check Printed + print_status = assigned_item.print_status == true ? " (Re-Print)" : "" + # print when complete click - print_settings=PrintSetting.find_by_unique_code(unique_code) - order_queue_printer= Printer::OrderQueuePrinter.new(print_settings) - order_queue_printer.print_order_item(oqs,assigned_item.order_id, assigned_item.item_code ) + print_settings = PrintSetting.find_by_unique_code(unique_code) + 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 ) # update print status for completed same order items assigned_items.each do |ai| @@ -21,24 +25,32 @@ class Oqs::PrintController < ApplicationController end end - # Print Order Details + # Print Order Details with booking id def print_order_summary unique_code="OrderSummaryPdf" - assigned_item_id=params[:id] - assigned_item=AssignedOrderItem.find(assigned_item_id) - assigned_items=AssignedOrderItem.where("item_code='" + assigned_item.item_code + "' AND " + "order_id='" + assigned_item.order_id + "'"); + assigned_item_id = params[:id] + table_name = params[:table_name] + assigned_item = AssignedOrderItem.find(assigned_item_id) + assigned_items = AssignedOrderItem.where("item_code='" + assigned_item.item_code + "' AND " + "order_id='" + assigned_item.order_id + "'"); # order queue stations oqs = assigned_item.order_queue_station + + # Check Printed + print_status = assigned_item.print_status == true ? " (Re-Print)" : "" + + # get dining + dining = DiningFacility.find_by_name(table_name); + booking = Booking.find_by_dining_facility_id(dining.id) # print when complete click - print_settings=PrintSetting.find_by_unique_code(unique_code) - order_queue_printer= Printer::OrderQueuePrinter.new(print_settings) - order_queue_printer.print_order_summary(oqs,assigned_item.order_id) + print_settings = PrintSetting.find_by_unique_code(unique_code) + order_queue_printer = Printer::OrderQueuePrinter.new(print_settings) + order_queue_printer.print_booking_summary(oqs, booking.booking_id, print_status) # update print status for completed same order items assigned_items.each do |ai| - ai.print_status=true + ai.print_status = true ai.save end end diff --git a/app/controllers/origami/cash_mgmt_controller.rb b/app/controllers/origami/cash_mgmt_controller.rb new file mode 100644 index 00000000..aaf55c1f --- /dev/null +++ b/app/controllers/origami/cash_mgmt_controller.rb @@ -0,0 +1,10 @@ +class Origami::CashMgmtController < ApplicationController + def index + end + + def new + end + + def create + end +end diff --git a/app/controllers/origami/credit_payments_controller.rb b/app/controllers/origami/credit_payments_controller.rb index a348951e..ff9ae413 100644 --- a/app/controllers/origami/credit_payments_controller.rb +++ b/app/controllers/origami/credit_payments_controller.rb @@ -2,9 +2,31 @@ class Origami::CreditPaymentsController < BaseOrigamiController def index + @sale_id = params[:sale_id] + + # limit visa_amount + sale_data = Sale.find_by_sale_id(@sale_id) + total = sale_data.grand_total + @creditcount = 0 + others = 0 + sale_data.sale_payments.each do |sale_payment| + if sale_payment.payment_method == "visa" + @creditcount = @creditcount + sale_payment.payment_amount + else + others = others + sale_payment.payment_amount + end + end + @can_credit = total - @creditcount - others end def create + cash = params[:amount] + sale_id = params[:sale_id] + if(Sale.exists?(sale_id)) + saleObj = Sale.find(sale_id) + sale_payment = SalePayment.new + @status, @sale = sale_payment.process_payment(saleObj, @user, cash, "creditnote") + end end end diff --git a/app/controllers/origami/customers_controller.rb b/app/controllers/origami/customers_controller.rb index 601055e5..e8376fc4 100644 --- a/app/controllers/origami/customers_controller.rb +++ b/app/controllers/origami/customers_controller.rb @@ -1,8 +1,6 @@ class Origami::CustomersController < BaseOrigamiController - #Form to add customer - + load_and_authorize_resource def index - - end # GET /crm/customers/1 @@ -12,8 +10,17 @@ class Origami::CustomersController < BaseOrigamiController def add_customer - @sale_id = params[:sale_id] - filter = params[:filter] + @sale_id = params[:sale_id] + if(@sale_id[0,3] == "SAL") + @booking = Booking.find_by_sale_id(@sale_id) + @dining_facility = DiningFacility.find(@booking.dining_facility_id) + else + @booking_order = BookingOrder.find_by_order_id(@sale_id) + @booking = Booking.find(@booking_order.booking_id) + @dining_facility = DiningFacility.find(@booking.dining_facility_id) + end + + filter = params[:filter] filter = params[:filter] @@ -39,5 +46,33 @@ class Origami::CustomersController < BaseOrigamiController end end + def update_sale_by_customer + + id = params[:sale_id][0,3] + if(id == "SAL") + sale = Sale.find(params[:sale_id]) + status = sale.update_attributes(customer_id: params[:customer_id]) + sale.sale_orders.each do |sale_order| + order = Order.find(sale_order.order_id) + status = order.update_attributes(customer_id: params[:customer_id]) + end + else + @booking = BookingOrder.find_by_order_id(params[:sale_id]) + @orders = BookingOrder.where("booking_id = ? ", @booking.booking_id) + + @orders.each do |bo| + order = Order.find(bo.order_id) + status = order.update_attributes(customer_id: params[:customer_id]) + end + + end + + if status == true + render json: JSON.generate({:status => true}) + else + render json: JSON.generate({:status => false, :error_message => "Record not found"}) + end + end + end diff --git a/app/controllers/origami/discounts_controller.rb b/app/controllers/origami/discounts_controller.rb index f5f7db9e..463f6dc6 100644 --- a/app/controllers/origami/discounts_controller.rb +++ b/app/controllers/origami/discounts_controller.rb @@ -1,4 +1,5 @@ class Origami::DiscountsController < BaseOrigamiController + authorize_resource :class => false #discount page show from origami index with selected order def index @@ -6,52 +7,96 @@ class Origami::DiscountsController < BaseOrigamiController if Sale.exists?(sale_id) @sale_data = Sale.find(sale_id) end + + @accounts = Account.all + end + + #discount page show from origami index with selected order + def create + sale_id = params[:sale_id] + discount_items = JSON.parse(params[:discount_items]) + overall_discount = params[:overall_discount] + 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_discount = overall_discount.to_f + sale.total_amount = sub_total.to_f + sale.grand_total = (sub_total.to_f - overall_discount.to_f) + sale.total_tax; + sale.save + if discount_items.length > 0 + #save sale item for discount + discount_items.each do |di| + puts di + origin_sale_item = SaleItem.find(di["id"]) + sale_item = SaleItem.new + + sale_item.sale_id = sale_id + sale_item.product_code = origin_sale_item != nil ? origin_sale_item.product_code : sale_id + sale_item.product_name = di["name"] + sale_item.remark = "Discount" + + 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 #discount for selected order - def create - sale_id = params[:sale_id] - sale_item_id = params[:sale_item_id] - discount_type = params[:discount_type] - discount_value = params[:discount_value] - discount_amount = params[:discount_amount] - grand_total = params[:grand_total] - product_name = "Overall Discount" + # def create + # sale_id = params[:sale_id] + # sale_item_id = params[:sale_item_id] + # discount_type = params[:discount_type] + # discount_value = params[:discount_value] + # discount_amount = params[:discount_amount] + # grand_total = params[:grand_total] + # product_name = "Overall Discount" - if discount_type == 0 - remark="Discount " + discount_amount + " as net" - else - remark="Discount " + discount_amount + " as percentage" - end + # if discount_type == 0 + # remark="Discount " + discount_amount + " as net" + # else + # remark="Discount " + discount_amount + " as percentage" + # end - #update discount for sale - sale = Sale.find(sale_id) - sale.total_discount = sale.total_discount + discount_amount.to_f - sale.grand_total = grand_total - sale.save + # #update discount for sale + # sale = Sale.find(sale_id) + # sale.total_discount = sale.total_discount + discount_amount.to_f + # sale.grand_total = grand_total + # sale.save - #save sale item for discount - if sale_item_id != nil - origin_sale_item = SaleItem.find(sale_item_id) - product_name = origin_sale_item.product_name + "-Disocunt" - end - sale_item = SaleItem.new + # #save sale item for discount + # if sale_item_id != nil + # origin_sale_item = SaleItem.find(sale_item_id) + # product_name = origin_sale_item.product_name + "-Disocunt" + # end + # sale_item = SaleItem.new - #pull - sale_item.sale_id = sale_id - sale_item.product_code = origin_sale_item != nil ? origin_sale_item.product_code : sale_id - sale_item.product_name = product_name - sale_item.remark = remark + # #pull + # sale_item.sale_id = sale_id + # sale_item.product_code = origin_sale_item != nil ? origin_sale_item.product_code : sale_id + # sale_item.product_name = product_name + # sale_item.remark = remark - sale_item.qty = 1 - sale_item.unit_price = (0-discount_amount.to_f) - sale_item.taxable_price = discount_amount - sale_item.is_taxable = 0 + # sale_item.qty = 1 + # sale_item.unit_price = (0-discount_amount.to_f) + # sale_item.taxable_price = discount_amount + # sale_item.is_taxable = 0 - sale_item.price = sale_item.qty * sale_item.unit_price - sale_item.save + # sale_item.price = sale_item.qty * sale_item.unit_price + # sale_item.save - redirect_to origami_path(sale_id) - end + # redirect_to origami_path(sale_id) + # end end diff --git a/app/controllers/origami/home_controller.rb b/app/controllers/origami/home_controller.rb index 1aca9b2d..1b0aa491 100644 --- a/app/controllers/origami/home_controller.rb +++ b/app/controllers/origami/home_controller.rb @@ -1,84 +1,59 @@ class Origami::HomeController < BaseOrigamiController + before_action :set_dining, only: [:show] + def index - if params[:booking_id] != nil - type=params[:booking_id].split('-')[0]; - # Sale - if type == "SAL" - @selected_item = Sale.find(params[:booking_id]) - @selected_item_type="Sale" - # Booking - else - @selected_item = Order.find(params[:booking_id]) - @selected_item_type="Order" - end - end - - @completed_orders = Order.get_completed_order() - @booking_orders = Order.get_booking_order_table() - @booking_rooms = Order.get_booking_order_rooms() - @orders = Order.get_orders() + @tables = Table.all.active.order('status desc') + @rooms = Room.all.active.order('status desc') + @complete = Sale.all + @orders = Order.all.order('date desc') end - def item_show - selection(params[:booking_id],1) - end + # origami table detail + def show + @tables = Table.all.active.order('status desc') + @rooms = Room.all.active.order('status desc') + @complete = Sale.all + @orders = Order.all.order('date desc') + @status_order = "" + @status_sale = "" + @sale_array = Array.new - def selection(selected_id, is_ajax) - str = [] - type=selected_id.split('-')[0]; - # Sale - if type == "SAL" - @order_details = SaleItem.get_order_items_details(params[:booking_id]) - @order_details.each do |ord_detail| - str.push(ord_detail) - end - # Booking - else - @order_details = OrderItem.get_order_items_details(params[:booking_id]) - @order_details.each do |ord_detail| - str.push(ord_detail) - end - end - - if is_ajax == 1 - render :json => str.to_json - else - str - end - end - - def update_sale_by_customer - - id = params[:sale_id][0,3] - if(id == "SAL") - sale = Sale.find(params[:sale_id]) - else - sale = Order.find(params[:sale_id]) - end - - status = sale.update_attributes(customer_id: params[:customer_id]) - - if status == true - render json: JSON.generate({:status => true}) - else - render json: JSON.generate({:status => false, :error_message => "Record not found"}) - - end - end - - def get_customer - - @customer = Customer.find(params[:customer_id]) - - response = Customer.get_member_account(@customer) - - respond_to do |format| - format.js do - render :json => { - :response_data => response.as_json, - :customer => @customer} - end + @dining.bookings.active.each do |booking| + if booking.sale_id.nil? && booking.booking_status != 'moved' + @order_items = Array.new + booking.booking_orders.each do |booking_order| + order = Order.find(booking_order.order_id) + if (order.status == "new") + @obj_order = order + @customer = order.customer + @date = order.created_at + order.order_items.each do |item| + @order_items.push(item) + end + end + end + @status_order = 'order' + else + sale = Sale.find(booking.sale_id) + if sale.sale_status != "completed" && sale.sale_status != 'void' + puts "enter" + @sale_array.push(sale) + if @status_order == 'order' + @status_order = 'sale' + end + @date = sale.created_at + @status_sale = 'sale' + @obj_sale = sale + @customer = sale.customer + end + end end end +private + +def set_dining + @dining = DiningFacility.find(params[:dining_id]) +end + end diff --git a/app/controllers/origami/home_controller_bk.rb b/app/controllers/origami/home_controller_bk.rb new file mode 100644 index 00000000..1aca9b2d --- /dev/null +++ b/app/controllers/origami/home_controller_bk.rb @@ -0,0 +1,84 @@ +class Origami::HomeController < BaseOrigamiController + def index + if params[:booking_id] != nil + type=params[:booking_id].split('-')[0]; + # Sale + if type == "SAL" + @selected_item = Sale.find(params[:booking_id]) + @selected_item_type="Sale" + # Booking + else + @selected_item = Order.find(params[:booking_id]) + @selected_item_type="Order" + end + end + + @completed_orders = Order.get_completed_order() + @booking_orders = Order.get_booking_order_table() + @booking_rooms = Order.get_booking_order_rooms() + @orders = Order.get_orders() + end + + def item_show + selection(params[:booking_id],1) + end + + def selection(selected_id, is_ajax) + str = [] + type=selected_id.split('-')[0]; + # Sale + if type == "SAL" + @order_details = SaleItem.get_order_items_details(params[:booking_id]) + @order_details.each do |ord_detail| + str.push(ord_detail) + end + # Booking + else + @order_details = OrderItem.get_order_items_details(params[:booking_id]) + @order_details.each do |ord_detail| + str.push(ord_detail) + end + end + + if is_ajax == 1 + render :json => str.to_json + else + str + end + end + + def update_sale_by_customer + + id = params[:sale_id][0,3] + if(id == "SAL") + sale = Sale.find(params[:sale_id]) + else + sale = Order.find(params[:sale_id]) + end + + status = sale.update_attributes(customer_id: params[:customer_id]) + + if status == true + render json: JSON.generate({:status => true}) + else + render json: JSON.generate({:status => false, :error_message => "Record not found"}) + + end + end + + def get_customer + + @customer = Customer.find(params[:customer_id]) + + response = Customer.get_member_account(@customer) + + respond_to do |format| + format.js do + render :json => { + :response_data => response.as_json, + :customer => @customer} + end + end + end + +end diff --git a/app/controllers/origami/moveroom_controller.rb b/app/controllers/origami/moveroom_controller.rb new file mode 100644 index 00000000..ef1c286a --- /dev/null +++ b/app/controllers/origami/moveroom_controller.rb @@ -0,0 +1,39 @@ +class Origami::MoveroomController < BaseOrigamiController + + authorize_resource :class => false + + def move_dining + @tables = Table.all.active.order('status desc') + @rooms = Room.all.active.order('status desc') + @complete = Sale.all + @orders = Order.all.order('date desc') + + @status_order = "" + @dining = DiningFacility.find(params[:dining_id]) + @dining.bookings.each do |booking| + if booking.sale_id.nil? + @order_items = Array.new + booking.booking_orders.each do |booking_order| + order = Order.find(booking_order.order_id) + @obj_order = order + @date = order.created_at + order.order_items.each do |item| + @order_items.push(item) + end + end + @status_order = 'order' + else + sale = Sale.find(booking.sale_id) + if sale.sale_status != "completed" + if @status_order == 'order' + @status_order = 'sale' + end + @date = sale.created_at + @status_sale = 'sale' + @obj_sale = sale + end + end + end + end + +end diff --git a/app/controllers/origami/movetable_controller.rb b/app/controllers/origami/movetable_controller.rb new file mode 100644 index 00000000..50f2c774 --- /dev/null +++ b/app/controllers/origami/movetable_controller.rb @@ -0,0 +1,55 @@ +class Origami::MovetableController < BaseOrigamiController + + authorize_resource :class => false + + def move_dining + @tables = Table.all.active.order('status desc') + @rooms = Room.all.active.order('status desc') + @complete = Sale.all + @orders = Order.all.order('date desc') + @dining = DiningFacility.find(params[:dining_id]) + + @status_order = "" + @status_sale = "" + @sale_array = Array.new + @dining.bookings.each do |booking| + if booking.sale_id.nil? + @order_items = Array.new + booking.booking_orders.each do |booking_order| + + order = Order.find(booking_order.order_id) + @obj_order = order + @date = order.created_at + order.order_items.each do |item| + @order_items.push(item) + end + end + @status_order = 'order' + else + sale = Sale.find(booking.sale_id) + if sale.sale_status != "completed" + @sale_array.push(sale) + if @status_order == 'order' + @status_order = 'sale' + end + @date = sale.created_at + @status_sale = 'sale' + @obj_sale = sale + end + end + end + end + + def moving + change_to = params[:change_to] #new + change_from = params[:change_from] #original + bookings = Booking.where('dining_facility_id=?',change_from) + booking_array = Array.new + bookings.each do | booking | + if booking.sale_id.nil? || booking.sale.sale_status != 'completed' || booking.booking_status != 'moved' + booking_array.push(booking) + end + end + @get_type = Booking.update_dining_facility(booking_array,change_to,change_from) + end +end diff --git a/app/controllers/origami/orders_controller.rb b/app/controllers/origami/orders_controller.rb new file mode 100644 index 00000000..ef213ddd --- /dev/null +++ b/app/controllers/origami/orders_controller.rb @@ -0,0 +1,17 @@ +class Origami::OrdersController < BaseOrigamiController + + def show + @tables = Table.all.active.order('status desc') + @rooms = Room.all.active.order('status desc') + @complete = Sale.all + @orders = Order.all.order('status desc') + @order = Order.find(params[:order_id]) + sale_order = SaleOrder.find_by_order_id(@order.order_id) + if sale_order + unless sale_order.sale_id.nil? + sale = Sale.find(sale_order.sale_id) + @sale_status = sale.sale_status + end + end + end +end diff --git a/app/controllers/origami/payments_controller.rb b/app/controllers/origami/payments_controller.rb index 44de8eb2..f5a0023e 100644 --- a/app/controllers/origami/payments_controller.rb +++ b/app/controllers/origami/payments_controller.rb @@ -1,6 +1,6 @@ class Origami::PaymentsController < BaseOrigamiController - + authorize_resource :class => false def index end @@ -10,21 +10,25 @@ class Origami::PaymentsController < BaseOrigamiController if(Sale.exists?(sale_id)) saleObj = Sale.find(sale_id) sale_payment = SalePayment.new - sale_payment.process_payment(saleObj, @user, cash, "cash") + sale_payment.process_payment(saleObj, @user, cash, "cash") + + rebate_amount = nil unique_code = "ReceiptBillPdf" customer= Customer.find(saleObj.customer_id) - + rebate_amount = Customer.get_membership_transactions(customer) + #shop detail + shop_details = Shop.find(1) # get member information member_info = Customer.get_member_account(customer) # get printer info print_settings=PrintSetting.find_by_unique_code(unique_code) # Calculate Food and Beverage Total - food_total, beverage_total = SaleItem.calculate_food_beverage(saleObj.sale_items) + item_price_by_accounts = SaleItem.calculate_price_by_accounts(saleObj.sale_items) printer = Printer::ReceiptPrinter.new(print_settings) - printer.print_receipt_bill(print_settings,saleObj.sale_items,saleObj,customer.name, food_total, beverage_total, member_info) + printer.print_receipt_bill(print_settings,saleObj.sale_items,saleObj,customer.name, item_price_by_accounts, member_info,rebate_amount,shop_details) end end @@ -37,6 +41,7 @@ class Origami::PaymentsController < BaseOrigamiController @visacount= 0.0 @jcbcount= 0.0 @mastercount = 0.0 + @credit = 0.0 @sale_data = Sale.find_by_sale_id(sale_id) #get customer amount @@ -49,9 +54,10 @@ class Origami::PaymentsController < BaseOrigamiController @accountable_type = '' if response["status"]==true response["data"].each do |res| - if res["accountable_type"] == "RebateAccount" - @balance = res["balance"] - @accountable_type = res["accountable_type"] + if res["accountable_type"] == "RebateAccount" || res["accountable_type"] == "RebatebonusAccount" + @balance += res["balance"] + # @accountable_type = res["accountable_type"] + @accountable_type = "Rebate Balance" end end end @@ -72,6 +78,8 @@ class Origami::PaymentsController < BaseOrigamiController @jcbcount += spay.payment_amount elsif spay.payment_method == "master" @mastercount += spay.payment_amount + elsif spay.payment_method == "creditnote" + @credit += spay.payment_amount end end end @@ -86,17 +94,19 @@ class Origami::PaymentsController < BaseOrigamiController unique_code = "ReceiptBillPdf" customer= Customer.find(saleObj.customer_id) + #shop detail + shop_details = Shop.find(1) # get member information member_info = Customer.get_member_account(customer) - + rebate_amount = Customer.get_membership_transactions(customer) # get printer info print_settings=PrintSetting.find_by_unique_code(unique_code) - # Calculate Food and Beverage Total - food_total, beverage_total = SaleItem.calculate_food_beverage(saleObj.sale_items) + # Calculate price_by_accounts + item_price_by_accounts = SaleItem.calculate_price_by_accounts(saleObj.sale_items) printer = Printer::ReceiptPrinter.new(print_settings) - printer.print_receipt_bill(print_settings,saleObj.sale_items,saleObj,customer.name, food_total, beverage_total, member_info) + printer.print_receipt_bill(print_settings,saleObj.sale_items,saleObj,customer.name, item_price_by_accounts, member_info,rebate_amount,shop_details) end diff --git a/app/controllers/origami/redeem_payments_controller.rb b/app/controllers/origami/redeem_payments_controller.rb index 99601449..802ba51b 100644 --- a/app/controllers/origami/redeem_payments_controller.rb +++ b/app/controllers/origami/redeem_payments_controller.rb @@ -6,7 +6,24 @@ class Origami::RedeemPaymentsController < BaseOrigamiController sale_data = Sale.find_by_sale_id(@sale_id) # limit redeem_amount - food_prices, beverage_prices = SaleItem.calculate_food_beverage(sale_data.sale_items) + # rebate_prices = SaleItem.calculate_food_beverage(sale_data.sale_items) + # nonrebate_prices = sale_data.total_amount - rebate_prices + # @payparcount = 0 + # others = 0 + # sale_data.sale_payments.each do |sale_payment| + # if sale_payment.payment_method == "paypar" + # @payparcount = @payparcount + sale_payment.payment_amount + # else + # others = others + sale_payment.payment_amount + # end + # end + # non_rebate_exceed = others - (nonrebate_prices + sale_data.total_tax) + # if non_rebate_exceed < 0 + # @redeem_prices = rebate_prices - @payparcount + # else + # @redeem_prices = rebate_prices - @payparcount -non_rebate_exceed + # end + @payparcount = 0 others = 0 sale_data.sale_payments.each do |sale_payment| @@ -16,12 +33,8 @@ class Origami::RedeemPaymentsController < BaseOrigamiController others = others + sale_payment.payment_amount end end - is_bervage_exceed = others - (beverage_prices + sale_data.total_tax) - if is_bervage_exceed < 0 - @food_prices = food_prices - @payparcount - else - @food_prices = food_prices - @payparcount -is_bervage_exceed - end + @redeem_prices = sale_data.grand_total - @payparcount -others + if sale_data if sale_data.customer_id diff --git a/app/controllers/origami/request_bills_controller.rb b/app/controllers/origami/request_bills_controller.rb index e848366c..314835a2 100644 --- a/app/controllers/origami/request_bills_controller.rb +++ b/app/controllers/origami/request_bills_controller.rb @@ -1,11 +1,13 @@ class Origami::RequestBillsController < BaseOrigamiController + # Print Request Bill and add to sale tables def print @sale = Sale.new sale_order=SaleOrder.new - booking_id = params[:id] - check_booking = Booking.find_by_booking_id(booking_id) + order_id = params[:id] # order_id + bk_order = BookingOrder.find_by_order_id(order_id) + check_booking = Booking.find_by_booking_id(bk_order.booking_id) if check_booking.sale_id.nil? # Create Sale if it doesn't exist puts "current_login_employee" @@ -19,19 +21,25 @@ class Origami::RequestBillsController < BaseOrigamiController end unique_code = "ReceiptBillPdf" - customer= Customer.where('customer_id=' + @sale_data.customer_id) - + #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 Food and Beverage Total - food_total, beverage_total = SaleItem.calculate_food_beverage(@sale_items) + # 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, food_total, beverage_total) - 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) + # redirect_to origami_path(@sale_data.sale_id) + end end diff --git a/app/controllers/origami/room_invoices_controller.rb b/app/controllers/origami/room_invoices_controller.rb new file mode 100644 index 00000000..8d805771 --- /dev/null +++ b/app/controllers/origami/room_invoices_controller.rb @@ -0,0 +1,40 @@ +class Origami::RoomInvoicesController < BaseOrigamiController + def index + @room = DiningFacility.find(params[:room_id]) + puts "room bookig lenght" + @sale_array = Array.new + @room.bookings.each do |booking| + puts booking.sale_id + + if booking.sale_id.nil? + else + sale = Sale.find(booking.sale_id) + + if sale.sale_status != "completed" + @sale_array.push(sale) + end + end + end + end + + def show + @room = DiningFacility.find(params[:room_id]) + @sale_array = Array.new + @room.bookings.each do |booking| + if booking.sale_id.nil? + else + sale = Sale.find(booking.sale_id) + + if sale.sale_status != "completed" + @sale_array.push(sale) + end + end + end + + @sale = Sale.find(params[:invoice_id]) + @date = @sale.created_at + @status_sale = 'sale' + @customer = @sale.customer + end + +end diff --git a/app/controllers/origami/rooms_controller.rb b/app/controllers/origami/rooms_controller.rb new file mode 100644 index 00000000..c25e0e1f --- /dev/null +++ b/app/controllers/origami/rooms_controller.rb @@ -0,0 +1,35 @@ +class Origami::RoomsController < BaseOrigamiController + + def show + @tables = Table.all.active.order('status desc') + @rooms = Room.all.active.order('status desc') + @complete = Sale.all + @orders = Order.all.order('date desc') + @room = DiningFacility.find(params[:room_id]) + @room.bookings.each do |booking| + if booking.sale_id.nil? + @order_items = Array.new + + booking.booking_orders.each do |booking_order| + order = Order.find(booking_order.order_id) + @obj = order + @customer = order.customer + order.order_items.each do |item| + @order_items.push(item) + end + end + @status = 'order' + else + + sale = Sale.find(booking.sale_id) + if sale.sale_status != "completed" + @status = 'sale' + @obj = sale + @customer = sale.customer + end + end + end + end + + +end diff --git a/app/controllers/origami/sale_edit_controller.rb b/app/controllers/origami/sale_edit_controller.rb new file mode 100644 index 00000000..70a5a380 --- /dev/null +++ b/app/controllers/origami/sale_edit_controller.rb @@ -0,0 +1,58 @@ +class Origami::SaleEditController < BaseOrigamiController + + # 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.product_name = saleitemObj.product_name + " - void" + @newsaleitem.save + 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 + 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 + end + + def apply_void + sale_id = params[:sale_id] + saleObj = Sale.find(sale_id) + saleObj.compute_without_void + end +end diff --git a/app/controllers/origami/sales_controller.rb b/app/controllers/origami/sales_controller.rb new file mode 100644 index 00000000..e272c1ee --- /dev/null +++ b/app/controllers/origami/sales_controller.rb @@ -0,0 +1,44 @@ +class Origami::SalesController < BaseOrigamiController + + def show + @tables = Table.all.active.order('status desc') + @rooms = Room.all.active.order('status desc') + @complete = Sale.all + @orders = Order.all.order('date desc') + @sale = Sale.find(params[:sale_id]) + end + + def add_to_existing_invoice + dining = params[:dining_id] + sale_id = params[:sale_id] + table = DiningFacility.find(dining) + table.bookings.each do |booking| + if booking.sale_id.nil? + booking.booking_orders.each do |booking_order| + booking.booking_status = 'moved' + order = Order.find(booking_order.order_id) + order.status = 'billed' + order.order_items.each do |item| + item.order_item_status = 'billed' + end + # create sale item + saleobj = Sale.find(sale_id) + order.order_items.each do |orer_item| + saleobj.add_item (orer_item) + end + saleobj.save + order.save + booking.save + end + existing_booking = Booking.find_by_sale_id(sale_id) + booking_order = BookingOrder.where('booking_id=?',booking) + booking_order.each do |bo| + bo.booking_id = existing_booking.booking_id + bo.save + end + end + end + end + + +end diff --git a/app/controllers/origami/shifts_controller.rb b/app/controllers/origami/shifts_controller.rb new file mode 100644 index 00000000..4cd17cce --- /dev/null +++ b/app/controllers/origami/shifts_controller.rb @@ -0,0 +1,13 @@ +class Origami::ShiftsController < ApplicationController + def index + end + + def show + end + + def new + end + + def edit + end +end diff --git a/app/controllers/origami/table_invoices_controller.rb b/app/controllers/origami/table_invoices_controller.rb new file mode 100644 index 00000000..4571ba87 --- /dev/null +++ b/app/controllers/origami/table_invoices_controller.rb @@ -0,0 +1,40 @@ +class Origami::TableInvoicesController < BaseOrigamiController + def index + @table = DiningFacility.find(params[:table_id]) + puts "table bookig lenght" + @sale_array = Array.new + @table.bookings.each do |booking| + puts booking.sale_id + + if booking.sale_id.nil? + else + sale = Sale.find(booking.sale_id) + + if sale.sale_status != "completed" + @sale_array.push(sale) + end + end + end + end + + def show + @table = DiningFacility.find(params[:table_id]) + @sale_array = Array.new + @table.bookings.each do |booking| + if booking.sale_id.nil? + else + sale = Sale.find(booking.sale_id) + + if sale.sale_status != "completed" && sale.sale_status != 'void' + @sale_array.push(sale) + end + end + end + + @sale = Sale.find(params[:invoice_id]) + @date = @sale.created_at + @status_sale = 'sale' + @customer = @sale.customer + end + +end diff --git a/app/controllers/origami/void_controller.rb b/app/controllers/origami/void_controller.rb new file mode 100644 index 00000000..3515b010 --- /dev/null +++ b/app/controllers/origami/void_controller.rb @@ -0,0 +1,36 @@ +class Origami::VoidController < BaseOrigamiController + + def overall_void + + sale_id = params[:sale_id] + if Sale.exists?(sale_id) + sale = Sale.find_by_sale_id(sale_id) + sale.payment_status = 'void' + sale.sale_status = 'void' + 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 = sale.bookings[0].dining_facility + table.bookings.each do |booking| + if booking.sale.sale_status == 'new' + table_avaliable = false + end + end + + if table_avaliable == true + table.status = 'available' + table.save + end + + end + end + +end \ No newline at end of file diff --git a/app/controllers/print_settings_controller.rb b/app/controllers/print_settings_controller.rb index fa5af7e8..bdd3061a 100644 --- a/app/controllers/print_settings_controller.rb +++ b/app/controllers/print_settings_controller.rb @@ -1,4 +1,5 @@ class PrintSettingsController < ApplicationController + load_and_authorize_resource except: [:create] before_action :set_print_setting, only: [:show, :edit, :update, :destroy] # GET /print_settings diff --git a/app/controllers/reports/bksale_items_controller.rb b/app/controllers/reports/bksale_items_controller.rb new file mode 100644 index 00000000..1f349320 --- /dev/null +++ b/app/controllers/reports/bksale_items_controller.rb @@ -0,0 +1,19 @@ +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 \ No newline at end of file diff --git a/app/controllers/reports/daily_sale_controller.rb b/app/controllers/reports/daily_sale_controller.rb deleted file mode 100644 index b487c269..00000000 --- a/app/controllers/reports/daily_sale_controller.rb +++ /dev/null @@ -1,9 +0,0 @@ -class Reports::DailySaleController < BaseReportController - - def index - from, to = get_date_range_from_params - @sale_data = Sale.get_receipt_no_list(from,to) - @sale_data = Kaminari.paginate_array(@sale_data).page(params[:page]).per(50) - end - -end \ No newline at end of file diff --git a/app/controllers/reports/daily_sales_controller.rb b/app/controllers/reports/daily_sales_controller.rb new file mode 100644 index 00000000..6d99551d --- /dev/null +++ b/app/controllers/reports/daily_sales_controller.rb @@ -0,0 +1,17 @@ +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 \ No newline at end of file diff --git a/app/controllers/reports/daily_salesbk_controller.rb b/app/controllers/reports/daily_salesbk_controller.rb new file mode 100644 index 00000000..1a878aaa --- /dev/null +++ b/app/controllers/reports/daily_salesbk_controller.rb @@ -0,0 +1,17 @@ +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 \ No newline at end of file diff --git a/app/controllers/reports/receipt_no_controller.rb b/app/controllers/reports/receipt_no_controller.rb index 8569c051..d85c7d57 100644 --- a/app/controllers/reports/receipt_no_controller.rb +++ b/app/controllers/reports/receipt_no_controller.rb @@ -1,4 +1,5 @@ class Reports::ReceiptNoController < BaseReportController + def index from, to = get_date_range_from_params puts "from..." @@ -7,6 +8,10 @@ class Reports::ReceiptNoController < BaseReportController puts to @sale_data = Sale.get_receipt_no_list(from,to) @sale_data = Kaminari.paginate_array(@sale_data).page(params[:page]).per(50) + respond_to do |format| + format.html + format.xls + end end def show diff --git a/app/controllers/reports/sale_items_controller.rb b/app/controllers/reports/sale_items_controller.rb new file mode 100644 index 00000000..81f7af01 --- /dev/null +++ b/app/controllers/reports/sale_items_controller.rb @@ -0,0 +1,19 @@ +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 \ No newline at end of file diff --git a/app/controllers/settings/accounts_controller.rb b/app/controllers/settings/accounts_controller.rb index 74f27c84..54f27480 100644 --- a/app/controllers/settings/accounts_controller.rb +++ b/app/controllers/settings/accounts_controller.rb @@ -1,4 +1,5 @@ class Settings::AccountsController < ApplicationController + load_and_authorize_resource except: [:create] before_action :set_account, only: [:show, :edit, :update, :destroy] # GET /settings/accounts @@ -68,6 +69,6 @@ class Settings::AccountsController < ApplicationController # Never trust parameters from the scary internet, only allow the white list through. def account_params - params.require(:account).permit(:title, :account_type) + params.require(:account).permit(:title, :account_type,:discount,:point,:bonus,:rebate) end end diff --git a/app/controllers/settings/cashier_terminals_controller.rb b/app/controllers/settings/cashier_terminals_controller.rb index b397d68d..0808c0a7 100644 --- a/app/controllers/settings/cashier_terminals_controller.rb +++ b/app/controllers/settings/cashier_terminals_controller.rb @@ -1,4 +1,5 @@ class Settings::CashierTerminalsController < ApplicationController + load_and_authorize_resource except: [:create] before_action :set_settings_cashier_terminal, only: [:show, :edit, :update, :destroy] # GET /settings/cashier_terminals diff --git a/app/controllers/settings/employees_controller.rb b/app/controllers/settings/employees_controller.rb index 31e93d97..07656470 100644 --- a/app/controllers/settings/employees_controller.rb +++ b/app/controllers/settings/employees_controller.rb @@ -1,6 +1,8 @@ class Settings::EmployeesController < ApplicationController + load_and_authorize_resource before_action :set_employee, only: [:show, :edit, :update, :destroy] + # GET /employees # GET /employees.json def index diff --git a/app/controllers/settings/membership_actions_controller.rb b/app/controllers/settings/membership_actions_controller.rb index ad7311f2..f386aecd 100644 --- a/app/controllers/settings/membership_actions_controller.rb +++ b/app/controllers/settings/membership_actions_controller.rb @@ -1,4 +1,5 @@ class Settings::MembershipActionsController < ApplicationController + load_and_authorize_resource except: [:create] before_action :set_settings_membership_action, only: [:show, :edit, :update, :destroy] # GET /settings/membership_actions diff --git a/app/controllers/settings/membership_settings_controller.rb b/app/controllers/settings/membership_settings_controller.rb index cfd672d0..36bb0092 100644 --- a/app/controllers/settings/membership_settings_controller.rb +++ b/app/controllers/settings/membership_settings_controller.rb @@ -1,4 +1,5 @@ class Settings::MembershipSettingsController < ApplicationController + load_and_authorize_resource except: [:create] before_action :set_settings_membership_setting, only: [:show, :edit, :update, :destroy] # GET /settings/membership_settings diff --git a/app/controllers/settings/menu_categories_controller.rb b/app/controllers/settings/menu_categories_controller.rb index c2a521ae..8ca9cfb4 100644 --- a/app/controllers/settings/menu_categories_controller.rb +++ b/app/controllers/settings/menu_categories_controller.rb @@ -1,4 +1,5 @@ class Settings::MenuCategoriesController < ApplicationController + load_and_authorize_resource except: [:create] before_action :set_settings_menu_category, only: [:show, :edit, :update, :destroy] before_action :set_settings_menu, only: [:new] diff --git a/app/controllers/settings/menu_item_attributes_controller.rb b/app/controllers/settings/menu_item_attributes_controller.rb index 1433cf34..162325a2 100644 --- a/app/controllers/settings/menu_item_attributes_controller.rb +++ b/app/controllers/settings/menu_item_attributes_controller.rb @@ -1,4 +1,5 @@ class Settings::MenuItemAttributesController < ApplicationController + load_and_authorize_resource except: [:create] before_action :set_settings_menu_item_attribute, only: [:show, :edit, :update, :destroy] # GET /settings/menu_item_attributes diff --git a/app/controllers/settings/menu_item_instances_controller.rb b/app/controllers/settings/menu_item_instances_controller.rb index 2b1fcecf..fd651e5e 100644 --- a/app/controllers/settings/menu_item_instances_controller.rb +++ b/app/controllers/settings/menu_item_instances_controller.rb @@ -1,4 +1,5 @@ class Settings::MenuItemInstancesController < ApplicationController + load_and_authorize_resource except: [:create] before_action :set_settings_menu_item_instance, only: [:show, :edit, :update, :destroy] before_action :set_settings_menu_item, only: [ :show, :edit, :new, :update] diff --git a/app/controllers/settings/menu_item_options_controller.rb b/app/controllers/settings/menu_item_options_controller.rb index 4a3a44b7..41679796 100644 --- a/app/controllers/settings/menu_item_options_controller.rb +++ b/app/controllers/settings/menu_item_options_controller.rb @@ -1,4 +1,5 @@ class Settings::MenuItemOptionsController < ApplicationController + load_and_authorize_resource except: [:create] before_action :set_settings_menu_item_option, only: [:show, :edit, :update, :destroy] # GET /settings/menu_item_options diff --git a/app/controllers/settings/menus_controller.rb b/app/controllers/settings/menus_controller.rb index fa6ac158..1a5ada31 100644 --- a/app/controllers/settings/menus_controller.rb +++ b/app/controllers/settings/menus_controller.rb @@ -1,4 +1,5 @@ class Settings::MenusController < ApplicationController + load_and_authorize_resource except: [:create] before_action :set_settings_menu, only: [:show, :edit, :update, :destroy] # GET /settings/menus diff --git a/app/controllers/settings/order_queue_stations_controller.rb b/app/controllers/settings/order_queue_stations_controller.rb index b63e1ca8..9fe78de4 100644 --- a/app/controllers/settings/order_queue_stations_controller.rb +++ b/app/controllers/settings/order_queue_stations_controller.rb @@ -1,4 +1,5 @@ class Settings::OrderQueueStationsController < ApplicationController + load_and_authorize_resource except: [:create] before_action :set_settings_order_queue_station, only: [:show, :edit, :update, :destroy] # GET /settings/order_queue_stations @@ -27,6 +28,7 @@ class Settings::OrderQueueStationsController < ApplicationController def create @settings_order_queue_station = OrderQueueStation.new(settings_order_queue_station_params) @settings_order_queue_station.created_by = current_login_employee.name + @settings_order_queue_station.processing_items = "[]" respond_to do |format| if @settings_order_queue_station.save format.html { redirect_to settings_order_queue_stations_path, notice: 'Order queue station was successfully created.' } @@ -41,7 +43,7 @@ class Settings::OrderQueueStationsController < ApplicationController # PATCH/PUT /settings/order_queue_stations/1 # PATCH/PUT /settings/order_queue_stations/1.json def update - params[:order_queue_station][:processing_items] = params[:order_queue_station][:processing_items].split(/,/).inspect + # params[:order_queue_station][:processing_items] = params[:order_queue_station][:processing_items].split(/,/).inspect respond_to do |format| if @settings_order_queue_station.update(settings_order_queue_station_params) format.html { redirect_to settings_order_queue_station_path(@settings_order_queue_station), notice: 'Order queue station was successfully updated.' } diff --git a/app/controllers/settings/payment_method_settings_controller.rb b/app/controllers/settings/payment_method_settings_controller.rb index f3ac595e..ecbbcced 100644 --- a/app/controllers/settings/payment_method_settings_controller.rb +++ b/app/controllers/settings/payment_method_settings_controller.rb @@ -1,4 +1,5 @@ class Settings::PaymentMethodSettingsController < ApplicationController + load_and_authorize_resource except: [:create] before_action :set_settings_payment_method_setting, only: [:show, :edit, :update, :destroy] # GET /settings/payment_method_settings diff --git a/app/controllers/settings/rooms_controller.rb b/app/controllers/settings/rooms_controller.rb index 69e3ec22..2d5b01e1 100644 --- a/app/controllers/settings/rooms_controller.rb +++ b/app/controllers/settings/rooms_controller.rb @@ -1,6 +1,6 @@ class Settings::RoomsController < ApplicationController before_action :set_settings_room, only: [:show, :edit, :update, :destroy] - before_action :set_settings_zone, only: [:index, :show, :edit, :new, :update,:create] + before_action :set_settings_zone, only: [:index, :show, :edit, :new, :update,:create,:destroy] # GET /settings/rooms # GET /settings/rooms.json def index @@ -28,9 +28,10 @@ class Settings::RoomsController < ApplicationController @settings_room = Room.new(settings_room_params) @settings_room.type = DiningFacility::ROOM_TYPE @settings_room.zone_id = params[:zone_id] + @settings_room.created_by = current_login_employee.name respond_to do |format| if @settings_room.save - format.html { redirect_to settings_zone_rooms_path, notice: 'Room was successfully created.' } + format.html { redirect_to settings_zone_path(@zone), notice: 'Room was successfully created.' } format.json { render :show, status: :created, location: @settings_room } else puts "abc" @@ -43,9 +44,10 @@ class Settings::RoomsController < ApplicationController # PATCH/PUT /settings/rooms/1 # PATCH/PUT /settings/rooms/1.json def update + @settings_room.created_by = current_login_employee.name respond_to do |format| if @settings_room.update(settings_room_params) - format.html { redirect_to settings_zone_rooms_path, notice: 'Room was successfully updated.' } + format.html { redirect_to settings_zone_path(@zone), notice: 'Room was successfully updated.' } format.json { render :show, status: :ok, location: @settings_room } else format.html { render :edit } @@ -59,7 +61,7 @@ class Settings::RoomsController < ApplicationController def destroy @settings_room.destroy respond_to do |format| - format.html { redirect_to settings_zones_path, notice: 'Room was successfully destroyed.' } + format.html { redirect_to settings_zone_path(@zone), notice: 'Room was successfully destroyed.' } format.json { head :no_content } end end diff --git a/app/controllers/settings/tables_controller.rb b/app/controllers/settings/tables_controller.rb index 124a0d94..7c293455 100644 --- a/app/controllers/settings/tables_controller.rb +++ b/app/controllers/settings/tables_controller.rb @@ -28,12 +28,12 @@ class Settings::TablesController < ApplicationController @settings_table = Table.new(settings_table_params) @settings_table.type = DiningFacility::TABLE_TYPE @settings_table.zone_id = params[:zone_id] + @settings_table.created_by = current_login_employee.name respond_to do |format| if @settings_table.save - format.html { redirect_to settings_zone_tables_path, notice: 'Table was successfully created.' } + format.html { redirect_to settings_zone_path(@zone), notice: 'Table was successfully created.' } format.json { render :show, status: :created, location: @settings_table } else - puts "abc" format.html { render :new } format.json { render json: @settings_table.errors, status: :unprocessable_entity } end @@ -43,9 +43,10 @@ class Settings::TablesController < ApplicationController # PATCH/PUT /settings/tables/1 # PATCH/PUT /settings/tables/1.json def update + @settings_table.created_by = current_login_employee.name respond_to do |format| if @settings_table.update(settings_table_params) - format.html { redirect_to settings_zone_tables_path, notice: 'Table was successfully updated.' } + format.html { redirect_to settings_zone_path(@zone), notice: 'Table was successfully updated.' } format.json { render :show, status: :ok, location: @settings_table } else format.html { render :edit } @@ -59,7 +60,7 @@ class Settings::TablesController < ApplicationController def destroy @settings_table.destroy respond_to do |format| - format.html { redirect_to settings_zones_path, notice: 'Table was successfully destroyed.' } + format.html { redirect_to settings_zone_path(@zone), notice: 'Table was successfully destroyed.' } format.json { head :no_content } end end diff --git a/app/controllers/settings/tax_profiles_controller.rb b/app/controllers/settings/tax_profiles_controller.rb index 1064055b..992f637a 100644 --- a/app/controllers/settings/tax_profiles_controller.rb +++ b/app/controllers/settings/tax_profiles_controller.rb @@ -1,4 +1,5 @@ class Settings::TaxProfilesController < ApplicationController + load_and_authorize_resource except: [:create] before_action :set_settings_tax_profile, only: [:show, :edit, :update, :destroy] # GET /settings/tax_profiles diff --git a/app/controllers/settings/zones_controller.rb b/app/controllers/settings/zones_controller.rb index 5752b5e3..49505854 100644 --- a/app/controllers/settings/zones_controller.rb +++ b/app/controllers/settings/zones_controller.rb @@ -1,4 +1,5 @@ class Settings::ZonesController < ApplicationController + load_and_authorize_resource except: [:create] before_action :set_settings_zone, only: [:show, :edit, :update, :destroy] # GET /settings/zones @@ -27,7 +28,7 @@ class Settings::ZonesController < ApplicationController # POST /settings/zones.json def create @settings_zone = Zone.new(settings_zone_params) - + @settings_zone.created_by = current_login_employee.name respond_to do |format| if @settings_zone.save format.html { redirect_to settings_zone_path(@settings_zone), notice: 'Zone was successfully created.' } @@ -43,6 +44,7 @@ class Settings::ZonesController < ApplicationController # PATCH/PUT /settings/zones/1.json def update respond_to do |format| + @settings_zone.created_by = current_login_employee.name if @settings_zone.update(settings_zone_params) format.html { redirect_to settings_zone_path(@settings_zone), notice: 'Zone was successfully updated.' } format.json { render :show, status: :ok, location: @settings_zone } @@ -56,6 +58,8 @@ class Settings::ZonesController < ApplicationController # DELETE /settings/zones/1 # DELETE /settings/zones/1.json def destroy + @settings_zone.rooms.destroy + @settings_zone.tables.destroy @settings_zone.destroy respond_to do |format| format.html { redirect_to settings_zones_path, notice: 'Zone was successfully destroyed.' } diff --git a/app/controllers/transactions/credit_notes_controller.rb b/app/controllers/transactions/credit_notes_controller.rb new file mode 100644 index 00000000..0f370c96 --- /dev/null +++ b/app/controllers/transactions/credit_notes_controller.rb @@ -0,0 +1,18 @@ +class Transactions::CreditNotesController < ApplicationController + before_action :set_transactions_sale, only: [:show, :edit, :update, :destroy] + + # GET /transactions/sales + # GET /transactions/sales.json + def index + + @sales = Sale.where('payment_status = ?', Sale::SALE_STATUS_OUTSTANDING) + + + + respond_to do |format| + format.html # index.html.erb + format.json { render json: @sales } + end + + end + end \ No newline at end of file diff --git a/app/controllers/transactions/orders_controller.rb b/app/controllers/transactions/orders_controller.rb index 35cefe6f..8303780f 100644 --- a/app/controllers/transactions/orders_controller.rb +++ b/app/controllers/transactions/orders_controller.rb @@ -1,4 +1,5 @@ class Transactions::OrdersController < ApplicationController + load_and_authorize_resource except: [:create] def index filter = params[:filter] diff --git a/app/controllers/transactions/sales_controller.rb b/app/controllers/transactions/sales_controller.rb index fed62a34..19803c0d 100644 --- a/app/controllers/transactions/sales_controller.rb +++ b/app/controllers/transactions/sales_controller.rb @@ -1,4 +1,5 @@ class Transactions::SalesController < ApplicationController + load_and_authorize_resource except: [:create] before_action :set_transactions_sale, only: [:show, :edit, :update, :destroy] # GET /transactions/sales @@ -53,13 +54,7 @@ class Transactions::SalesController < ApplicationController #get customer amount @customer = Customer.find(@sale.customer_id) - response = Customer.get_member_account(@customer) - - if(response["status"] == true) - @membership = response["data"] - else - @membership = 0 - end + @response = Customer.get_membership_transactions(@customer) #end customer amount respond_to do |format| diff --git a/app/forms/open_shift_form.rb b/app/forms/open_shift_form.rb new file mode 100644 index 00000000..019e6f3e --- /dev/null +++ b/app/forms/open_shift_form.rb @@ -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 diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index de6be794..96956958 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -1,2 +1,11 @@ module ApplicationHelper + + def flash_class(level) + case level + when :notice then "alert alert-info fade-in" + when :success then "alert alert-success fade-in" + when :error then "alert alert-error fade-in" + when :alert then "alert alert-error fade-in" + end +end end diff --git a/app/helpers/cash_mgmt_helper.rb b/app/helpers/cash_mgmt_helper.rb new file mode 100644 index 00000000..5c1ad77b --- /dev/null +++ b/app/helpers/cash_mgmt_helper.rb @@ -0,0 +1,2 @@ +module CashMgmtHelper +end diff --git a/app/helpers/origami/shifts_helper.rb b/app/helpers/origami/shifts_helper.rb new file mode 100644 index 00000000..ae63824e --- /dev/null +++ b/app/helpers/origami/shifts_helper.rb @@ -0,0 +1,2 @@ +module Origami::ShiftsHelper +end diff --git a/app/helpers/reports/daily_sales_helper.rb b/app/helpers/reports/daily_sales_helper.rb new file mode 100644 index 00000000..eb04c7b9 --- /dev/null +++ b/app/helpers/reports/daily_sales_helper.rb @@ -0,0 +1,2 @@ +module Reports::DailySalesHelper +end diff --git a/app/helpers/reports/dailysales_helper.rb b/app/helpers/reports/dailysales_helper.rb new file mode 100644 index 00000000..94e34c27 --- /dev/null +++ b/app/helpers/reports/dailysales_helper.rb @@ -0,0 +1,2 @@ +module Reports::DailysalesHelper +end diff --git a/app/helpers/reports/sale_items_helper.rb b/app/helpers/reports/sale_items_helper.rb new file mode 100644 index 00000000..63e884d7 --- /dev/null +++ b/app/helpers/reports/sale_items_helper.rb @@ -0,0 +1,2 @@ +module Reports::SaleItemsHelper +end diff --git a/app/models/ability.rb b/app/models/ability.rb new file mode 100644 index 00000000..5e5fb4f3 --- /dev/null +++ b/app/models/ability.rb @@ -0,0 +1,87 @@ +class Ability + include CanCan::Ability + + def initialize(user) + user ||= Employee.new + + if user.role == "administrator" + + can :manage, :all + + elsif user.role == "manager" + + can :manage, Menu + can :manage, MenuCategory + can :manage, MenuItemAttribute + can :manage, MenuItemInstance + can :manage, MenuItemOption + can :manage, SetMenuItem + can :manage, OrderQueueStation + can :manage, Zone + can :manage, CashierTerminal + can :manage, Employee + # can :manage, MembershipSetting + # can :manage, MembershipAction + # can :manage, PaymentMethodSetting + can :manage, TaxProfile + can :manage, PrintSetting + can :manage, Account + + can :manage, Order + can :manage, Sale + + can :manage, Customer + + can :index, :dailysale + can :index, :saleitem + + can :add_customer, Customer + can :update_sale_by_customer, Customer + + can :index, :discount + can :create, :discount + + can :show, :payment + can :create, :payment + can :reprint, :payment + + can :move_dining, :movetable + can :moving, :movetable + + can :move_dining, :moveroom + + elsif user.role == "cashier" + + can :read, Order + can :update, Order + + can :read, Sale + can :update, Sale + + can :add_customer, Customer + can :update_sale_by_customer, Customer + + can :index, :discount + can :create, :discount + + can :show, :payment + can :create, :payment + can :reprint, :payment + + can :move_dining, :movetable + can :moving, :movetable + + can :move_dining, :moveroom + + elsif user.role == "accountant" + + can :index, :dailysale + can :index, :saleitem + can :index, :receiptno + can :show, :dailysale + can :show, :saleitem + can :show, :receiptno + + end + end +end diff --git a/app/models/booking.rb b/app/models/booking.rb index 01cf0f46..cc4ae389 100644 --- a/app/models/booking.rb +++ b/app/models/booking.rb @@ -9,6 +9,37 @@ class Booking < ApplicationRecord belongs_to :sale, :optional => true has_many :booking_orders has_many :orders, :through => :booking_orders + scope :active, -> {where("booking_status != 'moved'")} + + def self.update_dining_facility(booking_arr, newd, old) + table = DiningFacility.find(newd) + exist = table.get_booking + if exist + # order exists + booking_arr.each do |booking| + booking.dining_facility_id = newd + booking.booking_status = 'moved' + booking.save + booking.booking_orders.each do |bo| + bo.booking_id = exist.booking_id + bo.save + end + end + else + # new table + booking_arr.each do |booking| + booking.dining_facility_id = newd + booking.save + end + end + + new_dining = DiningFacility.find(newd) + new_dining.make_occupied + old_dining = DiningFacility.find(old) + old_dining.make_available + + return new_dining.type + end private def generate_custom_id diff --git a/app/models/booking_order.rb b/app/models/booking_order.rb index ddf5ed18..c9f748f0 100644 --- a/app/models/booking_order.rb +++ b/app/models/booking_order.rb @@ -1,5 +1,5 @@ class BookingOrder < ApplicationRecord - #primary key - need to be unique + #primary key - need to be unique belongs_to :booking belongs_to :order diff --git a/app/models/customer.rb b/app/models/customer.rb index de9846f2..e6afca08 100644 --- a/app/models/customer.rb +++ b/app/models/customer.rb @@ -6,9 +6,10 @@ class Customer < ApplicationRecord has_many :orders has_many :sales - validates_presence_of :name, :contact_no, :email + validates_presence_of :name, :contact_no, :email,:card_no validates :contact_no, uniqueness: true validates :email, uniqueness: true + validates :card_no, uniqueness: true paginates_per 50 @@ -33,55 +34,55 @@ class Customer < ApplicationRecord end return response; - + + end + + def self.get_membership_transactions(customer) + membership = MembershipSetting.find_by_membership_type("paypar_url") + memberaction = MembershipAction.find_by_membership_type("get_member_transactions") + merchant_uid = memberaction.merchant_account_id.to_s + auth_token = memberaction.auth_token.to_s + url = membership.gateway_url.to_s + memberaction.gateway_url.to_s +# urltest =self.url_exist?(url) + + begin + response = HTTParty.get(url, :body => { membership_id: customer.membership_id,merchant_uid:merchant_uid,auth_token:auth_token}.to_json, + :headers => { + 'Content-Type' => 'application/json', + 'Accept' => 'application/json' + }, + :timeout => 10 + ) + rescue Net::OpenTimeout + response = { status: false } + end + + return response; + end def self.search(search) if search # find(:all, :conditions => ['name LIKE ? OR contact_no LIKE ?', "%#{search}%", "%#{search}%"]) - where("name LIKE ? OR contact_no LIKE ?", "%#{search}%", "%#{search}%",) + where("name LIKE ? OR contact_no LIKE ? OR card_no LIKE ?", "%#{search}%", "%#{search}%", "%#{search}%",) else find(:all) end end -# require "net/http" -# def self.url_exist?(url_string) -# url = URI.parse(url_string) - - -# req = Net::HTTP.new(url.host, url.port) -# puts "hhhhhhhhhhhh" -# puts req.to_json -# req.use_ssl = (url.scheme == 'https') -# puts "aaaaaaaaaaaa" -# puts req.use_ssl? -# path = url.path if url.path.present? -# puts "bbbbbbbbbbbbb" -# puts path -# res = req.request_head(path || '/') -# puts "cccccccccccccc" -# puts res.to_json -# puts "ddddddddd" -# puts res.kind_of?(Net::HTTPRedirection) -# if res.kind_of?(Net::HTTPRedirection) -# url_exist?(res['location']) # Go after any redirect and make sure you can access the redirected URL -# else -# ! %W(4 5).include?(res.code[0]) # Not from 4xx or 5xx families -# end -# rescue Errno::ENOENT -# false #false if can't find the server -# end - - - # def self.search(search) - # where("name LIKE ? OR contact_no LIKE ?", "%#{search}%", "%#{search}%",) - # end - def lastest_invoices sales.where(:customer_id => self.id).order("created_at desc").limit(5) end + def self.count_customer + all = self.all.count+1 + count = all-2 + + end + + WALKIN = "CUS-000000000001" + TAKEAWAY = "CUS-000000000002" + private def generate_custom_id self.customer_id = SeedGenerator.generate_id(self.class.name, "CUS") diff --git a/app/models/dining_facility.rb b/app/models/dining_facility.rb index 6f898989..0e10307b 100644 --- a/app/models/dining_facility.rb +++ b/app/models/dining_facility.rb @@ -8,12 +8,32 @@ class DiningFacility < ApplicationRecord scope :active, -> {where(is_active: true)} + def make_available + self.status = 'available' + self.save + end + + def make_occupied + self.status = 'occupied' + self.save + end + + def get_booking + booking = self.get_current_booking + if booking + if booking.dining_facility_id.to_i == self.id + if booking.booking_status == 'assign' + return booking + end + end + end + end + def get_current_booking - puts "enter booking" - booking = Booking.where("dining_facility_id = #{self.id} and booking_status ='assign' and checkin_at between '#{DateTime.now.utc - 5.hours}' and '#{DateTime.now.utc}' and checkout_at is null").limit(1) + booking = Booking.where("dining_facility_id = #{self.id} and booking_status ='assign' 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].booking_id + return booking[0] else return nil end @@ -21,10 +41,10 @@ class DiningFacility < ApplicationRecord def get_new_booking # query for new - # if status + # if status # to ask when req bill booking_status? booking = Booking.where("dining_facility_id = #{self.id} and booking_status ='assign' and sale_id is null and checkout_at is null").limit(1) - # else + # else # booking = Booking.where("dining_facility_id = #{self.id} and booking_status ='assign' and sale_id not null").limit(1) # end diff --git a/app/models/employee.rb b/app/models/employee.rb index 98b8380b..1816c2e3 100644 --- a/app/models/employee.rb +++ b/app/models/employee.rb @@ -6,6 +6,10 @@ class Employee < ApplicationRecord 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 + def self.all_emp_except_waiter + Employee.where('role!=?','waiter') + end + def self.collection Employee.select("id, name").map { |e| [e.name, e.id] } end @@ -13,9 +17,9 @@ class Employee < ApplicationRecord def self.login(emp_id, password) user = Employee.find_by_emp_id(emp_id) if (user) - user.authenticate(password) + #user.authenticate(password) - if (user) + if (user.authenticate(password)) user.generate_token user.session_expiry = DateTime.now.utc + 30.minutes user.session_last_login = DateTime.now.utc diff --git a/app/models/menu_item.rb b/app/models/menu_item.rb index 89967e2e..50b70e66 100644 --- a/app/models/menu_item.rb +++ b/app/models/menu_item.rb @@ -24,6 +24,7 @@ class MenuItem < ApplicationRecord if (!mt_instance.nil?) menu_item = MenuItem.find(mt_instance.menu_item_id) menu_item_hash[:type] = menu_item.type + menu_item_hash[:account_id] = menu_item.account_id menu_item_hash[:item_code] = menu_item.item_code menu_item_hash[:item_instance_code] = mt_instance.item_instance_code menu_item_hash[:name] = menu_item.name.to_s + " - " + mt_instance.item_instance_name.to_s diff --git a/app/models/order.rb b/app/models/order.rb index 96382c07..b3a70f37 100644 --- a/app/models/order.rb +++ b/app/models/order.rb @@ -4,14 +4,14 @@ class Order < ApplicationRecord #primary key - need to be unique before_create :generate_custom_id before_create :set_order_date - + has_many :sale_orders belongs_to :customer has_many :order_items, autosave: true , inverse_of: :order has_many :assigned_order_items #internal references attributes for business logic control attr_accessor :items, :guest, :table_id, :new_booking, :booking_type, :employee_name, :booking_id - + scope :active, -> { where("date BETWEEN '#{DateTime.now.utc.end_of_day}' AND '#{DateTime.now.utc.beginning_of_day}'") } #Main Controller method to create new order - validate all inputs and generate new order # order_item : { # order_item_code : "", @@ -27,7 +27,7 @@ class Order < ApplicationRecord if self.new_booking booking = Booking.create({:dining_facility_id => self.table_id,:type => "TableBooking", - :checkin_at => Time.now.utc, :checkin_by => self.employee_name, + :checkin_at => Time.now.utc.getlocal, :checkin_by => self.employee_name, :booking_status => "assign" }) table = DiningFacility.find(self.table_id) table.status = "occupied" @@ -82,7 +82,16 @@ class Order < ApplicationRecord set_order_items end - OrderItem.processs_item(menu_item[:item_code], menu_item[:name], + # not insert with price 0 + # puts item[:price] + # puts item + # if(item[:price] != 0 ) + # OrderItem.processs_item(menu_item[:item_code], menu_item[:name], menu_item[:account_id], + # item[:quantity],menu_item[:price], item[:options], set_order_items, self.id, + # self.employee_name) + # end + + OrderItem.processs_item(menu_item[:item_code], menu_item[:name], menu_item[:account_id], item[:quantity],menu_item[:price], item[:options], set_order_items, self.id, self.employee_name) diff --git a/app/models/order_item.rb b/app/models/order_item.rb index 564aa939..2c9a9ba0 100644 --- a/app/models/order_item.rb +++ b/app/models/order_item.rb @@ -20,12 +20,13 @@ class OrderItem < ApplicationRecord # option_values : [], # sub_order_items : [], # } - def self.processs_item (item_code, menu_name, qty,price, options, set_menu_items, order_id, item_order_by) + def self.processs_item (item_code, menu_name, account_id, qty,price, options, set_menu_items, order_id, item_order_by) orderitem = OrderItem.create do |oitem| oitem.order_id = order_id oitem.item_code = item_code oitem.item_name = menu_name + oitem.account_id = account_id oitem.qty = qty oitem.price = price oitem.options = options diff --git a/app/models/order_queue_station.rb b/app/models/order_queue_station.rb index 0350049c..7e3352d1 100644 --- a/app/models/order_queue_station.rb +++ b/app/models/order_queue_station.rb @@ -16,37 +16,76 @@ class OrderQueueStation < ApplicationRecord oqpbz = OrderQueueProcessByZone.find_by_zone_id(dining.zone_id) order_items = order.order_items + + # get dining + booking = Booking.find_by_dining_facility_id(dining.id) + #Assign OQS id to order Items - oqs_stations.each do |oqs| + oqs_stations.each do |oqs| + is_auto_printed = false + oqs_order_items = [] #Get List of items - pq_items = JSON.parse(oqs.processing_items) - #Loop through the processing items + #Loop through the processing items pq_items.each do |pq_item| #Processing through the looping items order_items.each do |order_item| if (pq_item == order_item.item_code) - if oqs.id == oqpbz.order_queue_station_id - #Same Order_items can appear in two location. - AssignedOrderItem.assigned_order_item(order, order_item.item_code, oqs) - end + # if oqs.id == oqpbz.order_queue_station_id + # #Same Order_items can appear in two location. + # AssignedOrderItem.assigned_order_item(order, order_item.item_code, oqs) + # else + + if (order_item.price != 0) + AssignedOrderItem.assigned_order_item(order, order_item.item_code, oqs) + oqs_order_items.push(order_item) + end + # end end end + end + # Auto Printing + # ToDo per item per printer + if oqs.auto_print && is_auto_printed == false + if oqs_order_items.length > 0 + print_slip(oqs, order, oqs_order_items) + is_auto_printed = true + end end end - - #Print OQS where printing is require - end private #Print order_items in 1 slip - def print_slip + def print_slip(oqs, order, order_items) + unique_code="OrderSummaryPdf" + + print_settings=PrintSetting.find_by_unique_code(unique_code) + order_queue_printer= Printer::OrderQueuePrinter.new(print_settings) + order_queue_printer.print_order_summary(oqs,order.order_id, order_items, print_status="") + AssignedOrderItem.where("order_id = '#{ order.order_id }'").find_each do |ai| + # update print status for order items + ai.print_status=true + ai.save + end + end - #Print order_items in 1 slip per item - def print_slip_item + #Print order_item in 1 slip per item + def print_slip_item(oqs, assigned_order_item) + unique_code="OrderItemPdf" + # print when complete click + print_settings=PrintSetting.find_by_unique_code(unique_code) + order_queue_printer= Printer::OrderQueuePrinter.new(print_settings) + order_queue_printer.print_order_item(oqs,item.order_id, item.item_code, print_status="" ) + + # update print status for completed same order items + assigned_order_item.each do |ai| + ai.print_status=true + ai.save + end end end diff --git a/app/models/payment_journal.rb b/app/models/payment_journal.rb new file mode 100644 index 00000000..237f9cd4 --- /dev/null +++ b/app/models/payment_journal.rb @@ -0,0 +1,2 @@ +class PaymentJournal < ApplicationRecord +end diff --git a/app/models/printer/order_queue_printer.rb b/app/models/printer/order_queue_printer.rb index dae1ad53..f80ee72d 100644 --- a/app/models/printer/order_queue_printer.rb +++ b/app/models/printer/order_queue_printer.rb @@ -1,66 +1,145 @@ class Printer::OrderQueuePrinter < Printer::PrinterWorker - def print_order_item(oqs,order_id, item_code) + def print_order_item(oqs,order_id, item_code, print_status, options="") #Use CUPS service #Generate PDF #Print - order_item= print_query('order_item', item_code) #OrderItem.find_by_item_code(item_code) - pdf = OrderItemPdf.new(order_item[0]) - pdf.render_file "tmp/receipt.pdf" - if oqs.print_copy - self.print("tmp/receipt.pdf", oqs.printer_name) - self.print("tmp/receipt.pdf", oqs.printer_name) - else - self.print("tmp/receipt.pdf", oqs.printer_name) - end + order_item = print_query('order_item', item_code) #OrderItem.find_by_item_code(item_code) + + filename = "tmp/order_item_#{order_item[0].item_name}" + ".pdf" + + # check for item not to show + if order_item[0].price != 0 + pdf = OrderItemPdf.new(order_item[0], print_status, options) + pdf.render_file filename + + if oqs.print_copy + self.print(filename, oqs.printer_name) + + #For print copy + pdf.render_file filename.gsub(".","-copy.") + self.print(filename.gsub(".","-copy."), oqs.printer_name) + else + self.print(filename, oqs.printer_name) + end + end end - def print_order_summary(oqs,order_id) + # Query for per order + def print_order_summary(oqs, order_id, order_items, print_status) #Use CUPS service #Generate PDF - #Print - order=print_query('order_summary',order_id) + #Print + order=print_query('order_summary', order_id) # For Print Per Item if oqs.cut_per_item - order.each do|odi| - pdf = OrderItemPdf.new(odi) - pdf.render_file "tmp/receipt.pdf" - if oqs.print_copy - self.print("tmp/receipt.pdf", oqs.printer_name) - self.print("tmp/receipt.pdf", oqs.printer_name) - else - self.print("tmp/receipt.pdf", oqs.printer_name) + order_items.each do|odi| + filename = "tmp/order_item_#{odi.item_name}" + ".pdf" + # For Item Options + options = odi.options == "[]"? "" : odi.options + + # check for item not to show + if odi.price != 0 || odi.price != 10 + pdf = OrderItemPdf.new(odi, print_status, options) + # pdf.render_file "tmp/order_item.pdf" + pdf.render_file filename + if oqs.print_copy + self.print(filename, oqs.printer_name) + self.print(filename.gsub(".","-copy."), oqs.printer_name) + else + self.print(filename, oqs.printer_name) + end end end # For Print Order Summary else - filename = "tmp/order_summary_#{order_id}" + ".pdf" - pdf = OrderSummaryPdf.new(order) + filename = "tmp/order_summary_#{ order_id }" + ".pdf" + pdf = OrderSummaryPdf.new(order, print_status, order_items) pdf.render_file filename - self.print(filename, oqs.printer_name) + if oqs.print_copy + self.print(filename, oqs.printer_name) + + #For print copy + pdf.render_file filename.gsub(".","-copy.") + self.print(filename.gsub(".","-copy."), oqs.printer_name) + else + self.print(filename, oqs.printer_name) + end + end + end + + # Print for orders in booking + def print_booking_summary(oqs, booking_id, print_status) + order=print_query('booking_summary', booking_id) + # For Print Per Item + if oqs.cut_per_item + order.each do|odi| + filename = "tmp/order_item_#{odi.item_name}" + ".pdf" + # For Item Options + options = odi.options == "[]"? "" : odi.options + + # check for item not to show + if odi.price != 0 + pdf = OrderItemPdf.new(odi, print_status, options) + pdf.render_file filename + + if oqs.print_copy + self.print(filename, oqs.printer_name) + + #For print copy + pdf.render_file filename.gsub(".","-copy.") + self.print(filename.gsub(".","-copy."), oqs.printer_name) + else + self.print(filename, oqs.printer_name) + end + end + end + # For Print Order Summary + else + filename = "tmp/booking_summary_#{ booking_id }" + ".pdf" + pdf = OrderSummaryPdf.new(order, print_status) + pdf.render_file filename + if oqs.print_copy + self.print(filename, oqs.printer_name) + + #For print copy + pdf.render_file filename.gsub(".","-copy.") + self.print(filename.gsub(".","-copy."), oqs.printer_name) + else + self.print(filename, oqs.printer_name) + end end end # Query for OQS with status - def print_query(type, code) - if type == 'order_item' - OrderItem.select("order_items.item_code, order_items.item_name, order_items.qty, order_items.price, order_items.item_order_by as order_by, order_items.created_at as order_at, cus.name as customer, df.name as dining") + def print_query(type, id) + 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") .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 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 customers as cus ON cus.customer_id = orders.customer_id") - .where("order_items.item_code='" + code + "'") + .where("order_items.item_code = '#{ id }' AND order_items.price != 0") .group("order_items.item_code") - else - OrderItem.select("order_items.item_code, order_items.item_name, order_items.qty, order_items.price, order_items.item_order_by as order_by, order_items.created_at as order_at, cus.name as customer, df.name as dining") + 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") .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 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 customers as cus ON cus.customer_id = orders.customer_id") - .where("orders.order_id='" + code + "'") - .group("order_items.item_code") + .where("orders.order_id = '#{ id }' AND order_items.price != 0") + .group("order_items.order_items_id") + else + # 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") + .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 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 customers as cus ON cus.customer_id = orders.customer_id") + .where("b.booking_id = '#{ id }' AND order_items.price != 0") end end diff --git a/app/models/printer/receipt_printer.rb b/app/models/printer/receipt_printer.rb index bfef5588..8e389e79 100644 --- a/app/models/printer/receipt_printer.rb +++ b/app/models/printer/receipt_printer.rb @@ -65,11 +65,11 @@ class Printer::ReceiptPrinter < Printer::PrinterWorker end #Bill Receipt Print - def print_receipt_bill(printer_settings,sale_items,sale_data, customer_name, food_total, beverage_total, member_info = nil) + def print_receipt_bill(printer_settings,sale_items,sale_data, customer_name, item_price_by_accounts, member_info = nil,rebate_amount=nil,shop_details) #Use CUPS service #Generate PDF #Print - pdf = ReceiptBillPdf.new(printer_settings, sale_items, sale_data, customer_name, food_total, beverage_total, member_info) + pdf = ReceiptBillPdf.new(printer_settings, sale_items, sale_data, customer_name, item_price_by_accounts, member_info,rebate_amount,shop_details) pdf.render_file "tmp/receipt_bill.pdf" self.print("tmp/receipt_bill.pdf") diff --git a/app/models/room.rb b/app/models/room.rb index d99708a3..87f232e9 100644 --- a/app/models/room.rb +++ b/app/models/room.rb @@ -1,3 +1,4 @@ class Room < DiningFacility + has_many :bookings, :foreign_key => 'dining_facility_id' end diff --git a/app/models/sale.rb b/app/models/sale.rb index 3714c21e..8f7f17d8 100644 --- a/app/models/sale.rb +++ b/app/models/sale.rb @@ -15,6 +15,15 @@ class Sale < ApplicationRecord has_many :bookings scope :open_invoices, -> { where("sale_status = 'new' and receipt_date BETWEEN '#{DateTime.now.utc.end_of_day}' AND '#{DateTime.now.utc.beginning_of_day}'") } + scope :complete_sale, -> { where("sale_status = 'completed' and receipt_date BETWEEN '#{DateTime.now.utc.beginning_of_day}' AND '#{DateTime.now.utc.end_of_day}'") } + + REPORT_TYPE = { + "daily" => 0, + "monthly" => 1, + "yearly" => 2 + } + SALE_STATUS_OUTSTANDING = "outstanding" + SALE_STATUS_COMPLETED = "completed" def generate_invoice_from_booking(booking_id, requested_by) booking = Booking.find(booking_id) @@ -24,7 +33,6 @@ class Sale < ApplicationRecord Rails.logger.debug "Booking -> Booking Order Count -> " + booking.booking_orders.count.to_s #get all order attached to this booking and combine into 1 invoice - puts booking.booking_orders.length booking.booking_orders.each do |order| if booking.sale_id status, sale_id = generate_invoice_from_order(order.order_id, nil, booking, requested_by) @@ -90,6 +98,8 @@ class Sale < ApplicationRecord order.save booking.sale_id = self.id + booking.checkout_at = Time.now.utc.getlocal + booking.checkout_by = requested_by.name booking.save return true, self.id @@ -105,7 +115,7 @@ class Sale < ApplicationRecord def generate_invoice_by_items (items, requested_by) taxable = true self.requested_by = requested_by - self.requested_at = DateTime.now.utc + self.requested_at = DateTime.now.utc.getlocal items.each do |item| add_item(item) @@ -131,6 +141,7 @@ class Sale < ApplicationRecord #pull sale_item.product_code = item.item_code sale_item.product_name = item.item_name + sale_item.account_id = item.account_id sale_item.remark = item.remark sale_item.qty = item.qty @@ -174,7 +185,7 @@ class Sale < ApplicationRecord sales_items.each do |item| #compute each item and added to total subtotal_price = subtotal_price + item.price - total_taxable = total_taxable + item.taxable_price + total_taxable = total_taxable + (item.taxable_price * item.qty) end apply_tax (total_taxable) @@ -188,11 +199,41 @@ class Sale < ApplicationRecord end + def compute_without_void + sales_items = self.sale_items + + #Computation Fields + subtotal_price = 0 + total_taxable = 0 + rounding_adjustment = 0 + + sales_items.each do |item| + if item.remark != 'void' + #compute each item and added to total + subtotal_price = subtotal_price + item.price + total_taxable = total_taxable + item.taxable_price + end + end + + apply_tax (total_taxable) + self.total_amount = subtotal_price + self.total_discount = total_discount + self.grand_total = (self.total_amount - self.total_discount) + self.total_tax + #compute rounding adjustment + adjust_rounding + + self.save! + end # Tax Calculate def apply_tax(total_taxable) + #if tax is not apply create new record + # self.sale_taxes.each do |existing_tax| + # #delete existing and create new + # existing_tax.delete + # end #if tax is not apply create new record - self.sale_taxes.each do |existing_tax| + SaleTax.where("sale_id='#{self.sale_id}'").find_each do |existing_tax| #delete existing and create new existing_tax.delete end @@ -275,6 +316,93 @@ class Sale < ApplicationRecord end end + 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, + 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='master') then sale_payments.payment_amount else 0 end) as master_amount, + SUM(case when (sale_payments.payment_method='visa') then sale_payments.payment_amount else 0 end) as visa_amount, + SUM(case when (sale_payments.payment_method='jcb') then sale_payments.payment_amount else 0 end) as jcb_amount, + SUM(case when (sale_payments.payment_method='paypar') then sale_payments.payment_amount else 0 end) as paypar_amount, + SUM(case when (sale_payments.payment_method='cash') then sale_payments.payment_amount else 0 end) as cash_amount, + SUM(case when (sale_payments.payment_method='credit') then sale_payments.payment_amount else 0 end) as credit_amount, + SUM(case when (sale_payments.payment_method='foc') then sale_payments.payment_amount else 0 end) as foc_amount") + .joins("join (select * from sale_payments group by sale_payments.sale_id, sale_payments.payment_method) sale_payments on sale_payments.sale_id = sales.sale_id") + .where("sale_status = ? AND sales.receipt_date between ? and ? AND total_amount != 0", 'completed', from, to) + .group("DATE_FORMAT((CONVERT_TZ(sales.receipt_date,'+00:00','+06:30')),'%Y-%m-%d')") + + daily_total = Array.new + + payments_total.each do |pay| + sale_date = pay.sale_date + diff_time = payments_total.first.sale_date.beginning_of_day.utc - from + diff = diff_time % 86400 + from_date = sale_date.beginning_of_day.utc - diff + to_date = sale_date.end_of_day.utc - diff + + total_sale = Sale.select("IFNULL(SUM(case when (sale_status='completed') then grand_total else 0 end),0) as grand_total, + IFNULL(SUM(case when (sale_status='completed') then total_discount else 0 end),0) as total_discount, + IFNULL(SUM(case when (sale_status='void') then grand_total else 0 end),0) as void_amount, + IFNULL(SUM(case when (sale_status='completed') then rounding_adjustment else 0 end),0) as rounding_adj") + .where("(sale_status = ? OR sale_status = ?) AND receipt_date between ? and ? AND total_amount != 0", 'completed', 'void', from_date, to_date) + + total_sale.each do |sale| + grand_total = sale.grand_total + total_discount = sale.total_discount + void_amount = sale.void_amount + total = {:sale_date => pay.sale_date, + :mpu_amount => pay.mpu_amount, + :master_amount => pay.master_amount, + :visa_amount => pay.visa_amount, + :jcb_amount => pay.jcb_amount, + :paypar_amount => pay.paypar_amount, + :cash_amount => pay.cash_amount, + :credit_amount => pay.credit_amount, + :foc_amount => pay.foc_amount, + :total_discount => total_discount, + :grand_total => grand_total, + :void_amount => void_amount, + :rounding_adj => sale.rounding_adj} + daily_total.push(total) + end + + end + return daily_total + end + +def self.get_by_range_by_saleitems(from,to,status,report_type) + + query = Sale.select(" + mi.item_code as code,(SUM(i.qty) * i.unit_price) as grand_total, + SUM(i.qty) as total_item," + + " i.unit_price as unit_price, + mi.name as product_name, + mc.name as menu_category_name, + mc.id as menu_category_id ") + .group('mi.id') + .order("mi.menu_category_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_categories mc ON mc.id = mi.menu_category_id + JOIN employees ea ON ea.id = sales.cashier_id") + + + query = query.where("receipt_date between ? and ? and sale_status=?",from,to,status) + + + + case report_type.to_i + when REPORT_TYPE["daily"] + return query + when REPORT_TYPE["monthly"] + + return query.group("MONTH(date)") + when REPORT_TYPE["yearly"] + return query.group("YEAR(date)") + end + +end + private def generate_custom_id diff --git a/app/models/sale_item.rb b/app/models/sale_item.rb index 71373f2d..8881efea 100644 --- a/app/models/sale_item.rb +++ b/app/models/sale_item.rb @@ -30,37 +30,66 @@ class SaleItem < ApplicationRecord # end end - # Calculate food total and beverage total - def self.calculate_food_beverage(sale_items) - food_prices=0 - beverage_prices=0 + def self.calculate_price_by_accounts(sale_items) + price_accounts = [] + Account.all.each do |a| + account_price = {:name => a.title, :price => 0} - sale_items.each do |si| - food_price, beverage_price = self.get_price(si.sale_item_id) - - food_prices = food_prices + food_price - beverage_prices = beverage_prices + beverage_price + sale_items.each do |si| + if si.account_id == a.id + account_price[:price] = account_price[:price] + si.price + end + end + price_accounts.push(account_price) end - return food_prices, beverage_prices + + return price_accounts + end + + # Calculate rebate_by_account + def self.calculate_rebate_by_account(sale_items) + rebateacc = Account.where("rebate=?",true) + puts "Account that can rebate" + rebateacc.each do |i| + puts i.title + end + prices=0 + sale_items.each do |si| + price = self.get_rebate_price(si.sale_item_id,rebateacc) + + prices = prices + price + end + return prices end # get food price or beverage price for item - def self.get_price(sale_item_id) - food_price=0 - beverage_price=0 + def self.get_rebate_price(sale_item_id,rebateacc) + price=0 item=SaleItem.select("sale_items.price , menu_items.account_id") .joins("left join menu_items on menu_items.item_code = sale_items.product_code") .where("sale_items.sale_item_id=?", sale_item_id.to_s) - if item[0].account_id == 1 - food_price = item[0].price - else - beverage_price = item[0].price + + rebateacc.each do |i| + if item[0].account_id == i.id + price = item[0].price + end end - return food_price, beverage_price + return price end + # def self.get_overall_discount(sale_id) + # price = 0.0 + # item=SaleItem.where("product_code=?", sale_id) + # + # item.each do|i| + # price += i.price + # end + # + # return price + # end + private def generate_custom_id self.sale_item_id = SeedGenerator.generate_id(self.class.name, "SLI") diff --git a/app/models/sale_payment.rb b/app/models/sale_payment.rb index 2b0035f3..8b28c946 100644 --- a/app/models/sale_payment.rb +++ b/app/models/sale_payment.rb @@ -9,7 +9,6 @@ class SalePayment < ApplicationRecord attr_accessor :received_amount, :card_payment_reference, :voucher_no, :giftcard_no, :customer_id, :external_payment_status def process_payment(invoice, action_by, cash_amount, payment_method) - self.sale = invoice self.received_amount = cash_amount amount_due = invoice.grand_total @@ -28,7 +27,7 @@ class SalePayment < ApplicationRecord when "cash" payment_status = cash_payment when "creditnote" - if !self.customer_id.nil? + if !self.sale.customer_id.nil? payment_status = creditnote_payment(self.customer_id) end when "visa" @@ -55,7 +54,7 @@ class SalePayment < ApplicationRecord remark = "Payment #{payment_method}- for Invoice #{invoice.receipt_no} Due [#{amount_due}]| pay amount -> #{cash_amount} | Payment Status ->#{payment_status}" sale_audit = SaleAudit.record_payment(invoice.id, remark, action_by) - return true, self.sale + return true, self.save else #record an payment in sale-audit remark = "No outstanding Amount - Grand Total [#{invoice.grand_total}] | Due [#{amount_due}] | Paid [#{invoice.amount_received}]" @@ -66,34 +65,52 @@ class SalePayment < ApplicationRecord end - def self.get_paypar_account(url,token,membership_id,campaign_type_id,merchant_uid,auth_token) + def self.get_paypar_account(url,token,membership_id,campaign_type_id,merchant_uid,auth_token) + # Control for Paypar Cloud + begin response = HTTParty.get(url, - :body => { app_token: token,membership_id:membership_id,campaign_type_id:campaign_type_id,merchant_uid:merchant_uid,auth_token:auth_token}.to_json, - :headers => { - 'Content-Type' => 'application/json', - 'Accept' => 'application/json' - } - ) - return response; - + :body => { app_token: token,membership_id:membership_id,campaign_type_id:campaign_type_id,merchant_uid:merchant_uid,auth_token:auth_token}.to_json, + :headers => { + 'Content-Type' => 'application/json', + 'Accept' => 'application/json' + }, :timeout => 10 + ) + rescue Net::OpenTimeout + response = { status: false } + end + return response; end def self.redeem(paypar_url,token,membership_id,received_amount,sale_id) membership_actions_data = MembershipAction.find_by_membership_type("redeem"); + if !membership_actions_data.nil? + url = paypar_url.to_s + membership_actions_data.gateway_url.to_s merchant_uid = membership_actions_data.merchant_account_id auth_token = membership_actions_data.auth_token campaign_type_id = membership_actions_data.additional_parameter["campaign_type_id"] sale_data = Sale.find_by_sale_id(sale_id) + if sale_data - response = HTTParty.post(url, - :body => { generic_customer_id:membership_id,redeem_amount:received_amount,receipt_no:sale_data.receipt_no,campaign_type_id:campaign_type_id,account_no:"",merchant_uid:merchant_uid,auth_token:auth_token}.to_json, - :headers => { - 'Content-Type' => 'application/json', - 'Accept' => 'application/json' - } - ) + others = 0 + sale_data.sale_payments.each do |sale_payment| + others = others + sale_payment.payment_amount + end + redeem_prices = sale_data.grand_total - others + # Control for Paypar Cloud + begin + response = HTTParty.post(url, + :body => { generic_customer_id:membership_id,total_amount: redeem_prices,total_sale_transaction_amount: sale_data.grand_total,redeem_amount:received_amount,receipt_no:sale_data.receipt_no,campaign_type_id:campaign_type_id,account_no:"",merchant_uid:merchant_uid,auth_token:auth_token}.to_json, + :headers => { + 'Content-Type' => 'application/json', + 'Accept' => 'application/json' + }, + :timeout => 10 + ) + rescue Net::OpenTimeout + response = false + end else response = false; end @@ -119,13 +136,12 @@ class SalePayment < ApplicationRecord end def creditnote_payment(customer_id) - payment_status = false self.payment_method = "creditnote" self.payment_amount = self.received_amount self.customer_id = self.customer_id - self.outstanding_amount = 0 - self.received_amount + self.outstanding_amount = 0 - self.received_amount.to_f self.payment_status = "outstanding" payment_method = self.save! @@ -187,17 +203,17 @@ class SalePayment < ApplicationRecord payment_status = false #Next time - validate if the vochure number is valid - within - self.payment_method = "paypar" - self.payment_amount = self.received_amount - self.payment_reference = self.voucher_no - self.outstanding_amount = self.sale.grand_total.to_f - self.received_amount.to_f - self.payment_status = "pending" - payment_method = self.save! - customer_data = Customer.find_by_customer_id(self.sale.customer_id) membership_setting = MembershipSetting.find_by_membership_type("paypar_url") membership_data = SalePayment.redeem(membership_setting.gateway_url,membership_setting.auth_token,customer_data.membership_id,self.received_amount,self.sale.sale_id) + if membership_data["status"]==true + self.payment_method = "paypar" + self.payment_amount = self.received_amount + self.payment_reference = self.voucher_no + self.outstanding_amount = self.sale.grand_total.to_f - self.received_amount.to_f + self.payment_status = "pending" + payment_method = self.save! SalePayment.where(:sale_payment_id => self.sale_payment_id).update_all(:payment_status => 'paid') sale_update_payment_status(self.received_amount.to_f) @@ -216,11 +232,19 @@ class SalePayment < ApplicationRecord self.sale.amount_changed = self.sale.amount_received.to_f - self.sale.grand_total.to_f all_received_amount = 0.0 sObj = Sale.find(self.sale_id) + is_credit = 0 sObj.sale_payments.each do |spay| all_received_amount += spay.payment_amount.to_f + if spay.payment_method == "creditnote" + is_credit = 1 + end end if (self.sale.grand_total <= all_received_amount) - self.sale.payment_status = "paid" + if is_credit == 0 + self.sale.payment_status = "paid" + else + self.sale.payment_status = "outstanding" + end self.sale.sale_status = "completed" self.sale.save! table_update_status(sObj) @@ -230,10 +254,19 @@ class SalePayment < ApplicationRecord end def table_update_status(sale_obj) - booking = Booking.find_by_sale_id(sale_obj.id) + status = true + booking = Booking.find_by_sale_id(sale_obj.id) if booking table = DiningFacility.find(booking.dining_facility_id) - if table + bookings = table.bookings + bookings.each do |tablebooking| + if tablebooking.booking_status != 'moved' + if tablebooking.sale.sale_status != 'completed' + status = false + end + end + end + if status table.status = "available" table.save end @@ -241,7 +274,8 @@ class SalePayment < ApplicationRecord end def rebat(sObj) - food_prices, beverage_prices = SaleItem.calculate_food_beverage(sObj.sale_items) + rebate_prices = SaleItem.calculate_rebate_by_account(sObj.sale_items) + generic_customer_id = sObj.customer.membership_id if generic_customer_id != nil || generic_customer_id != "" || generic_customer_id != 0 paypar = sObj.sale_payments @@ -251,7 +285,10 @@ class SalePayment < ApplicationRecord payparcost = payparcost + pp.payment_amount end end - total_amount = food_prices - payparcost + # overall_dis = SaleItem.get_overall_discount(sObj.id) + overall_dis = sObj.total_discount + + total_amount = rebate_prices - payparcost + overall_dis if total_amount > 0 receipt_no = sObj.receipt_no membership = MembershipSetting.find_by_membership_type("paypar_url") @@ -261,8 +298,9 @@ class SalePayment < ApplicationRecord auth_token = memberaction.auth_token.to_s url = membership.gateway_url.to_s + memberaction.gateway_url.to_s + # Control for Paypar Cloud begin - response = HTTParty.post(url, :body => { generic_customer_id:generic_customer_id ,merchant_uid:merchant_uid,total_amount: total_amount,campaign_type_id: campaign_type_id, + response = HTTParty.post(url, :body => { generic_customer_id:generic_customer_id ,total_sale_transaction_amount: sObj.grand_total,merchant_uid:merchant_uid,total_amount: total_amount,campaign_type_id: campaign_type_id, receipt_no: receipt_no,auth_token:auth_token}.to_json, :headers => { 'Content-Type' => 'application/json', @@ -271,8 +309,8 @@ class SalePayment < ApplicationRecord rescue Net::OpenTimeout response = { status: false } end - - puts response.to_json + return response + # puts response.to_json end end end diff --git a/app/models/sale_tax.rb b/app/models/sale_tax.rb index 79de9134..7a42905a 100644 --- a/app/models/sale_tax.rb +++ b/app/models/sale_tax.rb @@ -5,6 +5,10 @@ class SaleTax < ApplicationRecord before_create :generate_custom_id belongs_to :sale + def self.get_tax(from,to) + query = SaleTax.select("sale_taxes.tax_name,SUM(sale_taxes.tax_payable_amount) as tax_amount").joins("join sales on sales.sale_id = sale_taxes.sale_id").where("sale_status = ? AND sales.receipt_date between ? and ? AND total_amount != 0", 'completed', from, to).group("sale_taxes.tax_name") + end + private def generate_custom_id self.sale_tax_id = SeedGenerator.generate_id(self.class.name, "STI") diff --git a/app/models/shift_sale.rb b/app/models/shift_sale.rb new file mode 100644 index 00000000..ea7f1132 --- /dev/null +++ b/app/models/shift_sale.rb @@ -0,0 +1,51 @@ + +#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 + + 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") + 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.id}",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(sale) + self.total_revenue = self.total_revenue + saleobj.total_amount + 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.nett_sales = + # self.cash_sales = + # self.credit_sales = + # self.other_sales = + # self.commercial_taxes = + self.save + + end +end diff --git a/app/models/table.rb b/app/models/table.rb index 31614e12..db953c27 100644 --- a/app/models/table.rb +++ b/app/models/table.rb @@ -1,4 +1,4 @@ class Table < DiningFacility has_many :dining_ins - + has_many :bookings, :foreign_key => 'dining_facility_id' end diff --git a/app/models/table_booking.rb b/app/models/table_booking.rb index 4b76f158..3f2b42d7 100644 --- a/app/models/table_booking.rb +++ b/app/models/table_booking.rb @@ -1,3 +1,2 @@ class TableBooking < Booking - end diff --git a/app/pdf/order_item_pdf.rb b/app/pdf/order_item_pdf.rb index 96008dfd..b6c821fc 100644 --- a/app/pdf/order_item_pdf.rb +++ b/app/pdf/order_item_pdf.rb @@ -1,16 +1,16 @@ 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 - def initialize(order_item) - self.page_width = 254 + def initialize(order_item, print_status, options) + self.page_width = 210 self.page_height = 1450 - self.margin = 10 + self.margin = 5 self.price_width = 40 # No Need for item - self.qty_width = 34 + self.qty_width = 30 self.total_width = 40 # No Need for item - self.item_width = self.page_width - (self.qty_width + (self.margin*4)) + self.item_width = self.page_width - self.qty_width self.item_height = 15 self.item_description_width = self.page_width - (self.price_width + self.qty_width + self.total_width) - self.label_width=80 + self.label_width=100 super(:margin => [self.margin, self.margin, self.margin, self.margin], :page_size => [self.page_width, self.page_height]) # super(:margin => [10, 5, 30, 5], :page_size => [200,400]) @@ -18,24 +18,29 @@ class OrderItemPdf < Prawn::Document # font "public/fonts/#{font_name}".to_s + ".ttf".to_s # font "public/fonts/Zawgyi-One.ttf" # font "public/fonts/padauk.ttf" - self.header_font_size = 14 - self.item_font_size = 12 + self.header_font_size = 12 + self.item_font_size = 10 - text "#{order_item.dining}", :size => self.header_font_size,:align => :center, :left_margin => -20 + text "#{ order_item.type + '-' + order_item.dining + print_status }", :size => self.header_font_size,:align => :center, :left_margin => -20 stroke_horizontal_rule move_down 5 #order_info - order_info(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_item) + order_items(order_item, options) end # Write Order Information to PDF - def order_info(order_by, order_at) + def order_info(order_no, order_by, order_at) y_position = cursor + bounding_box([0,y_position], :width => self.item_width, :height => self.item_height) do + text "OrderNo: #{order_no} ", :size => self.item_font_size,:align => :left + end + move_down 5 + y_position = cursor bounding_box([0,y_position], :width => self.item_width, :height => self.item_height) do text "OrderBy: #{order_by} ", :size => self.item_font_size,:align => :left end @@ -43,7 +48,7 @@ class OrderItemPdf < Prawn::Document move_down 5 y_position = cursor bounding_box([0,y_position], :width => self.item_width, :height => self.item_height) do - text "Date: #{order_at.strftime("%Y-%m-%d %I:%M %p")}", :size => self.item_font_size,:align => :left + text "Date: #{order_at.utc.getlocal.strftime("%Y-%m-%d %I:%M %p")}", :size => self.item_font_size,:align => :left end stroke_horizontal_rule @@ -52,31 +57,19 @@ class OrderItemPdf < Prawn::Document end # Write Order items to PDF - def order_items(order_item) + def order_items(order_item, options) y_position = cursor - # No Need for Order Item - # bounding_box([0,y_position], :width => self.item_width, :height => self.item_height) do - # text "Item", :size => self.item_font_size,:align => :left - # end - - # bounding_box([self.item_width,y_position], :width => self.qty_width, :height => self.item_height) do - # text "Qty", :size => self.item_font_size,:align => :right - # end - - # stroke_horizontal_rule - # move_down 5 - - #Add Order Item - add_order_items(order_item) + #Add Order Item + add_order_items(order_item, options) dash(1, :space => 1, :phase => 1) - stroke_horizontal_line 0, self.page_width + stroke_horizontal_line 0, (self.page_width - self.margin) move_down 5 end # Add order items under order info - def add_order_items(order_item) + def add_order_items(order_item, options) y_position = cursor move_down 5 @@ -91,6 +84,14 @@ class OrderItemPdf < Prawn::Document move_down 5 + # add option + y_position = cursor + bounding_box([0,y_position], :width => self.item_width, :height => self.item_height) do + text "#{options}", :size => self.item_font_size,:align => :left + end + + move_down 5 + end end diff --git a/app/pdf/order_summary_pdf.rb b/app/pdf/order_summary_pdf.rb index 47c1f6a5..89eac43c 100644 --- a/app/pdf/order_summary_pdf.rb +++ b/app/pdf/order_summary_pdf.rb @@ -1,13 +1,13 @@ 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 - def initialize(order) - self.page_width = 254 + def initialize(order, print_status, order_items = nil) + self.page_width = 210 self.page_height = 1450 - self.margin = 10 + self.margin = 5 self.price_width = 40 # No Need for item - self.qty_width = 34 + self.qty_width = 30 self.total_width = 40 # No Need for item - self.item_width = self.page_width - (self.qty_width + (self.margin*4)) + self.item_width = self.page_width - (self.qty_width - self.margin) self.item_height = 15 self.item_description_width = self.page_width - (self.price_width + self.qty_width + self.total_width) self.label_width=100 @@ -20,22 +20,30 @@ class OrderSummaryPdf < Prawn::Document self.header_font_size = 12 self.item_font_size = 10 - text "#{order[0].dining}", :size => self.header_font_size,:align => :center, :left_margin => -20 + text "#{ order[0].type + '-' + order[0].dining + print_status }", :size => self.header_font_size,:align => :center, :left_margin => -20 stroke_horizontal_rule move_down 5 #order_info - order_info(order[0].order_by,order[0].order_at) + order_info(order[0].order_id, order[0].order_by,order[0].order_at) # order items - order_items(order) - + if order_items == nil + order_items(order) + else + order_items(order_items) + end end # Write Order Information to PDF - def order_info(order_by, order_at) + def order_info(order_no, order_by, order_at) y_position = cursor + bounding_box([0,y_position], :width => self.item_width, :height => self.item_height) do + text "OrderNo: #{order_no} ", :size => self.item_font_size,:align => :left + end + move_down 5 + y_position = cursor bounding_box([0,y_position], :width => self.item_width, :height => self.item_height) do text "OrderBy: #{order_by} ", :size => self.item_font_size,:align => :left end @@ -43,7 +51,7 @@ class OrderSummaryPdf < Prawn::Document move_down 5 y_position = cursor bounding_box([0,y_position], :width => self.item_width, :height => self.item_height) do - text "Date: #{order_at.strftime("%Y-%m-%d %I:%M %p")}", :size => self.item_font_size,:align => :left + text "Date: #{order_at.utc.getlocal.strftime("%Y-%m-%d %I:%M %p")}", :size => self.item_font_size,:align => :left end stroke_horizontal_rule @@ -59,7 +67,7 @@ class OrderSummaryPdf < Prawn::Document text "Item", :size => self.item_font_size,:align => :left end - bounding_box([self.item_width,y_position], :width => self.qty_width, :height => self.item_height) do + bounding_box([self.item_width-2,y_position], :width => self.qty_width, :height => self.item_height) do text "Qty", :size => self.item_font_size,:align => :left end @@ -68,6 +76,7 @@ class OrderSummaryPdf < Prawn::Document #Add Order Item add_order_items(order_item) + end # Add order items under order info @@ -77,16 +86,38 @@ class OrderSummaryPdf < Prawn::Document move_down 5 order_item.each do|odi| - bounding_box([0,y_position], :width => self.item_width, :height => self.item_height) do - text "#{odi.item_name}", :size => self.item_font_size,:align => :left + # check for item not to show + if odi.price != 0 + y_position = cursor + + bounding_box([0,y_position], :width => self.item_width) do + text "#{odi.item_name}", :size => self.item_font_size,:align => :left + end + + bounding_box([self.item_width,y_position], :width => self.qty_width) do + text "#{odi.qty}", :size => self.item_font_size,:align => :left + end + + move_down 5 + + # add option + options = odi.options == "[]"? "" : odi.options + + if options != "" + y_position = cursor + bounding_box([0,y_position], :width => self.item_width) do + text "#{options}", :size => self.item_font_size,:align => :left + end + + move_down 5 + end + + move_down 5 + + dash(1, :space => 1, :phase => 1) + stroke_horizontal_line 0, (self.page_width - self.margin) + move_down 5 end - - bounding_box([self.item_width,y_position], :width => self.qty_width, :height => self.item_height) do - text "#{odi.qty}", :size => self.item_font_size,:align => :left - end - end - - move_down 5 - + end end end diff --git a/app/pdf/queue_no_pdf.rb b/app/pdf/queue_no_pdf.rb index 704dbfdb..0963f55e 100644 --- a/app/pdf/queue_no_pdf.rb +++ b/app/pdf/queue_no_pdf.rb @@ -2,7 +2,7 @@ class QueueNoPdf < 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 def initialize(printer_settings, queue) self.page_width = 210 - self.page_height = 2500 + self.page_height = 1450 self.margin = 5 self.price_width = 35 self.qty_width = 20 diff --git a/app/pdf/receipt_bill_pdf.rb b/app/pdf/receipt_bill_pdf.rb index 6cacc391..4ae0a67d 100644 --- a/app/pdf/receipt_bill_pdf.rb +++ b/app/pdf/receipt_bill_pdf.rb @@ -1,12 +1,12 @@ class ReceiptBillPdf < 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 - def initialize(printer_settings, sale_items, sale_data, customer_name, food_total, beverage_total, member_info = nil) + def initialize(printer_settings, sale_items, sale_data, customer_name, item_price_by_accounts, member_info = nil,rebate_amount = nil,shop_details) self.page_width = 210 - self.page_height = 2500 + self.page_height = 7000 self.margin = 5 - self.price_width = 35 + self.price_width = 40 self.qty_width = 20 - self.total_width = 35 + self.total_width = 40 self.item_width = self.page_width - ((self.price_width + self.qty_width + self.total_width)) self.item_height = 15 self.item_description_width = (self.page_width-20) / 2 @@ -24,26 +24,35 @@ class ReceiptBillPdf < Prawn::Document self.header_font_size = 10 self.item_font_size = 8 - header( "Beauty In the Pot", printer_settings.name) + header( shop_details) stroke_horizontal_rule cashier_info(sale_data, customer_name) - line_items(sale_items, food_total, beverage_total) + line_items(sale_items) all_total(sale_data) + if member_info != nil - member_info(member_info) + member_info(member_info,customer_name,rebate_amount,sale_data) end + + customer(customer_name) + + items_account(item_price_by_accounts) + footer end - def header (printer_name, name) - text "#{printer_name}", :left_margin => -10, :size => self.header_font_size,:align => :center + def header (shop_details) + move_down 7 + text "#{shop_details.name}", :left_margin => -10, :size => self.header_font_size,:align => :center move_down 5 - text "#{name}", :size => self.header_font_size,:align => :center + text "#{shop_details.address}", :size => self.item_font_size,:align => :center # move_down self.item_height move_down 5 + text "#{shop_details.phone_no}", :size => self.item_font_size,:align => :center + move_down 5 stroke_horizontal_rule end @@ -53,77 +62,82 @@ class ReceiptBillPdf < Prawn::Document # move_down 2 y_position = cursor bounding_box([0,y_position], :width =>self.label_width, :height => self.item_height) do - text "Receipt No:", :size => self.item_font_size,:align => :left + text "Receipt No: #{sale_data.receipt_no}", :size => self.item_font_size,:align => :left end - - bounding_box([self.label_width, y_position], :width =>self.item_width) do - text "#{sale_data.receipt_no}" , :size => self.item_font_size, :align => :left + bounding_box([self.label_width,y_position], :width => self.label_width, :height => self.item_height) do + text "#{ sale_data.bookings[0].dining_facility.type } - #{ sale_data.bookings[0].dining_facility.name }" , :size => self.item_font_size,:align => :right end move_down 5 y_position = cursor - bounding_box([0,y_position], :width =>self.label_width, :height => self.item_height) do - text "Customer:", :size => self.item_font_size,:align => :left + bounding_box([0, y_position], :width =>self.item_width) do + text "Waiter: #{sale_data.requested_by}" , :size => self.item_font_size, :align => :left end - bounding_box([self.label_width,y_position], :width =>self.item_width) do - text "#{customer_name}" , :size => self.item_font_size,:align => :left + move_down 5 + + y_position = cursor + bounding_box([0,y_position], :width =>self.item_width, :height => self.item_height) do + text "Cashier: #{sale_data.cashier_name}", :size => self.item_font_size,:align => :left end move_down 5 y_position = cursor - bounding_box([0,y_position], :width =>self.label_width, :height => self.item_height) do - text "Date:", :size => self.item_font_size,:align => :left - end - bounding_box([self.label_width,y_position], :width => self.item_width) do - text "#{sale_data.receipt_date.strftime('%Y-%m-%d %I:%M %p')}" , :size => self.item_font_size,:align => :left + 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 end + + # bounding_box([self.item_description_width,y_position], :width =>self.label_width+5) do + # text "(#{ sale_data.bookings[0].checkin_at.utc.getlocal.strftime('%I:%M %p') } + # - #{ sale_data.bookings[0].checkin_at.utc.getlocal.strftime('%I:%M %p') })" , + # :size => self.item_font_size,:align => :right + # end + move_down 5 stroke_horizontal_rule - move_down 5 end - def line_items(sale_items, food_total, beverage_total) - y_position = cursor - - pad_top(15) { - # @item_width.to_i + @half_qty.to_i - text_box "Items", :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 "Qty", :at =>[(self.item_width+self.price_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", :at =>[(self.item_width+self.price_width),y_position], :width => self.total_width+5, :height =>self.item_height, :size => self.item_font_size, :align => :right, :overflow => :shrink_to_fix - - } - + def line_items(sale_items) move_down 5 + y_position = cursor + move_down 5 + pad_top(15) { + # @item_width.to_i + @half_qty.to_i + text_box "Items", :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 "Qty", :at =>[(self.item_width+self.price_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", :at =>[(self.item_width+self.price_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 -5 stroke_horizontal_rule - - add_line_item_row(sale_items, food_total, beverage_total) - + add_line_item_row(sale_items) end - def add_line_item_row(sale_items, food_total, beverage_total) + def add_line_item_row(sale_items) item_name_width = (self.item_width+self.price_width) y_position = cursor move_down 5 sub_total = 0.0 sale_items.each do |item| - sub_total += (item.qty*item.unit_price) - qty = item.qty - total_price = item.qty*item.unit_price - price = item.unit_price - product_name = item.product_name + # check for item not to show + if item.price != 0 + sub_total += (item.qty*item.unit_price) + qty = item.qty + total_price = item.qty*item.unit_price + price = item.unit_price + product_name = item.product_name - y_position = cursor + y_position = cursor - pad_top(15) { - text_box "#{product_name}", :at =>[0,y_position], :width => self.item_width, :height =>self.item_height, :overflow => :shrink_to_fix, :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 "#{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),y_position], :width =>self.total_width+5, :height =>self.item_height, :size => self.item_font_size, :align => :right, :overflow => :shrink_to_fix - } - move_down 3 + 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 "#{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 "#{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 + } + move_down 1 + end end stroke_horizontal_rule @@ -135,25 +149,12 @@ class ReceiptBillPdf < Prawn::Document end bounding_box([self.item_description_width,y_position], :width =>self.label_width) do text "#{ sub_total }" , :size => self.item_font_size,:align => :right - end - - # Food and Beverage - food_beverage_total = food_total.to_s + "/" + beverage_total.to_s - - move_down 5 - - y_position = cursor - bounding_box([0,y_position], :width => self.item_description_width, :height => self.item_height) do - text "Food/Beverage Total", :size => self.item_font_size,:align => :left - end - bounding_box([self.item_description_width,y_position], :width => self.label_width) do - text "#{ food_beverage_total }" , :size => self.item_font_size,:align => :right - end + end + move_down 5 end def all_total(sale_data) item_name_width = self.item_width - move_down 5 y_position = cursor bounding_box([0,y_position], :width =>self.item_description_width, :height => self.item_height) do @@ -163,7 +164,7 @@ class ReceiptBillPdf < Prawn::Document text "( " +"#{sale_data.total_discount}" +" )" , :size => self.item_font_size,:align => :right end - if sale_data.sale_taxes.length > 1 + if sale_data.sale_taxes.length > 0 sale_data.sale_taxes.each do |st| move_down 5 y_position = cursor @@ -193,32 +194,127 @@ class ReceiptBillPdf < Prawn::Document y_position = cursor move_down 5 bounding_box([0,y_position], :width =>self.item_description_width, :height => self.item_height) do - text "Grand Total", :size => self.item_font_size,:align => :left + text "Grand Total", :size => self.header_font_size,:align => :left end bounding_box([self.item_description_width,y_position], :width =>self.label_width) do - text "#{sale_data.grand_total}" , :size => self.item_font_size,:align => :right + text "#{sale_data.grand_total}" , :size => self.header_font_size,:align => :right end move_down 5 - # stroke_horizontal_rule + + sale_payment(sale_data) + + end + + def sale_payment(sale_data) + + stroke_horizontal_rule + move_down 5 + SalePayment.where('sale_id = ?', sale_data.sale_id).each do |payment| + + y_position = cursor + bounding_box([0,y_position], :width =>self.item_description_width, :height => self.item_height) do + text "#{payment.payment_method.capitalize} Payment", :size => self.item_font_size,:align => :left + end + bounding_box([self.item_description_width,y_position], :width =>self.label_width) do + text "#{ payment.payment_amount }" , :size => self.item_font_size,:align => :right + end + move_down 5 + end + if sale_data.amount_received > 0 + y_position = cursor + move_down 5 + bounding_box([0,y_position], :width =>self.item_description_width, :height => self.item_height) do + text "Change Amount", :size => self.item_font_size,:align => :left + end + 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 + end + move_down 5 + end + end # show member information - def member_info(member_info) + def member_info(member_info,customer_name,rebate_amount,sale_data) - move_down 7 + if rebate_amount != nil + + if rebate_amount["status"] == true + stroke_horizontal_rule + rebate_amount["data"].each do |res| + + if res["receipt_no"]== sale_data.receipt_no && res["status"]== "Rebate" + + move_down 5 + y_position = cursor + bounding_box([0,y_position], :width =>self.item_description_width, :height => self.item_height) do + text "Current Rebate Amount", :size => self.item_font_size,:align => :left + end + bounding_box([self.item_description_width,y_position], :width =>self.label_width) do + text "#{ res["rebate"] }" , :size => self.item_font_size,:align => :right + end + end + if res["receipt_no"]== sale_data.receipt_no && res["status"]== "Redeem" + + move_down 5 + y_position = cursor + bounding_box([0,y_position], :width =>self.item_description_width, :height => self.item_height) do + text "Current Redeem Amount", :size => self.item_font_size,:align => :left + end + bounding_box([self.item_description_width,y_position], :width =>self.label_width) do + text "(#{ res["redeem"] })" , :size => self.item_font_size,:align => :right + end + end + + end + end + end if member_info["status"] == true + balance = 0.0 member_info["data"].each do |res| - move_down 5 - y_position = cursor - bounding_box([0,y_position], :width =>self.item_description_width, :height => self.item_height) do - text "#{ res["accountable_type"] }", :size => self.item_font_size,:align => :left - end - bounding_box([self.item_description_width,y_position], :width =>self.label_width) do - text "#{ res["balance"] }" , :size => self.item_font_size,:align => :right + if res["accountable_type"] == "RebateAccount" || res["accountable_type"] == "RebatebonusAccount" + balance = balance + res["balance"] + end end + move_down 5 + y_position = cursor + bounding_box([0,y_position], :width =>self.item_description_width, :height => self.item_height) do + text "Current Balance", :size => self.item_font_size,:align => :left + end + bounding_box([self.item_description_width,y_position], :width =>self.label_width) do + text "#{ balance }" , :size => self.item_font_size,:align => :right + end + end + + end + + def customer(customer_name) + move_down 5 + y_position = cursor + bounding_box([0,y_position], :width =>self.item_description_width, :height => self.item_height) do + text "Customer Name", :size => self.item_font_size,:align => :left + end + bounding_box([self.item_description_width,y_position], :width =>self.label_width) do + text "#{ customer_name }" , :size => self.item_font_size,:align => :right + end + end + + def items_account(item_price_by_accounts) + move_down 5 + stroke_horizontal_rule + move_down 5 + y_position = cursor + item_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 "#{ ipa[:name] }", :size => self.item_font_size,:align => :left + end + bounding_box([self.item_description_width,y_position], :width =>self.label_width) do + text "#{ ipa[:price] }" , :size => self.item_font_size,:align => :right + end end end @@ -233,3 +329,4 @@ class ReceiptBillPdf < Prawn::Document end end + diff --git a/app/views/api/bookings/show.json.jbuilder b/app/views/api/bookings/show.json.jbuilder index e1ebd5a9..a8236f05 100644 --- a/app/views/api/bookings/show.json.jbuilder +++ b/app/views/api/bookings/show.json.jbuilder @@ -1,4 +1,5 @@ if (@booking) + json.success true json.id @booking.booking_id json.status @booking.booking_status if Sale.exists?(@booking.sale_id) @@ -43,5 +44,6 @@ if (@booking) json.sub_total @total_amount json.commerical_tax @total_amount * 0.05 json.total @total_amount + (@total_amount * 0.05) - +else + json.success false end diff --git a/app/views/api/customers/index.json.jbuilder b/app/views/api/customers/index.json.jbuilder index 900e6c6b..0d1d37e7 100644 --- a/app/views/api/customers/index.json.jbuilder +++ b/app/views/api/customers/index.json.jbuilder @@ -1 +1,3 @@ -json.array! @customers, :id, :name, :company, :contact_no, :email, :membership_id, :membership_type +json.array! @customers, :id, :name, :company, :contact_no,:salutation, + :gender,:nrc_no,:address,:card_no, :membership_type, + :membership_id, :created_at diff --git a/app/views/api/customers/show.json.jbuilder b/app/views/api/customers/show.json.jbuilder index 79397308..acf54ac1 100644 --- a/app/views/api/customers/show.json.jbuilder +++ b/app/views/api/customers/show.json.jbuilder @@ -1,4 +1,6 @@ -json.extract! @customer, :id, :name, :company, :contact_no, :membership_type, :membership_id, :created_at +json.extract! @customer, :id, :name, :company, :contact_no,:salutation, + :gender,:nrc_no,:address,:card_no, :membership_type, + :membership_id, :created_at json.invoices do json.array! @customer.lastest_invoices ,:id, :receipt_no, :receipt_date, :sale_status, :payment_status end diff --git a/app/views/api/orders/view_orders.json.jbuilder b/app/views/api/orders/view_orders.json.jbuilder new file mode 100644 index 00000000..b2c960af --- /dev/null +++ b/app/views/api/orders/view_orders.json.jbuilder @@ -0,0 +1,49 @@ +if (@booking) + json.success true + json.booking_id @booking.booking_id + json.status @booking.booking_status + if Sale.exists?(@booking.sale_id) + json.sale_status Sale.find(@booking.sale_id).sale_status + else + json.sale_status "" + end + json.checkin_at @booking.checkin_at.strftime("%d-%m-%Y") + json.checkin_by @booking.checkin_by + json.table_name @booking.dining_facility.name + + if @booking.type == "TableBooking" + json.table_id @booking.dining_facility_id + else + json.room_id @booking.dining_facility_id + end + @total_amount = 0.00 + @total_tax = 0.00 + + if @booking.booking_orders + order_items = [] + @booking.booking_orders.each do |bo| + order = Order.find(bo.order_id) + if (order.status == "new") + order_items = order_items + order.order_items + end + end + + json.order_items order_items do |item| + json.item_instance_code item.item_code + json.item_name item.item_name + json.price item.price + json.qty item.qty + json.options item.options + json.remark item.remark + json.item_status item.order_item_status + @total_amount = @total_amount + (item.price * item.qty) + end + + end + + json.sub_total @total_amount + json.commerical_tax @total_amount * 0.05 + json.total @total_amount + (@total_amount * 0.05) +else + json.success false +end diff --git a/app/views/api/restaurant/zones/index.json.jbuilder b/app/views/api/restaurant/zones/index.json.jbuilder index cbcf1424..e2d040c6 100644 --- a/app/views/api/restaurant/zones/index.json.jbuilder +++ b/app/views/api/restaurant/zones/index.json.jbuilder @@ -8,7 +8,7 @@ if @zones json.name table.name json.status table.status json.zone_id table.zone_id #Add this zone_id to keep data structure consistance - json.current_booking table.get_current_booking + json.current_booking table.get_current_booking.booking_id rescue "" end json.rooms zone.rooms do |room| @@ -16,7 +16,7 @@ if @zones json.name room.name json.status room.status json.zone_id room.zone_id #Add this zone_id to keep data structure consistance - json.current_booking room.get_current_booking + json.current_booking room.get_current_booking.booking_id rescue "" end end @@ -26,7 +26,7 @@ else #list all tables and rooms with out zones json.name table.name json.status table.status json.zone_id table.zone_id #Add this zone_id to keep data structure consistance - json.current_booking table.get_current_booking + json.current_booking table.get_current_booking.booking_id rescue "" end @@ -35,7 +35,7 @@ else #list all tables and rooms with out zones json.name room.name json.status room.status json.zone_id room.zone_id #Add this zone_id to keep data structure consistance - json.current_booking room.get_current_booking + json.current_booking room.get_current_booking.booking_id rescue "" end diff --git a/app/views/crm/customers/_card_read_form.html.erb b/app/views/crm/customers/_card_read_form.html.erb new file mode 100644 index 00000000..4d6a9528 --- /dev/null +++ b/app/views/crm/customers/_card_read_form.html.erb @@ -0,0 +1,20 @@ + + \ No newline at end of file diff --git a/app/views/crm/customers/_crm_customer.json.jbuilder b/app/views/crm/customers/_crm_customer.json.jbuilder index c80c1716..1b1b237e 100644 --- a/app/views/crm/customers/_crm_customer.json.jbuilder +++ b/app/views/crm/customers/_crm_customer.json.jbuilder @@ -1,2 +1,2 @@ -json.extract! crm_customer, :id, :name, :company, :contact_no, :email, :date_of_birth, :membership_id, :membership_type, :membership_authentication_code, :created_at, :updated_at +json.extract! crm_customer, :id, :name, :company, :contact_no, :email, :date_of_birth, :membership_id, :membership_type, :membership_authentication_code, :created_at, :updated_at,:salutation, :gender,:nrc_no,:address,:card_no json.url crm_customer_url(crm_customer, format: :json) diff --git a/app/views/crm/customers/_error_messages.html.erb b/app/views/crm/customers/_error_messages.html.erb deleted file mode 100644 index bbff284b..00000000 --- a/app/views/crm/customers/_error_messages.html.erb +++ /dev/null @@ -1,9 +0,0 @@ -
- -
diff --git a/app/views/crm/customers/_new_form.html.erb b/app/views/crm/customers/_new_form.html.erb new file mode 100644 index 00000000..d52c0456 --- /dev/null +++ b/app/views/crm/customers/_new_form.html.erb @@ -0,0 +1,117 @@ +
+ + <%= simple_form_for @crm_customer,:url => crm_customers_path, :method => :post do |f| %> + + + <%= f.hidden_field :id, :class => "form-control col-md-6 " %> + +
"> + <%= f.input :card_no, :class => "form-control col-md-6 card_no"%> + <% flash.each do |name, msg| %> + <% str="[\"#{msg['name']}\"]" + str.gsub!('["', '') + str.gsub!('"]', '') %> + <%= str %> + <% end -%> +
+ +
+
+ + <%= f.radio_button :salutation,"Mr", :class => "salutation mr", :value=>"Mr", :style=>"width: 30px"%> + + <%= f.radio_button :salutation,"Mrs", :class => "salutation mrs", :value=>"Mrs", :style=>"width: 30px"%> + + <%= f.radio_button :salutation,"Miss", :class => "salutation miss", :value=>"Miss", :style=>"width: 30px"%> + + <%= f.radio_button :salutation,"Mdm", :class => "salutation mdm", :value=>"Mdm", :style=>"width: 30px"%> +
+ +
"> + <%= f.input :name, :class => "form-control col-md-6 name", :required => true %> + <% flash.each do |name, msg| %> + <% str="[\"#{msg['name']}\"]" + str.gsub!('["', '') + str.gsub!('"]', '') %> + <%= str %> + <% end -%> +
+ +
+
+ + <%= f.radio_button :gender,"Male", :class => "gender male", :value=>"Male", :style=>"width: 30px"%> + + <%= f.radio_button :gender,"Female", :class => "gender female", :value=>"Female", :style=>"width: 30px"%> +
+ +
+ <%= f.input :nrc_no, :class => "form-control nrc_no" %> +
+ +
+ <%= f.input :company, :class => "form-control col-md-6 company",:required => true%> + + <% flash.each do |name, msg| %> + <% str="[\"#{msg['company']}\"]" + str.gsub!('["', '') + str.gsub!('"]', '') %> + <%= str %> + <% end -%> +
+
"> + <%= f.input :contact_no, :class => "form-control col-md-6 contact_no" ,:required => true%> + + <% flash.each do |name, msg| %> + <% str="[\"#{msg['contact_no']}\"]" + str.gsub!('["', '') + str.gsub!('"]', '') %> + <%= str %> + <% end -%> +
+ +
"> + <%= f.input :email, :class => "form-control col-md-6 email" ,:required => true%> + + <% flash.each do |name, msg| %> + <% str="[\"#{msg['contact_no']}\"]" + str.gsub!('["', '') + str.gsub!('"]', '') %> + <%= str %> + <% end -%> +
+ +
+ <%= f.input :address, :class => "form-control col-md-6 address" %> +
+ +
+ + +
+ +
+ + <%= f.text_field :date_of_birth,:value=>"01-01-1990",:class=>"form-control datepicker"%> +
+ +
+ + + +
+ + +
+ <%= f.button :submit, "Submit",:class => 'btn btn-primary ', :id => 'submit_customer' %> + <%= f.button :submit, "Update",:class => 'btn btn-primary ', :disabled =>'', :id => 'update_customer' %> + <%= f.button :button, "Reset",:class => 'btn btn-danger ', :id => 'reset' %> +
+ <%end%> +
\ No newline at end of file diff --git a/app/views/crm/customers/index.html.erb b/app/views/crm/customers/index.html.erb index f97de091..b3c1fce7 100644 --- a/app/views/crm/customers/index.html.erb +++ b/app/views/crm/customers/index.html.erb @@ -11,8 +11,6 @@ - -
@@ -26,30 +24,36 @@ <%= form_tag crm_customers_path, :method => :get do %>
- - + + + + +
<% end %> Select + Sr.no Name - Company + Card No Contact no Email + Action - <% if @crm_customers.count > 0 %> + <% @i = 0 %> <% @crm_customers.each do |crm_customer| %> - <% if crm_customer.customer_id != "CUS-000000000001" && crm_customer.customer_id != "CUS-000000000002" %> + <% if crm_customer.customer_id != "CUS-00001" && crm_customer.customer_id != "CUS-000000000" %> + <%= @i += 1 %> <%= crm_customer.name %> - <%= crm_customer.company rescue '-' %> + <%= crm_customer.card_no rescue '-' %> <%= crm_customer.contact_no %> <%= crm_customer.email %> <%= link_to 'Show', crm_customer_path(crm_customer) %> @@ -57,9 +61,7 @@ <% end %> <% end %> - <%else%> -

There are no record for your search

- <% end %> +
@@ -67,85 +69,33 @@ <%= paginate @crm_customers %>
- + <%= render 'card_read_form' %> -
- <%= simple_form_for @crm_customer,:url => crm_customers_path, :method => :post do |f| %> + <%= render 'new_form', crm_customer: @crm_customer %> - - <%= f.hidden_field :id, :class => "form-control col-md-6 " %> - -
"> - <%= f.input :name, :class => "form-control col-md-6 name" %> - <% flash.each do |name, msg| %> - <%= msg['name'] %> - <% end -%> - -
-
- <%= f.input :company, :class => "form-control col-md-6 company" %> -
-
"> - <%= f.input :contact_no, :class => "form-control col-md-6 contact_no" %> - <% flash.each do |name, msg| %> - <%= msg['contact_no'] %> - <% end -%> -
- -
"> - <%= f.input :email, :class => "form-control col-md-6 email" %> - - <% flash.each do |name, msg| %> - <%= msg['email'] %> - <% end -%> -
- -
- - <%= f.text_field :date_of_birth,:value=>"01-01-1990",:class=>"form-control datepicker"%> -
- -
- - - -
- - -
- <%= f.button :submit, "Submit",:class => 'btn btn-primary ', :id => 'submit_customer' %> - <%= f.button :submit, "Update",:class => 'btn btn-primary ', :disabled =>'', :id => 'update_customer' %> - <%= f.button :button, "Reset",:class => 'btn btn-danger ', :id => 'reset' %> -
- <%end%> -
-
-
+
+
Back -
+
+ diff --git a/app/views/crm/dining_queues/index.html.erb b/app/views/crm/dining_queues/index.html.erb index 7050885d..813be2cf 100644 --- a/app/views/crm/dining_queues/index.html.erb +++ b/app/views/crm/dining_queues/index.html.erb @@ -9,39 +9,42 @@
-
+ +
-
- <% @i = 0 %> . - <% @dining_queues.each do |queue| %> -
-
" style="border:1px solid #ccc;margin-bottom: 10px "> -
- - -

<%= @i += 1 %> . Queue No

-

<%= queue.queue_no %>

-

- Name : <%= queue.name %>
- Contact : <%= queue.contact_no %> -
- Status : <%= queue.status rescue '-' %> -

-
-
+
-
- <% end %> -
- - -
+ +
+
+
+ <% @i =0 %> + <% @dining_queues.each do |queue| %> +
" data-id="<%= queue.id %>"> +
+ + + + <%= @i += 1 %> . Queue No + Seater : <%= queue.seater %> +

+ <%= queue.queue_no %> +

+ +
+
+ + <% end %> +
+
+
+
+ +
- -
\ No newline at end of file diff --git a/app/views/home/dashboard.html.erb b/app/views/home/dashboard.html.erb index f77959cd..6b49c880 100644 --- a/app/views/home/dashboard.html.erb +++ b/app/views/home/dashboard.html.erb @@ -1,7 +1,7 @@
- <%= current_login_employee.name %> + <% if current_login_employee.role = "admin" %> <% elsif current_login_employee.role = "cashier" %> <%= link_to "Cashier Station", origami_path %> @@ -13,7 +13,23 @@ <%= link_to "Cashier Station", oishi_path %> <% end %> + <% shop = Shop.first %> + + + +
+ +
+ <%= shop.address %> +
+
+ <%= shop.phone_no %> +
+ +
diff --git a/app/views/home/index.html.erb b/app/views/home/index.html.erb index 35eb6481..87bf3f50 100644 --- a/app/views/home/index.html.erb +++ b/app/views/home/index.html.erb @@ -1,7 +1,7 @@ - + +
+
+
+ + <% @employees.each do |employee| %> + +
+
+
+

+ <%= employee.name %> +

+
+ (<%= employee.emp_id%>) +
+ +
+
+ <% end %> +
+
+ + diff --git a/app/views/home/show.html.erb b/app/views/home/show.html.erb new file mode 100644 index 00000000..b9418d22 --- /dev/null +++ b/app/views/home/show.html.erb @@ -0,0 +1,86 @@ + + +
+
+ <%= simple_form_for(@login_form, url: emp_login_update_path, method: "PATCH") do |f| %> +
+
+
+ <%= f.input :emp_id,as: :hidden, label: "Access PIN", required: false, class: "form-control" %> + + <%= f.input :password, label: "Access PIN", required: false, class: "form-control" %> +
+
+
+
+
+
1
+
2
+
3
+
+
+
4
+
5
+
6
+
+
+
7
+
8
+
9
+
+
+
CLR
+
0
+
ENT
+
+
+ + +
+ + <% end %> +
+
+ + diff --git a/app/views/layouts/CRM.html.erb b/app/views/layouts/CRM.html.erb index f1a43726..dc6cfc61 100644 --- a/app/views/layouts/CRM.html.erb +++ b/app/views/layouts/CRM.html.erb @@ -11,6 +11,8 @@ <%= stylesheet_link_tag 'CRM', media: 'all', 'data-turbolinks-track': 'reload' %> <%= javascript_include_tag 'CRM', 'data-turbolinks-track': 'reload' %> + <%= stylesheet_link_tag 'jquery-confirm', media: 'all', 'data-turbolinks-track': 'reload' %> + <%= javascript_include_tag 'jquery-confirm', 'data-turbolinks-track': 'reload' %> diff --git a/app/views/layouts/OQS.html.erb b/app/views/layouts/OQS.html.erb index 9f736336..102edba2 100644 --- a/app/views/layouts/OQS.html.erb +++ b/app/views/layouts/OQS.html.erb @@ -23,7 +23,6 @@
<% end %> <%= yield %> - diff --git a/app/views/layouts/_header.html.erb b/app/views/layouts/_header.html.erb index a385806c..05b74b7a 100644 --- a/app/views/layouts/_header.html.erb +++ b/app/views/layouts/_header.html.erb @@ -23,6 +23,8 @@
  • <%= link_to "Payment Method", settings_payment_method_settings_path, :tabindex =>"-1" %>
  • <%= link_to "Tax Profile", settings_tax_profiles_path, :tabindex =>"-1" %>
  • <%= link_to "Print Setting", print_settings_path, :tabindex =>"-1" %>
  • +
    +
  • <%= link_to "Accounts", settings_accounts_path, :tabindex =>"-1" %>
  • @@ -31,13 +33,14 @@ @@ -47,10 +50,13 @@ <% if current_login_employee %>
    <% end %> diff --git a/app/views/layouts/_header_orgiami.html.erb b/app/views/layouts/_header_orgiami.html.erb index 894e7a1f..0ae18ff5 100644 --- a/app/views/layouts/_header_orgiami.html.erb +++ b/app/views/layouts/_header_orgiami.html.erb @@ -1,7 +1,7 @@
    -
    - CASHIER STATION 1 - CLOCK +
    + Cashier Station 1 -
    <% if current_login_employee %> @@ -10,3 +10,29 @@
    + +
    diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index 1d4991e6..d2b57a7a 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -18,7 +18,16 @@ <%= render 'layouts/header' %>
    <% flash.each do |type, message| %> -
    + <% + if type== "warning" + alert = "alert-warning" + elsif type== "notice" + alert = "alert-success" + else + alert = "alert-danger" + end + %> +
    <%= message %>
    diff --git a/app/views/layouts/origami.html.erb b/app/views/layouts/origami.html.erb index 179d9ae1..1f519d2b 100644 --- a/app/views/layouts/origami.html.erb +++ b/app/views/layouts/origami.html.erb @@ -10,7 +10,9 @@ <%= csrf_meta_tags %> <%= stylesheet_link_tag 'origami', media: 'all', 'data-turbolinks-track': 'reload' %> - <%= javascript_include_tag 'origami', 'data-turbolinks-track': 'reload' %> + <%= javascript_include_tag 'application', 'data-turbolinks-track': 'reload' %> + <%= stylesheet_link_tag 'jquery-confirm', media: 'all', 'data-turbolinks-track': 'reload' %> + <%= javascript_include_tag 'jquery-confirm', 'data-turbolinks-track': 'reload' %> @@ -23,7 +25,7 @@ <%=message%>
    <% end %> - + <% end %> <%= yield %> diff --git a/app/views/oqs/edit/index.html.erb b/app/views/oqs/edit/index.html.erb new file mode 100644 index 00000000..15d48144 --- /dev/null +++ b/app/views/oqs/edit/index.html.erb @@ -0,0 +1,27 @@ +
    +
    +
    +
    Update Quantity
    +
    +
    +

    <%= @order_item[0].item_name + " - [" + @order_item[0].qty.to_s + "]" %>

    +
    + + +
    +
    + + +
    +
    + + Back + + +
    +
    +
    +
    +
    +
    + diff --git a/app/views/oqs/home/index.html.erb b/app/views/oqs/home/index.html.erb index 18e72880..0f387dad 100644 --- a/app/views/oqs/home/index.html.erb +++ b/app/views/oqs/home/index.html.erb @@ -29,19 +29,22 @@ -
    +
    <% - @queue_completed_item.each do |qid| + @queue_completed_item.each do |qid| + if qid.price != 0 %>

    - - <%= qid.zone %> - - + <%= qid.type %> - + <%= qid.zone %> + <%= qid.order_id %> +

    +

    <%= qid.item_name %> [x @@ -49,11 +52,13 @@ <%= qid.qty %> ]

    -

    Medium, Fries, Salad

    + +

    <%= qid.options == "[]"? "" : qid.options %>

    +

    Order at - <%= qid.created_at.strftime("%Y %m %d") %> + <%= qid.created_at.utc.getlocal.strftime("%d-%m-%Y %I:%M %p") %> - <%= qid.item_order_by %> @@ -65,7 +70,8 @@

    - <% + <% + end end %>
    @@ -81,27 +87,28 @@
    <% - @queue_items_details.each do |qid| - if qid.station_name == qsi[:station_name] + @queue_items_details.each do |qid| + if qid.price != 0 + if qid.station_name == qsi[:station_name] %>

    - - <%= qid.zone %> - - - - <%= qid.item_name %> - [x - - <%= qid.qty %> - ] -

    -

    Medium, Fries, Salad

    + <%= qid.type %> - + <%= qid.zone %> + <%= qid.order_id %> + +

    + <%= qid.item_name %> [x + <%= qid.qty %> ] +

    + +

    <%= qid.options == "[]"? "" : qid.options %>

    +

    Order at - <%= qid.created_at.strftime("%Y %m %d") %> + <%= qid.created_at.utc.getlocal.strftime("%d-%m-%Y %I:%M %p") %> - <%= qid.item_order_by %> @@ -112,11 +119,13 @@

    - - <% + <% + end end end %> @@ -159,7 +168,7 @@
    -
    +
    diff --git a/app/views/origami/cash_mgmt/create.html.erb b/app/views/origami/cash_mgmt/create.html.erb new file mode 100644 index 00000000..1b4805a2 --- /dev/null +++ b/app/views/origami/cash_mgmt/create.html.erb @@ -0,0 +1,2 @@ +

    CashMgmt#create

    +

    Find me in app/views/cash_mgmt/create.html.erb

    diff --git a/app/views/origami/cash_mgmt/index.html.erb b/app/views/origami/cash_mgmt/index.html.erb new file mode 100644 index 00000000..1f64a3df --- /dev/null +++ b/app/views/origami/cash_mgmt/index.html.erb @@ -0,0 +1,2 @@ +

    CashMgmt#index

    +

    Find me in app/views/cash_mgmt/index.html.erb

    diff --git a/app/views/origami/cash_mgmt/new.html.erb b/app/views/origami/cash_mgmt/new.html.erb new file mode 100644 index 00000000..9f22e0c3 --- /dev/null +++ b/app/views/origami/cash_mgmt/new.html.erb @@ -0,0 +1,2 @@ +

    CashMgmt#new

    +

    Find me in app/views/cash_mgmt/new.html.erb

    diff --git a/app/views/origami/credit_payments/create.json.jbuilder b/app/views/origami/credit_payments/create.json.jbuilder new file mode 100644 index 00000000..08bf292c --- /dev/null +++ b/app/views/origami/credit_payments/create.json.jbuilder @@ -0,0 +1 @@ +json.status true diff --git a/app/views/origami/credit_payments/index.html.erb b/app/views/origami/credit_payments/index.html.erb index e4f97119..dc2b5b85 100644 --- a/app/views/origami/credit_payments/index.html.erb +++ b/app/views/origami/credit_payments/index.html.erb @@ -1 +1,166 @@ -hello Credit + +
    + +
    +
    +
    +

    CREDIT PAYMENT

    +
    +
    +
    +
    +
    +
    + + +
    +
    +
    + <% if @creditcount != 0 %> +
    +
    + + +
    +
    +
    + <% end %> +
    +
    + + +
    +
    +
    +
    +
    + +
    0.0
    +
    +
    +
    +
    +
    +
    + +
    + +
    +
    +
    +
    1
    +
    2
    +
    3
    +
    +
    +
    4
    +
    5
    +
    6
    +
    +
    +
    7
    +
    8
    +
    9
    +
    +
    +
    0
    +
    .
    +
    00
    +
    +
    +
    Nett
    +
    Del
    +
    Clr
    +
    +
    +
    +
    +
    1000
    +
    3000
    +
    +
    +
    5000
    +
    10000
    +
    +
    +
    Pay
    +
    +
    +
    + +
    + +
    + +
    +
    + + diff --git a/app/views/origami/customers/index.html.erb b/app/views/origami/customers/index.html.erb index dd2b1b99..489487ab 100644 --- a/app/views/origami/customers/index.html.erb +++ b/app/views/origami/customers/index.html.erb @@ -2,12 +2,6 @@
    @@ -15,11 +9,11 @@
    - +
    - + @@ -35,6 +29,7 @@ + @@ -44,17 +39,19 @@ <% if @crm_customers.count > 0 %> + <% @i = 0 %> <% @crm_customers.each do |crm_customer| %> - <% if crm_customer.customer_id != "CUS-000000000001" && crm_customer.customer_id != "CUS-000000000002" %> + <% if crm_customer.customer_id != "CUS-00000" && crm_customer.customer_id != "CUS-00000000" %> + - - + + <% end %> <% end %> @@ -64,7 +61,7 @@
    SelectSr.no Name Company Contact no
    <%= @i += 1 %> <%= crm_customer.name %> <%= crm_customer.company rescue '-' %> <%= crm_customer.contact_no %> <%= crm_customer.email %>

    - + <%= paginate @crm_customers %>
    @@ -76,34 +73,92 @@ + + <%= f.error_notification %> <%= f.hidden_field :id, :class => "form-control col-md-6 " %> -
    "> - <%= f.input :name, :class => "form-control col-md-6 name" %> + <%= f.input :card_no, :class => "form-control col-md-6 card_no"%> <% flash.each do |name, msg| %> - <%= msg['name'] %> + <% str="[\"#{msg['name']}\"]" + str.gsub!('["', '') + str.gsub!('"]', '') %> + <%= str %> <% end -%> -
    - <%= f.input :company, :class => "form-control col-md-6 company" %> -
    +
    + + <%= f.radio_button :salutation,"Mr", :class => "salutation mr", :value=>"Mr", :style=>"width: 30px"%> + + <%= f.radio_button :salutation,"Mrs", :class => "salutation mrs", :value=>"Mrs", :style=>"width: 30px"%> + + <%= f.radio_button :salutation,"Miss", :class => "salutation miss", :value=>"Miss", :style=>"width: 30px"%> + + <%= f.radio_button :salutation,"Mdm", :class => "salutation mdm", :value=>"Mdm", :style=>"width: 30px"%> +
    +
    "> - <%= f.input :contact_no, :class => "form-control col-md-6 contact_no" %> - <% flash.each do |name, msg| %> - <%= msg['contact_no'] %> - <% end -%> -
    - -
    "> - <%= f.input :email, :class => "form-control col-md-6 email" %> - + <%= f.input :name, :class => "form-control col-md-6 name", :required => true %> + <% flash.each do |name, msg| %> - <%= msg['email'] %> + <% str="[\"#{msg['name']}\"]" + str.gsub!('["', '') + str.gsub!('"]', '') %> + <%= str %> <% end -%>
    +
    +
    + + <%= f.radio_button :gender,"Male", :class => "gender male", :value=>"Male", :style=>"width: 30px"%> + + <%= f.radio_button :gender,"Female", :class => "gender female", :value=>"Female", :style=>"width: 30px"%> +
    + +
    + <%= f.input :nrc_no, :class => "form-control nrc_no" %> +
    +
    + <%= f.input :company, :class => "form-control col-md-6 company",:required => true%> + + <% flash.each do |name, msg| %> + <% str="[\"#{msg['company']}\"]" + str.gsub!('["', '') + str.gsub!('"]', '') %> + <%= str %> + <% end -%> +
    +
    "> + <%= f.input :contact_no, :class => "form-control col-md-6 contact_no" ,:required => true%> + + <% flash.each do |name, msg| %> + <% str="[\"#{msg['contact_no']}\"]" + str.gsub!('["', '') + str.gsub!('"]', '') %> + <%= str %> + <% end -%> +
    + +
    "> + <%= f.input :email, :class => "form-control col-md-6 email" ,:required => true%> + <% flash.each do |name, msg| %> + <% str="[\"#{msg['contact_no']}\"]" + str.gsub!('["', '') + str.gsub!('"]', '') %> + <%= str %> + <% end -%> +
    + +
    + <%= f.input :address, :class => "form-control col-md-6 address" %> +
    + +
    <%= f.text_field :date_of_birth,:value=>"01-01-1990",:class=>"form-control datepicker"%> @@ -112,11 +167,12 @@
    +
    @@ -127,14 +183,12 @@
    - - - - - diff --git a/app/views/origami/discounts/index.html.erb b/app/views/origami/discounts/index.html.erb index 4f6b7c9a..9979c32f 100644 --- a/app/views/origami/discounts/index.html.erb +++ b/app/views/origami/discounts/index.html.erb @@ -1,7 +1,6 @@
    -
    Discount: - (<%=@sale_data.total_discount rescue 0%>) + (<%=@sale_data.total_discount rescue 0%>) Tax: @@ -75,104 +81,519 @@
    -
    +
    -
    +
    -
    +
    -
    Overall Discount
    +
    Discount Control
    -
    -
    - -
    -
    +
    +
    -
    - +
    + <% + @accounts.each do |acc| + %> + + <% end %> +
    +

    -
    -
    -
    -
    5%
    -
    -
    -
    -
    1
    -
    2
    -
    3
    -
    -
    -
    +
    +
    +
    +
    +
    5%
    +
    +
    +
    1
    +
    2
    +
    3
    +
    +
    -
    -
    -
    10%
    -
    -
    -
    -
    4
    -
    5
    -
    6
    -
    -
    -
    +
    +
    +
    10%
    +
    +
    +
    4
    +
    5
    +
    6
    +
    +
    -
    -
    -
    20%
    -
    -
    -
    -
    7
    -
    8
    -
    9
    -
    -
    -
    +
    +
    +
    20%
    +
    +
    +
    7
    +
    8
    +
    9
    +
    +
    -
    -
    -
    30%
    -
    -
    -
    -
    0
    -
    .
    -
    00
    -
    -
    -
    +
    +
    +
    30%
    +
    +
    +
    0
    +
    .
    +
    00
    +
    +
    -
    -
    -
    50%
    -
    -
    -
    -
    -
    DEL
    -
    CLR
    -
    -
    -
    -
    +
    +
    +
    50%
    +
    +
    +
    +
    DEL
    +
    CLR
    +
    +
    +
    + +
    +
    + + + +
    +
    +
    + + +
    + +
    + + +
    +
    + + diff --git a/app/views/origami/home/index.html.erb b/app/views/origami/home/index.html.erb index ff83dad4..cd451e68 100644 --- a/app/views/origami/home/index.html.erb +++ b/app/views/origami/home/index.html.erb @@ -1,388 +1,196 @@ -
    - -
    +
    + +
    - - - + + + -
    - -
    -
    - <% - @completed_orders.each do |cpo| - # ToDo no need check new - # Assigned Id for new Order? Sale? - unique_id = "" - customer_id = "" +
    + +
    +
    + <% @complete.each do |sale| %> +
    +
    + <%= sale.receipt_no %> + <%= sale.sale_status %> +
    +
    + <% end %> +
    +
    - # For CSS- Class for Order? Sale? - # sale_status="" - # if cpo.order_status == 'new' - # unique_id=cpo.booking_id + +
    +
    + <% @tables.each do |table| %> + <% if table.status == 'occupied' %> + <% if table.get_booking.nil? %> +
    +
    + Zone <%= table.zone_id %>
    + Table <%= table.name %> ( <%= table.seater %> Seat ) +
    +
    + <% else %> +
    +
    + Zone <%= table.zone_id %>
    + Table <%= table.name %> ( <%= table.seater %> Seat ) +
    +
    + <% end %> + <% else %> +
    +
    + Zone <%= table.zone_id %>
    + Table <%= table.name %> ( <%= table.seater %> Seat ) +
    +
    + <% end %> + <% end %> +
    +
    - # customer_id=cpo.order_customer_id - # # check selected item and assign - # if @selected_item_type == "Sale" - # if cpo.order_id == @selected_item.order_id - # sale_status = sale_status + " selected-item" - # end - # end - # else - unique_id=cpo.sale_id - customer_id=cpo.sale_customer_id - sale_status="paid" - # check selected item and assign - if @selected_item != nil - if unique_id == @selected_item.sale_id - sale_status = sale_status + " selected-item" - end - end - # end - %> -
    -
    + +
    +
    + <% @rooms.each do |room| %> + <% if room.status == 'occupied' %> +
    +
    + <%= room.name %> +
    +
    + <% else %> +
    +
    + <%= room.name %> +
    +
    + <% end %> + <% end %> +
    +
    - - - -

    <%= cpo.table_name %>

    -

    - Receipt No : - - <%= cpo.receipt_no %> - -

    -

    - Order Status : - <%= cpo.sale_status %> - -

    -
    -
    - <% - end - %> -
    -
    + +
    +
    + <% @orders.each do |order| %> +
    +
    + <%= order.order_id %> +
    +
    + <% end %> +
    - -
    -
    - <% - @booking_orders.each do |bko| - # No Show completed - if bko.sale_status == 'completed' - next - end - - # Assigned Id for new Order? Sale? - unique_id="" - customer_id="" - # For CSS- Class for Order? Sale? - sale_status="" - if bko.order_status == 'new' - unique_id=bko.booking_id - customer_id=bko.order_customer_id - # check selected item and assign - # if @selected_item != nil - # if bko.order_id == @selected_item.order_id - # sale_status = sale_status + " selected-item" - # end - # end - else - unique_id=bko.sale_id - customer_id=bko.sale_customer_id - sale_status="sold" - # check selected item and assign - if @selected_item != nil - if unique_id == @selected_item.sale_id - sale_status = sale_status + " selected-item" - end - end - end - %> -
    -
    - - - -

    <%= bko.table_name %>

    -

    - Receipt No : - - <%= bko.receipt_no %> - -

    -

    - Order Status : - <%= bko.order_status %> - -

    -
    -
    - <% - end - %> -
    -
    - - -
    -
    - <% - @booking_rooms.each do |rmo| - # No Show completed - if rmo.sale_status == 'completed' - next - end - - # Assigned Id for new Order? Sale? - unique_id="" - customer_id="" - # For CSS- Class for Order? Sale? - sale_status="" - - if rmo.order_status == 'new' - unique_id=rmo.booking_id - customer_id=rmo.order_customer_id - # check selected item and assign - # if @selected_item != nil - # if rmo.order_id == @selected_item.order_id - # sale_status = sale_status + " selected-item" - # end - # end - else - unique_id=rmo.sale_id - customer_id=rmo.sale_customer_id - sale_status="sold" - # check selected item and assign - if @selected_item != nil - if unique_id == @selected_item.sale_id - sale_status = sale_status + " selected-item" - end - end - end - %> -
    -
    - - - -

    <%= rmo.room_name %>

    -

    - Receipt No : - - <%= rmo.receipt_no %> - -

    -

    - Order Status : - <%= rmo.order_status %> - -

    -
    -
    - <% - end - %> -
    -
    - - -
    -
    - <% - @orders.each do |odr| - # No Show completed - if odr.sale_status == 'completed' - next - end - # Assigned Id for new Order? Sale? - unique_id="" - customer_id="" - # For CSS- Class for Order? Sale? - sale_status="" - - if odr.order_status == 'new' - unique_id=odr.booking_id - customer_id = odr.order_customer_id - # if @selected_item != nil - # if odr.order_id == @selected_item.order_id - # sale_status = sale_status + " selected-item" - # end - # end - else - unique_id=odr.sale_id - customer_id = odr.sale_customer_id - sale_status="sold" - # check selected item and assign - if @selected_item != nil - if unique_id == @selected_item.sale_id - sale_status = sale_status + " selected-item" - end - end - end - %> -
    -
    - - - -

    <%= odr.table_name %>

    - Receipt No : - - <%= odr.receipt_no %> - -

    -

    - Order Status : - <%= odr.order_status %> - -

    -
    -
    - <% - end - %> -
    - -
    -
    - -
    - - - -
    -
    -
    -
    ORDER DETAILS -
    -
    -
    -
    -
    -

    Receipt No: <%=@selected_item.receipt_no rescue ' '%>

    - -
    -
    -

    Date: <%=@selected_item.receipt_date.strftime("%d/%m/%Y - %I:%M %p") rescue '-'%>

    -
    -
    -
    -
    -

    Customer :

    - -
    - -
    -
    - - - - - - - - <% - # For Sale Items - sub_total = 0 - if @selected_item_type == "Sale" - @selected_item.sale_items.each do |sale_item| - sub_total += (sale_item.qty*sale_item.unit_price) - %> - - - - - - <% - end - end - %> - - <% - # For Order Items - if @selected_item_type == "Order" - @selected_item.order_items.each do |order_item| - sub_total += (order_item.qty*order_item.unit_price) - %> - - - - - - <% - end - end - %> - -
    ItemsQTY - Price -
    <%= sale_item.product_name %><%= sale_item.qty %><%= sale_item.qty*sale_item.price %>
    <%= order_item.item_name %><%= order_item.qty %><%= order_item.qty*order_item.price %>
    -
    - -
    -
    +
    + +
    +
    + +
    +
    + + diff --git a/app/views/origami/home/index_bk.html.erb b/app/views/origami/home/index_bk.html.erb new file mode 100644 index 00000000..ce2b3a94 --- /dev/null +++ b/app/views/origami/home/index_bk.html.erb @@ -0,0 +1,388 @@ +
    + +
    + + + + + +
    + +
    +
    + <% + @completed_orders.each do |cpo| + # ToDo no need check new + # Assigned Id for new Order? Sale? + unique_id = "" + customer_id = "" + + # For CSS- Class for Order? Sale? + # sale_status="" + # if cpo.order_status == 'new' + # unique_id=cpo.booking_id + + # customer_id=cpo.order_customer_id + # # check selected item and assign + # if @selected_item_type == "Sale" + # if cpo.order_id == @selected_item.order_id + # sale_status = sale_status + " selected-item" + # end + # end + # else + unique_id=cpo.sale_id + customer_id=cpo.sale_customer_id + sale_status="paid" + # check selected item and assign + if @selected_item != nil + if unique_id == @selected_item.sale_id + sale_status = sale_status + " selected-item" + end + end + # end + %> +
    +
    + + + + +

    <%= cpo.table_name %>

    +

    + Receipt No : + + <%= cpo.receipt_no %> + +

    +

    + Order Status : + <%= cpo.sale_status %> + +

    +
    +
    + <% + end + %> +
    +
    + + +
    +
    + <% + @booking_orders.each do |bko| + # No Show completed + if bko.sale_status == 'completed' + next + end + + # Assigned Id for new Order? Sale? + unique_id="" + customer_id="" + # For CSS- Class for Order? Sale? + sale_status="" + if bko.order_status == 'new' + unique_id=bko.booking_id + customer_id=bko.order_customer_id + # check selected item and assign + # if @selected_item != nil + # if bko.order_id == @selected_item.order_id + # sale_status = sale_status + " selected-item" + # end + # end + else + unique_id=bko.sale_id + customer_id=bko.sale_customer_id + sale_status="sold" + # check selected item and assign + if @selected_item != nil + if unique_id == @selected_item.sale_id + sale_status = sale_status + " selected-item" + end + end + end + %> +
    +
    + + + +

    <%= bko.table_name %>

    +

    + Receipt No : + + <%= bko.receipt_no %> + +

    +

    + Order Status : + <%= bko.order_status %> + +

    +
    +
    + <% + end + %> +
    +
    + + +
    +
    + <% + @booking_rooms.each do |rmo| + # No Show completed + if rmo.sale_status == 'completed' + next + end + + # Assigned Id for new Order? Sale? + unique_id="" + customer_id="" + # For CSS- Class for Order? Sale? + sale_status="" + + if rmo.order_status == 'new' + unique_id=rmo.booking_id + customer_id=rmo.order_customer_id + # check selected item and assign + # if @selected_item != nil + # if rmo.order_id == @selected_item.order_id + # sale_status = sale_status + " selected-item" + # end + # end + else + unique_id=rmo.sale_id + customer_id=rmo.sale_customer_id + sale_status="sold" + # check selected item and assign + if @selected_item != nil + if unique_id == @selected_item.sale_id + sale_status = sale_status + " selected-item" + end + end + end + %> +
    +
    + + + +

    <%= rmo.room_name %>

    +

    + Receipt No : + + <%= rmo.receipt_no %> + +

    +

    + Order Status : + <%= rmo.order_status %> + +

    +
    +
    + <% + end + %> +
    +
    + + +
    +
    + <% + @orders.each do |odr| + # No Show completed + if odr.sale_status == 'completed' + next + end + # Assigned Id for new Order? Sale? + unique_id="" + customer_id="" + # For CSS- Class for Order? Sale? + sale_status="" + + if odr.order_status == 'new' + unique_id=odr.booking_id + customer_id = odr.order_customer_id + # if @selected_item != nil + # if odr.order_id == @selected_item.order_id + # sale_status = sale_status + " selected-item" + # end + # end + else + unique_id=odr.sale_id + customer_id = odr.sale_customer_id + sale_status="sold" + # check selected item and assign + if @selected_item != nil + if unique_id == @selected_item.sale_id + sale_status = sale_status + " selected-item" + end + end + end + %> +
    +
    + + + +

    <%= odr.table_name %>

    + Receipt No : + + <%= odr.receipt_no %> + +

    +

    + Order Status : + <%= odr.order_status %> + +

    +
    +
    + <% + end + %> +
    + +
    +
    + +
    + + + +
    +
    +
    +
    ORDER DETAILS -
    +
    +
    +
    +
    +

    Receipt No: <%=@selected_item.receipt_no rescue ' '%>

    + +
    +
    +

    Date: <%=@selected_item.receipt_date.strftime("%d/%m/%Y - %I:%M %p") rescue '-'%>

    +
    +
    +
    +
    +

    Customer :

    + +
    + +
    +
    + + + + + + + + <% + # For Sale Items + sub_total = 0 + if @selected_item_type == "Sale" + @selected_item.sale_items.each do |sale_item| + sub_total = sub_total + sale_item.price + %> + + + + + + <% + end + end + %> + + <% + # For Order Items + if @selected_item_type == "Order" + @selected_item.order_items.each do |order_item| + sub_total = sub_total + (order_item.qty*order_item.price) + %> + + + + + + <% + end + end + %> + +
    ItemsQTY + Price +
    <%= sale_item.product_name %><%= sale_item.qty %><%= sale_item.price %>
    <%= order_item.item_name %><%= order_item.qty %><%= order_item.qty*order_item.price %>
    +
    + +
    +
    +
    + + +
    + + + + + + + + + + + +
    +
    diff --git a/app/views/origami/home/show.html.erb b/app/views/origami/home/show.html.erb index 4c784627..9dbb6884 100644 --- a/app/views/origami/home/show.html.erb +++ b/app/views/origami/home/show.html.erb @@ -3,9 +3,11 @@
    +
    + diff --git a/app/views/origami/rooms/show.html.erb b/app/views/origami/rooms/show.html.erb new file mode 100644 index 00000000..d8c05393 --- /dev/null +++ b/app/views/origami/rooms/show.html.erb @@ -0,0 +1,411 @@ +
    + +
    + + + + + +
    + +
    +
    + <% @complete.each do |sale| %> +
    +
    + <%= sale.receipt_no %><%= sale.sale_status %> +
    +
    + <% end %> +
    +
    + + +
    +
    + <% @tables.each do |table| %> + <% if table.status == 'occupied' %> + <% if table.get_booking.nil? %> +
    +
    + <%= table.name %> + billed +
    +
    + <% else %> +
    +
    + <%= table.name %> + new +
    +
    + <% end %> + <% else %> +
    +
    + <%= table.name %> +
    +
    + <% end %> + <% end %> +
    +
    + + +
    +
    + <% @rooms.each do |room| %> + <% if room.status == 'occupied' %> +
    +
    + <%= room.name %> + <% if room.get_booking.nil? %> + billed + <% else %> + new + <% end %> +
    +
    + <% else %> +
    +
    + <%= room.name %> +
    +
    + <% end %> + <% end %> +
    +
    + + +
    +
    + <% @orders.each do |order| %> +
    +
    + <%= order.order_id %> +
    +
    + <% end %> +
    +
    + +
    + +
    + + + +
    +
    +
    + <% if @status == 'order' %> +
    ORDER DETAILS | Table <%= @room.name rescue "" %>
    + <% elsif @status_sale == 'sale' %> +
    INVOICE DETAILS | Table <%= @room.name rescue "" %>
    + <% end %> + +
    +
    +
    +
    +

    Receipt No: + <% if @status == 'sale' %> + <%= @obj.receipt_no rescue '' %> + <% end %> +

    +
    +
    +

    Date: <%= @obj.created_at.utc.getlocal.strftime("%d/%m/%Y - %I:%M %p") rescue '-'%>

    +
    +
    +
    +
    + <%if @customer %> + +

    Customer : <%= @customer.name %>

    + <%end%> +
    + +
    +
    + + + + + + + + <% + sub_total = 0 + if @status == "sale" + @obj.sale_items.each do |sale_item| + sub_total = sub_total + sale_item.price + %> + + <% unless sale_item.price == 0 %> + + + + + + <% + end + end + end + + if @status == 'order' + unless @order_items.nil? + @order_items.each do |order_item | + sub_total = sub_total + (order_item.price * order_item.qty) + + unless order_item.price == 0 %> + + + + + + <% + end + end + end + end + %> + +
    ItemsQTY + Price +
    <%= sale_item.product_name %><%= sale_item.qty %><%= sale_item.price %>
    <%= order_item.item_name %><%= order_item.qty %><%= order_item.qty*order_item.price %>
    +
    + +
    + <% + if @status_sale == 'sale' + unless @order_items.nil? + %> + Pending New Order + + <% + count = 0 + @order_items.each do |order_item | + count += 1 + %> + + + + + + + + <% + end + %> +
    <%= count %> + <%= order_item.item_name %><%= order_item.qty %><%= order_item.qty*order_item.price %>
    + + <% end %> + <% if @sale_array.size > 1 %> +

    + Pending Payment + <% end %> + <% @sale_array.each do |sale| + if @sale_array.size > 1 + unless sale.receipt_no == @sale_array[0].receipt_no + %> + + + + + + +
    Receipt No - <%= sale.receipt_no %>
    + <% + end + end + end + end + %> + +
    +
    +
    + + +
    + + + + + + + + + + + + +
    +
    + diff --git a/app/views/origami/sale_edit/apply_void.json.jbuilder b/app/views/origami/sale_edit/apply_void.json.jbuilder new file mode 100644 index 00000000..08bf292c --- /dev/null +++ b/app/views/origami/sale_edit/apply_void.json.jbuilder @@ -0,0 +1 @@ +json.status true diff --git a/app/views/origami/sale_edit/cancel_all_void.json.jbuilder b/app/views/origami/sale_edit/cancel_all_void.json.jbuilder new file mode 100644 index 00000000..08bf292c --- /dev/null +++ b/app/views/origami/sale_edit/cancel_all_void.json.jbuilder @@ -0,0 +1 @@ +json.status true diff --git a/app/views/origami/sale_edit/edit.html.erb b/app/views/origami/sale_edit/edit.html.erb new file mode 100644 index 00000000..76bbeb08 --- /dev/null +++ b/app/views/origami/sale_edit/edit.html.erb @@ -0,0 +1,175 @@ +
    + +
    +
    +
    +
    INVOICE DETAILS
    +
    +
    +
    +
    +

    Receipt No: + <%= @saleobj.receipt_no rescue '' %> +

    +
    +
    +

    Date: <%= @saleobj.created_at.utc.getlocal.strftime("%d/%m/%Y - %I:%M %p") rescue '-'%>

    +
    +
    +
    +
    +

    Customer :

    +
    + +
    +
    + + + + + + + + + + <% + count = 0 + sub_total = 0 + @saleobj.sale_items.each do |sale_item| + count += 1 + sub_total = sub_total + sale_item.price + %> + + <% + # Can't check for discount + unless sale_item.price == 0 + %> + + + + <% if sale_item.remark != 'void' %> + + + + + <% elsif sale_item.qty.to_i < 0 %> + + + + <% else %> + + + + <% end %> + + <% + end + end + %> + +
    #ItemsQTY + Price + Action
    <%= count %><%= sale_item.product_name %> + + + +
    +
    + +
    +
    +
    + + +
    + + + + +
    +
    + diff --git a/app/views/origami/sale_edit/item_void.json.jbuilder b/app/views/origami/sale_edit/item_void.json.jbuilder new file mode 100644 index 00000000..08bf292c --- /dev/null +++ b/app/views/origami/sale_edit/item_void.json.jbuilder @@ -0,0 +1 @@ +json.status true diff --git a/app/views/origami/sale_edit/item_void_cancel.json.jbuilder b/app/views/origami/sale_edit/item_void_cancel.json.jbuilder new file mode 100644 index 00000000..08bf292c --- /dev/null +++ b/app/views/origami/sale_edit/item_void_cancel.json.jbuilder @@ -0,0 +1 @@ +json.status true diff --git a/app/views/origami/sales/add_to_existing_invoice.json.jbuilder b/app/views/origami/sales/add_to_existing_invoice.json.jbuilder new file mode 100644 index 00000000..08bf292c --- /dev/null +++ b/app/views/origami/sales/add_to_existing_invoice.json.jbuilder @@ -0,0 +1 @@ +json.status true diff --git a/app/views/origami/sales/show.html.erb b/app/views/origami/sales/show.html.erb new file mode 100644 index 00000000..8e660261 --- /dev/null +++ b/app/views/origami/sales/show.html.erb @@ -0,0 +1,227 @@ +
    + +
    + + + + + +
    + +
    +
    + <% @complete.each do |sale| %> +
    +
    + <%= sale.receipt_no %><%= sale.sale_status %> +
    +
    + <% end %> +
    +
    + + +
    +
    + <% @tables.each do |table| %> + <% if table.status == 'occupied' %> +
    +
    + <%= table.name %> + <% if table.get_booking.nil? %> + billed + <% else %> + new + <% end %> +
    +
    + <% else %> +
    +
    + <%= table.name %> +
    +
    + <% end %> + <% end %> +
    +
    + + +
    +
    + <% @rooms.each do |room| %> + <% if room.status == 'occupied' %> +
    +
    + <%= room.name %> + <% if room.get_booking.nil? %> + billed + <% else %> + new + <% end %> +
    +
    + <% else %> +
    +
    + <%= room.name %> +
    +
    + <% end %> + <% end %> +
    +
    + + +
    +
    + <% @orders.each do |order| %> +
    +
    + <%= order.order_id %> +
    +
    + <% end %> +
    +
    + +
    + +
    + + + +
    +
    +
    +
    INVOICE DETAILS
    +
    +
    +
    +
    +

    Receipt No: + <%= @sale.receipt_no rescue '' %> +

    +
    +
    +

    Date: <%= @sale.created_at.utc.getlocal.strftime("%d/%m/%Y - %I:%M %p") rescue '-'%>

    +
    +
    +
    +
    +

    Customer :

    +
    + +
    +
    + + + + + + + + <% + sub_total = 0 + @sale.sale_items.each do |sale_item| + sub_total = sub_total + sale_item.price + %> + + <% unless sale_item.price <= 0 %> + + + + + + <% + + end + end + + %> + +
    ItemsQTY + Price +
    <%= sale_item.product_name %><%= sale_item.qty %><%= sale_item.price %>
    +
    + +
    +
    +
    + + +
    + + <% if @sale.sale_status != 'void' %> + + <% end %> + +
    +
    + diff --git a/app/views/origami/shifts/edit.html.erb b/app/views/origami/shifts/edit.html.erb new file mode 100644 index 00000000..26d96cb5 --- /dev/null +++ b/app/views/origami/shifts/edit.html.erb @@ -0,0 +1,2 @@ +

    Origami::Shifts#edit

    +

    Find me in app/views/origami/shifts/edit.html.erb

    diff --git a/app/views/origami/shifts/index.html.erb b/app/views/origami/shifts/index.html.erb new file mode 100644 index 00000000..ebec0301 --- /dev/null +++ b/app/views/origami/shifts/index.html.erb @@ -0,0 +1,2 @@ +

    Origami::Shifts#index

    +

    Find me in app/views/origami/shifts/index.html.erb

    diff --git a/app/views/origami/shifts/new.html.erb b/app/views/origami/shifts/new.html.erb new file mode 100644 index 00000000..4a216f69 --- /dev/null +++ b/app/views/origami/shifts/new.html.erb @@ -0,0 +1,2 @@ +

    Origami::Shifts#new

    +

    Find me in app/views/origami/shifts/new.html.erb

    diff --git a/app/views/origami/shifts/show.html.erb b/app/views/origami/shifts/show.html.erb new file mode 100644 index 00000000..189c3d62 --- /dev/null +++ b/app/views/origami/shifts/show.html.erb @@ -0,0 +1,2 @@ +

    Origami::Shifts#show

    +

    Find me in app/views/origami/shifts/show.html.erb

    diff --git a/app/views/origami/table_invoices/index.html.erb b/app/views/origami/table_invoices/index.html.erb new file mode 100644 index 00000000..d5cbe84d --- /dev/null +++ b/app/views/origami/table_invoices/index.html.erb @@ -0,0 +1,82 @@ +
    +
    + <% @sale_array.each do |sale| %> +
    +
    + <%= sale.receipt_no %> +
    +
    + <% end %> +
    + + +
    +
    +
    +
    INVOICE DETAILS
    +
    +
    +
    +
    +

    Receipt No: + <%= @sale.receipt_no rescue '' %> +

    +
    +
    +

    Date: <%= @sale.created_at.utc.getlocal.strftime("%d/%m/%Y - %I:%M %p") rescue '-'%>

    +
    +
    +
    +
    +

    Customer :

    +
    + +
    + + +
    +
    +
    + + +
    + + +
    +
    + diff --git a/app/views/origami/table_invoices/show.html.erb b/app/views/origami/table_invoices/show.html.erb new file mode 100644 index 00000000..ade1f021 --- /dev/null +++ b/app/views/origami/table_invoices/show.html.erb @@ -0,0 +1,164 @@ +
    +
    + + <% @sale_array.each do |sale| %> +
    + <% if sale.id == @sale.id %> +
    + <%= sale.receipt_no %> +
    + <% else %> +
    + <%= sale.receipt_no %> +
    + <% end %> +
    + <% end %> +
    + +
    +
    +
    +
    INVOICE DETAILS
    +
    +
    +
    +
    +

    Receipt No: + <%= @sale.receipt_no rescue '' %> +

    +
    +
    +

    Date: <%= @sale.created_at.utc.getlocal.strftime("%d/%m/%Y - %I:%M %p") rescue '-'%>

    +
    +
    +
    +
    + + +

    Customer : <%= @customer.name rescue "" %>

    + +
    + +
    +
    + + + + + + + + + <% + count = 0 + sub_total = 0 + if @status_sale == "sale" + @sale.sale_items.each do |sale_item| + count += 1 + sub_total = sub_total + sale_item.price + %> + + <% + # Can't check for discount + unless sale_item.price == 0 + %> + + + + + + + <% + end + end + end + + if @status_order == 'order' && @status_sale != 'sale' + unless @order_items.nil? + count = 0 + @order_items.each do |order_item | + count += 1 + sub_total = sub_total + order_item.price + + unless order_item.price == 0 %> + + + + + + + <% + end + end + end + end + %> + +
    #ItemsQTY + Price +
    <%= count %><%= sale_item.product_name %><%= sale_item.qty %><%= sale_item.price %>
    <%= count %><%= order_item.item_name %><%= order_item.qty %><%= order_item.qty*order_item.price %>
    +
    + +
    +
    +
    + + +
    + + + +
    +
    + diff --git a/app/views/origami/visa/index.html.erb b/app/views/origami/visa/index.html.erb index 42e7e2ec..1589ca1b 100644 --- a/app/views/origami/visa/index.html.erb +++ b/app/views/origami/visa/index.html.erb @@ -68,9 +68,9 @@
    00
    -
    Nett
    +
    Nett
    Del
    -
    Clr
    +
    Clr
    @@ -91,11 +91,17 @@
    - +
    \ No newline at end of file diff --git a/app/views/reports/daily_sale/index.html.erb b/app/views/reports/daily_sale/index.html.erb new file mode 100644 index 00000000..7b790148 --- /dev/null +++ b/app/views/reports/daily_sale/index.html.erb @@ -0,0 +1,190 @@ + + +
    + <%= render :partial=>'shift_sale_report_filter', + :locals=>{ :period_type => true, :shift_name => false, :report_path =>reports_daily_sales_path} %> +
    +
    + +
    +
    + +
    +
    + +
    +
    +
    + + + <% if params[:from]%> + + + + <% end %> + + + + + + + + + + + + + + + + + + + <% unless @sale_data.empty? %> + + + <% 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 %> + + + + + + + + + + + + + + + + + + <% count = count + 1 %> + <% end %> + + + + + + + + + + + + + + + + + + <% total_tax = 0 %> + <% unless @tax.empty? %> + <% @tax.each do |tax| %> + <% total_tax += tax.tax_amount.to_f %> + + + + + + + <% end %> + <% net = total - total_tax %> + + + + + + <% end %> + + <% end %> +
    Sale (<%= params[:from] rescue '-' %> - <%= params[:to] rescue '-'%>)
    Sr.noDateVoid AmountMpu SalesMaster SalesVisa SalesJcb SalesPaypar SalesCash SalesCredit SalesFOC Sales(Discount)Grand Total +
    Rounding Adj.
    Rounding Adj.Grand Total
    <%= count %><%= sale[:sale_date].strftime("#{sale[:sale_date].day.ordinalize} %b") rescue '-' %><%= number_with_delimiter(sprintf("%.2f",sale[:void_amount]), :delimiter => ',') rescue '-'%><%= number_with_delimiter(sprintf("%.2f",sale[:mpu_amount]), :delimiter => ',') rescue '-'%><%= number_with_delimiter(sprintf("%.2f",sale[:master_amount]), :delimiter => ',') rescue '-'%><%= number_with_delimiter(sprintf("%.2f",sale[:visa_amount]), :delimiter => ',') rescue '-'%><%= number_with_delimiter(sprintf("%.2f",sale[:jcb_amount]), :delimiter => ',') rescue '-'%><%= number_with_delimiter(sprintf("%.2f",sale[:paypar_amount]), :delimiter => ',') rescue '-'%><%= number_with_delimiter(sprintf("%.2f",sale[:cash_amount]), :delimiter => ',') rescue '-'%><%= number_with_delimiter(sprintf("%.2f",sale[:credit_amount]), :delimiter => ',') rescue '-'%><%= number_with_delimiter(sprintf("%.2f",sale[:foc_amount]), :delimiter => ',') rescue '-'%>(<%= number_with_delimiter(sprintf("%.2f",sale[:total_discount]), :delimiter => ',') rescue '-'%>)<%= number_with_delimiter(sprintf("%.2f",sale[:grand_total].to_f + sale[:rounding_adj].to_f ), :delimiter => ',') rescue '-'%><%= number_with_delimiter(sprintf("%.2f",sale[:rounding_adj].to_f), :delimiter => ',') rescue '-'%><%= number_with_delimiter(sprintf("%.2f",sale[:grand_total]), :delimiter => ',') rescue '-'%>
    Total<%= number_with_delimiter(sprintf("%.2f",mpu_amount), :delimiter => ',') rescue '-'%><%= number_with_delimiter(sprintf("%.2f",master_amount), :delimiter => ',') rescue '-'%><%= number_with_delimiter(sprintf("%.2f",visa_amount), :delimiter => ',') rescue '-'%><%= number_with_delimiter(sprintf("%.2f",jcb_amount), :delimiter => ',') rescue '-'%><%= number_with_delimiter(sprintf("%.2f",paypar_amount), :delimiter => ',') rescue '-'%><%= number_with_delimiter(sprintf("%.2f",cash), :delimiter => ',') rescue '-'%><%= number_with_delimiter(sprintf("%.2f",credit), :delimiter => ',') rescue '-'%><%= number_with_delimiter(sprintf("%.2f",foc), :delimiter => ',') rescue '-'%>(<%= number_with_delimiter(sprintf("%.2f",discount), :delimiter => ',') rescue '-'%>)<%= number_with_delimiter(sprintf("%.2f",total), :delimiter => ',') rescue '-'%><%= number_with_delimiter(sprintf("%.2f",rounding_adj), :delimiter => ',') rescue '-'%><%= number_with_delimiter(sprintf("%.2f",grand_total), :delimiter => ',') rescue '-'%>
    <%= tax.tax_name rescue '-'%><%= number_with_delimiter(sprintf("%.2f",tax.tax_amount), :delimiter => ',') rescue '-'%> 
    Net Amount<%= number_with_delimiter(sprintf("%.2f",net), :delimiter => ',') rescue '-'%> 
    +
    +
    +
    + + + \ No newline at end of file diff --git a/app/views/reports/daily_sale/index.xls.erb b/app/views/reports/daily_sale/index.xls.erb new file mode 100644 index 00000000..67e76e3c --- /dev/null +++ b/app/views/reports/daily_sale/index.xls.erb @@ -0,0 +1,116 @@ +
    +
    + + + <% if params[:from]%> + + + + <% end %> + + + + + + + + + + + + + + + + + + + <% unless @sale_data.empty? %> + + + <% 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 %> + + + + + + + + + + + + + + + + + + <% count = count + 1 %> + <% end %> + + + + + + + + + + + + + + + + + + <% total_tax = 0 %> + <% unless @tax.empty? %> + <% @tax.each do |tax| %> + <% total_tax += tax.tax_amount.to_f %> + + + + + + + <% end %> + <% net = total - total_tax %> + + + + + + <% end %> + + <% end %> +
    Sale (<%= params[:from] rescue '-' %> - <%= params[:to] rescue '-'%>)
    Sr.noDateVoid AmountMpu SalesMaster SalesVisa SalesJcb SalesPaypar SalesCash SalesCredit SalesFOC Sales(Discount)Grand Total +
    Rounding Adj.
    Rounding Adj.Grand Total
    <%= count %><%= sale[:sale_date].strftime("#{sale[:sale_date].day.ordinalize} %b") rescue '-' %><%= number_with_delimiter(sprintf("%.2f",sale[:void_amount]), :delimiter => ',') rescue '-'%><%= number_with_delimiter(sprintf("%.2f",sale[:mpu_amount]), :delimiter => ',') rescue '-'%><%= number_with_delimiter(sprintf("%.2f",sale[:master_amount]), :delimiter => ',') rescue '-'%><%= number_with_delimiter(sprintf("%.2f",sale[:visa_amount]), :delimiter => ',') rescue '-'%><%= number_with_delimiter(sprintf("%.2f",sale[:jcb_amount]), :delimiter => ',') rescue '-'%><%= number_with_delimiter(sprintf("%.2f",sale[:paypar_amount]), :delimiter => ',') rescue '-'%><%= number_with_delimiter(sprintf("%.2f",sale[:cash_amount]), :delimiter => ',') rescue '-'%><%= number_with_delimiter(sprintf("%.2f",sale[:credit_amount]), :delimiter => ',') rescue '-'%><%= number_with_delimiter(sprintf("%.2f",sale[:foc_amount]), :delimiter => ',') rescue '-'%>(<%= number_with_delimiter(sprintf("%.2f",sale[:total_discount]), :delimiter => ',') rescue '-'%>)<%= number_with_delimiter(sprintf("%.2f",sale[:grand_total].to_f + sale[:rounding_adj].to_f ), :delimiter => ',') rescue '-'%><%= number_with_delimiter(sprintf("%.2f",sale[:rounding_adj].to_f), :delimiter => ',') rescue '-'%><%= number_with_delimiter(sprintf("%.2f",sale[:grand_total]), :delimiter => ',') rescue '-'%>
    Total<%= number_with_delimiter(sprintf("%.2f",mpu_amount), :delimiter => ',') rescue '-'%><%= number_with_delimiter(sprintf("%.2f",master_amount), :delimiter => ',') rescue '-'%><%= number_with_delimiter(sprintf("%.2f",visa_amount), :delimiter => ',') rescue '-'%><%= number_with_delimiter(sprintf("%.2f",jcb_amount), :delimiter => ',') rescue '-'%><%= number_with_delimiter(sprintf("%.2f",paypar_amount), :delimiter => ',') rescue '-'%><%= number_with_delimiter(sprintf("%.2f",cash), :delimiter => ',') rescue '-'%><%= number_with_delimiter(sprintf("%.2f",credit), :delimiter => ',') rescue '-'%><%= number_with_delimiter(sprintf("%.2f",foc), :delimiter => ',') rescue '-'%>(<%= number_with_delimiter(sprintf("%.2f",discount), :delimiter => ',') rescue '-'%>)<%= number_with_delimiter(sprintf("%.2f",total), :delimiter => ',') rescue '-'%><%= number_with_delimiter(sprintf("%.2f",rounding_adj), :delimiter => ',') rescue '-'%><%= number_with_delimiter(sprintf("%.2f",grand_total), :delimiter => ',') rescue '-'%>
    <%= tax.tax_name rescue '-'%><%= number_with_delimiter(sprintf("%.2f",tax.tax_amount), :delimiter => ',') rescue '-'%> 
    Net Amount<%= number_with_delimiter(sprintf("%.2f",net), :delimiter => ',') rescue '-'%> 
    +
    +
    \ No newline at end of file diff --git a/app/views/reports/daily_sale_report.html.erb b/app/views/reports/daily_sale_report.html.erb deleted file mode 100644 index e69de29b..00000000 diff --git a/app/views/reports/daily_sales/_shift_sale_report_filter.html.erb b/app/views/reports/daily_sales/_shift_sale_report_filter.html.erb new file mode 100644 index 00000000..3a5d788c --- /dev/null +++ b/app/views/reports/daily_sales/_shift_sale_report_filter.html.erb @@ -0,0 +1,151 @@ +
    +
    + <%= form_tag report_path, :method => :get, :id=>"frm_report", :class => "form" do %> + <% if period_type != false %> +
    +
    + + +
    + + +
    + + + +
    +
    + + +
    +
    + +
    +
    + <% end %> + + + +
    +
    + <% 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 %> + + <% 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 %> + <%= 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 %> +
    +
    + + + + <% end %> +
    +
    + + + + \ No newline at end of file diff --git a/app/views/reports/daily_sales/index.html.erb b/app/views/reports/daily_sales/index.html.erb new file mode 100644 index 00000000..7b790148 --- /dev/null +++ b/app/views/reports/daily_sales/index.html.erb @@ -0,0 +1,190 @@ + + +
    + <%= render :partial=>'shift_sale_report_filter', + :locals=>{ :period_type => true, :shift_name => false, :report_path =>reports_daily_sales_path} %> +
    +
    + +
    +
    + +
    +
    + +
    +
    +
    + + + <% if params[:from]%> + + + + <% end %> + + + + + + + + + + + + + + + + + + + <% unless @sale_data.empty? %> + + + <% 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 %> + + + + + + + + + + + + + + + + + + <% count = count + 1 %> + <% end %> + + + + + + + + + + + + + + + + + + <% total_tax = 0 %> + <% unless @tax.empty? %> + <% @tax.each do |tax| %> + <% total_tax += tax.tax_amount.to_f %> + + + + + + + <% end %> + <% net = total - total_tax %> + + + + + + <% end %> + + <% end %> +
    Sale (<%= params[:from] rescue '-' %> - <%= params[:to] rescue '-'%>)
    Sr.noDateVoid AmountMpu SalesMaster SalesVisa SalesJcb SalesPaypar SalesCash SalesCredit SalesFOC Sales(Discount)Grand Total +
    Rounding Adj.
    Rounding Adj.Grand Total
    <%= count %><%= sale[:sale_date].strftime("#{sale[:sale_date].day.ordinalize} %b") rescue '-' %><%= number_with_delimiter(sprintf("%.2f",sale[:void_amount]), :delimiter => ',') rescue '-'%><%= number_with_delimiter(sprintf("%.2f",sale[:mpu_amount]), :delimiter => ',') rescue '-'%><%= number_with_delimiter(sprintf("%.2f",sale[:master_amount]), :delimiter => ',') rescue '-'%><%= number_with_delimiter(sprintf("%.2f",sale[:visa_amount]), :delimiter => ',') rescue '-'%><%= number_with_delimiter(sprintf("%.2f",sale[:jcb_amount]), :delimiter => ',') rescue '-'%><%= number_with_delimiter(sprintf("%.2f",sale[:paypar_amount]), :delimiter => ',') rescue '-'%><%= number_with_delimiter(sprintf("%.2f",sale[:cash_amount]), :delimiter => ',') rescue '-'%><%= number_with_delimiter(sprintf("%.2f",sale[:credit_amount]), :delimiter => ',') rescue '-'%><%= number_with_delimiter(sprintf("%.2f",sale[:foc_amount]), :delimiter => ',') rescue '-'%>(<%= number_with_delimiter(sprintf("%.2f",sale[:total_discount]), :delimiter => ',') rescue '-'%>)<%= number_with_delimiter(sprintf("%.2f",sale[:grand_total].to_f + sale[:rounding_adj].to_f ), :delimiter => ',') rescue '-'%><%= number_with_delimiter(sprintf("%.2f",sale[:rounding_adj].to_f), :delimiter => ',') rescue '-'%><%= number_with_delimiter(sprintf("%.2f",sale[:grand_total]), :delimiter => ',') rescue '-'%>
    Total<%= number_with_delimiter(sprintf("%.2f",mpu_amount), :delimiter => ',') rescue '-'%><%= number_with_delimiter(sprintf("%.2f",master_amount), :delimiter => ',') rescue '-'%><%= number_with_delimiter(sprintf("%.2f",visa_amount), :delimiter => ',') rescue '-'%><%= number_with_delimiter(sprintf("%.2f",jcb_amount), :delimiter => ',') rescue '-'%><%= number_with_delimiter(sprintf("%.2f",paypar_amount), :delimiter => ',') rescue '-'%><%= number_with_delimiter(sprintf("%.2f",cash), :delimiter => ',') rescue '-'%><%= number_with_delimiter(sprintf("%.2f",credit), :delimiter => ',') rescue '-'%><%= number_with_delimiter(sprintf("%.2f",foc), :delimiter => ',') rescue '-'%>(<%= number_with_delimiter(sprintf("%.2f",discount), :delimiter => ',') rescue '-'%>)<%= number_with_delimiter(sprintf("%.2f",total), :delimiter => ',') rescue '-'%><%= number_with_delimiter(sprintf("%.2f",rounding_adj), :delimiter => ',') rescue '-'%><%= number_with_delimiter(sprintf("%.2f",grand_total), :delimiter => ',') rescue '-'%>
    <%= tax.tax_name rescue '-'%><%= number_with_delimiter(sprintf("%.2f",tax.tax_amount), :delimiter => ',') rescue '-'%> 
    Net Amount<%= number_with_delimiter(sprintf("%.2f",net), :delimiter => ',') rescue '-'%> 
    +
    +
    +
    + + + \ No newline at end of file diff --git a/app/views/reports/daily_sales/index.xls.erb b/app/views/reports/daily_sales/index.xls.erb new file mode 100644 index 00000000..67e76e3c --- /dev/null +++ b/app/views/reports/daily_sales/index.xls.erb @@ -0,0 +1,116 @@ +
    +
    + + + <% if params[:from]%> + + + + <% end %> + + + + + + + + + + + + + + + + + + + <% unless @sale_data.empty? %> + + + <% 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 %> + + + + + + + + + + + + + + + + + + <% count = count + 1 %> + <% end %> + + + + + + + + + + + + + + + + + + <% total_tax = 0 %> + <% unless @tax.empty? %> + <% @tax.each do |tax| %> + <% total_tax += tax.tax_amount.to_f %> + + + + + + + <% end %> + <% net = total - total_tax %> + + + + + + <% end %> + + <% end %> +
    Sale (<%= params[:from] rescue '-' %> - <%= params[:to] rescue '-'%>)
    Sr.noDateVoid AmountMpu SalesMaster SalesVisa SalesJcb SalesPaypar SalesCash SalesCredit SalesFOC Sales(Discount)Grand Total +
    Rounding Adj.
    Rounding Adj.Grand Total
    <%= count %><%= sale[:sale_date].strftime("#{sale[:sale_date].day.ordinalize} %b") rescue '-' %><%= number_with_delimiter(sprintf("%.2f",sale[:void_amount]), :delimiter => ',') rescue '-'%><%= number_with_delimiter(sprintf("%.2f",sale[:mpu_amount]), :delimiter => ',') rescue '-'%><%= number_with_delimiter(sprintf("%.2f",sale[:master_amount]), :delimiter => ',') rescue '-'%><%= number_with_delimiter(sprintf("%.2f",sale[:visa_amount]), :delimiter => ',') rescue '-'%><%= number_with_delimiter(sprintf("%.2f",sale[:jcb_amount]), :delimiter => ',') rescue '-'%><%= number_with_delimiter(sprintf("%.2f",sale[:paypar_amount]), :delimiter => ',') rescue '-'%><%= number_with_delimiter(sprintf("%.2f",sale[:cash_amount]), :delimiter => ',') rescue '-'%><%= number_with_delimiter(sprintf("%.2f",sale[:credit_amount]), :delimiter => ',') rescue '-'%><%= number_with_delimiter(sprintf("%.2f",sale[:foc_amount]), :delimiter => ',') rescue '-'%>(<%= number_with_delimiter(sprintf("%.2f",sale[:total_discount]), :delimiter => ',') rescue '-'%>)<%= number_with_delimiter(sprintf("%.2f",sale[:grand_total].to_f + sale[:rounding_adj].to_f ), :delimiter => ',') rescue '-'%><%= number_with_delimiter(sprintf("%.2f",sale[:rounding_adj].to_f), :delimiter => ',') rescue '-'%><%= number_with_delimiter(sprintf("%.2f",sale[:grand_total]), :delimiter => ',') rescue '-'%>
    Total<%= number_with_delimiter(sprintf("%.2f",mpu_amount), :delimiter => ',') rescue '-'%><%= number_with_delimiter(sprintf("%.2f",master_amount), :delimiter => ',') rescue '-'%><%= number_with_delimiter(sprintf("%.2f",visa_amount), :delimiter => ',') rescue '-'%><%= number_with_delimiter(sprintf("%.2f",jcb_amount), :delimiter => ',') rescue '-'%><%= number_with_delimiter(sprintf("%.2f",paypar_amount), :delimiter => ',') rescue '-'%><%= number_with_delimiter(sprintf("%.2f",cash), :delimiter => ',') rescue '-'%><%= number_with_delimiter(sprintf("%.2f",credit), :delimiter => ',') rescue '-'%><%= number_with_delimiter(sprintf("%.2f",foc), :delimiter => ',') rescue '-'%>(<%= number_with_delimiter(sprintf("%.2f",discount), :delimiter => ',') rescue '-'%>)<%= number_with_delimiter(sprintf("%.2f",total), :delimiter => ',') rescue '-'%><%= number_with_delimiter(sprintf("%.2f",rounding_adj), :delimiter => ',') rescue '-'%><%= number_with_delimiter(sprintf("%.2f",grand_total), :delimiter => ',') rescue '-'%>
    <%= tax.tax_name rescue '-'%><%= number_with_delimiter(sprintf("%.2f",tax.tax_amount), :delimiter => ',') rescue '-'%> 
    Net Amount<%= number_with_delimiter(sprintf("%.2f",net), :delimiter => ',') rescue '-'%> 
    +
    +
    \ No newline at end of file diff --git a/app/views/reports/receipt_no/index.html.erb b/app/views/reports/receipt_no/index.html.erb index 4dd239e7..dc7d05ee 100644 --- a/app/views/reports/receipt_no/index.html.erb +++ b/app/views/reports/receipt_no/index.html.erb @@ -1,6 +1,6 @@ @@ -30,7 +30,9 @@ Gross Sales Discount Total Sales - CT + <% TaxProfile.all.each do |r|%> + <%=r.name%> + <% end %> Nett Sales @@ -48,7 +50,10 @@ <%= number_with_delimiter(sprintf("%.2f",sale.total_amount.to_f), :delimiter => ',') %> <%= number_with_delimiter(sprintf("%.2f",sale.total_discount.to_f), :delimiter => ',') %> <%= number_with_delimiter(sprintf("%.2f",total_sales.to_f), :delimiter => ',') %> - <%= number_with_delimiter(sprintf("%.2f",sale.total_tax.to_f), :delimiter => ',') %> + <% sale.sale_taxes.each do |sale|%> + <%= number_with_delimiter(sprintf("%.2f",sale.tax_payable_amount.to_f), :delimiter => ',') %> + <% end %> + <%= number_with_delimiter(sprintf("%.2f",net_sales.to_f), :delimiter => ',') %> <% end %> diff --git a/app/views/reports/receipt_no/index.xls.erb b/app/views/reports/receipt_no/index.xls.erb index 2191d814..8bdee23c 100644 --- a/app/views/reports/receipt_no/index.xls.erb +++ b/app/views/reports/receipt_no/index.xls.erb @@ -2,27 +2,27 @@
    <% unless @sale_data.empty? %> -

    <%=current_active_location.name%>

    -

    Sales Summary Report (BreadTalk)

    -<% if params[:from]%> -

    From Date : <%= params[:from] %> , To Date : <%= params[:to] %>

    -<% end %> +

    <%=current_active_location.name%>

    +

    Sales Summary Report (BreadTalk)

    +<% if params[:from]%> +

    From Date : <%= params[:from] %> , To Date : <%= params[:to] %>

    +<% end %> - - + + - + - + - + @@ -35,101 +35,101 @@ <% foc = 0 %> <% discount = 0 %> <% total = 0 %> - <% count = 1 %> + <% 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 %> + <% total_cash_received = 0 %> <% today_credit_payment_amount = 0 %> - <% old_location_id = 0%> - <% sub_total = 0 %> - <% count_of_void = 0 %> + <% old_location_id = 0%> + <% sub_total = 0 %> + <% count_of_void = 0 %> <% flag = false %> - <% @sale_data.each do |sale| %> + <% @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 %> + <% 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 += 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%> <% total_cash_received = cash.to_f + credit_payment.to_f%> <% today_credit_payment_amount += sale[:today_credit_payment].to_f %> - + - - - - + + + + - - + + - - <% total_void_amount = 0 %> + + <% total_void_amount = 0 %> <% if !@daily_void.nil? %> <% @daily_void.each do |d_v|%> - - <% if d_v[:daily_void_amt].to_i > 0 %> - <% 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%> + <% if d_v[:daily_void_amt].to_i > 0 %> + <% 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%> + + + + <%end %> + <% end%> + <% end%> + <% end%> + <% end%> <% if flag == true%> <% void += total_void_amount.to_f %> - - <% flag = false %> + + <% flag = false %> <% end%> - <%if count_of_void == 0%> - + <%if count_of_void == 0%> + <%end %> + <%= 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 => ',') %> + -<%count_of_void= 0%> +<%count_of_void= 0%> <% count = count + 1 %> <% end %> - + - - - - + + + + - - + + <% end %>
    Location Name DateCash SalesCash Sales Credit Sales Credit Received Card PaymentCard Payment Total Discount Total Taxes Total Other Charges FOC SalesVoid SalesVoid Sales Grand Total
    <%= sale[:location].to_s rescue '-' %><%= sale[:sale_date].strftime("#{sale[:sale_date].day.ordinalize} %b") rescue '-' %><%= number_with_delimiter(sprintf("%.2f",sale[:cash_amount].to_f), :delimiter => ',') %><%= sale[:location].to_s rescue '-' %><%= sale[:sale_date].strftime("#{sale[:sale_date].day.ordinalize} %b") rescue '-' %><%= number_with_delimiter(sprintf("%.2f",sale[:cash_amount].to_f), :delimiter => ',') %> <%= number_with_delimiter(sprintf("%.2f",sale[:credit_amount].to_f), :delimiter => ',') %><%= number_with_delimiter(sprintf("%.2f",sale[:credit_payment].to_f), :delimiter => ',') %><%= number_with_delimiter(sprintf("%.2f",sale[:card_amount].to_f), :delimiter => ',') %><%= number_with_delimiter(sprintf("%.2f",sale[:credit_payment].to_f), :delimiter => ',') %><%= number_with_delimiter(sprintf("%.2f",sale[:card_amount].to_f), :delimiter => ',') %> <%= number_with_delimiter(sprintf("%.2f",sale[:total_discount].to_f), :delimiter => ',') %> <%= number_with_delimiter(sprintf("%.2f",sale[:total_tax].to_f), :delimiter => ',') %> <%= number_with_delimiter(sprintf("%.2f",sale[:other_charges].to_f), :delimiter => ',') %><%= number_with_delimiter(sprintf("%.2f",sale[:foc_amount].to_f), :delimiter => ',') %><%= number_with_delimiter(sprintf("%.2f",sale[:foc_amount].to_f), :delimiter => ',') %> <%= number_with_delimiter(sprintf("%.2f",total_void_amount.to_f), :delimiter => ',') %> <%= number_with_delimiter(sprintf("%.2f",total_void_amount.to_f), :delimiter => ',') %> <%= number_with_delimiter(sprintf("%.2f",0.to_f), :delimiter => ',') %> <%= number_with_delimiter(sprintf("%.2f",0.to_f), :delimiter => ',') %> - <%= 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 => ',') %> -
    Grand Total <%= number_with_delimiter(sprintf("%.2f",cash), :delimiter => ',') %><%= number_with_delimiter(sprintf("%.2f",credit ), :delimiter => ',') %><%= number_with_delimiter(sprintf("%.2f",credit_payment ), :delimiter => ',') %><%= number_with_delimiter(sprintf("%.2f",card ), :delimiter => ',') %><%= number_with_delimiter(sprintf("%.2f",discount ), :delimiter => ',') %><%= number_with_delimiter(sprintf("%.2f",credit ), :delimiter => ',') %><%= number_with_delimiter(sprintf("%.2f",credit_payment ), :delimiter => ',') %><%= number_with_delimiter(sprintf("%.2f",card ), :delimiter => ',') %><%= number_with_delimiter(sprintf("%.2f",discount ), :delimiter => ',') %> <%= number_with_delimiter(sprintf("%.2f",total_tax ), :delimiter => ',') %> <%= number_with_delimiter(sprintf("%.2f",total_other_charges ), :delimiter => ',') %> <%= number_with_delimiter(sprintf("%.2f",foc ), :delimiter => ',') %><%= number_with_delimiter(sprintf("%.2f",void ), :delimiter => ',') %><%= 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 => ',') %><%= number_with_delimiter(sprintf("%.2f",void ), :delimiter => ',') %><%= 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 => ',') %>
    -
    \ No newline at end of file +
    diff --git a/app/views/reports/sale_item/_shift_sale_report_filter.html.erb b/app/views/reports/sale_item/_shift_sale_report_filter.html.erb new file mode 100644 index 00000000..7f95b6b9 --- /dev/null +++ b/app/views/reports/sale_item/_shift_sale_report_filter.html.erb @@ -0,0 +1,156 @@ +
    +
    + <%= form_tag report_path, :method => :get, :id=>"frm_report", :class => "form" do %> + <% if period_type != false %> +
    +
    + + +
    + + +
    + + + +
    +
    + + +
    +
    + +
    +
    + <% end %> + + + +
    +
    + <% 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 %> + + <% 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 %> + <%= 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 %> +
    +
    + + + + <% end %> +
    +
    + + + + \ No newline at end of file diff --git a/app/views/reports/sale_item/index.html.erb b/app/views/reports/sale_item/index.html.erb new file mode 100644 index 00000000..7b0d6f38 --- /dev/null +++ b/app/views/reports/sale_item/index.html.erb @@ -0,0 +1,141 @@ + + +
    + <%= render :partial=>'shift_sale_report_filter', + :locals=>{ :period_type => true, :shift_name => false, :report_path =>reports_sale_items_path} %> +
    +
    + +
    +
    + +
    +
    + +
    +
    +
    + + + + + + + + + + + + + + + + + + +
    Date
    Menu CategoryCodeProductTotal ItemUnit PriceRevenue
    +
    +
    +
    + + \ No newline at end of file diff --git a/app/views/reports/sale_item/index.xls.erb b/app/views/reports/sale_item/index.xls.erb new file mode 100644 index 00000000..2807ec3f --- /dev/null +++ b/app/views/reports/sale_item/index.xls.erb @@ -0,0 +1,136 @@ + + + + + + + +
    +<% unless @sale_data.blank? %> + + + + + <% if !params[:from].blank?%> + + + + <% end %> + <% if @shift_from %> + + <% if @shift_data.employee %> + <% cashier_name = !@shift_data.nil? ? @shift_data.employee.name : '-' %> + <% end %> + + + <% end %> + + + + + + + + + + + + + <% acc_arr = Array.new %> + <% cate_arr = Array.new %> + + <% sub_total = 0.0 %> + <% count = 0%> + <% total_price = 0.0 %> + <% cate_count = 0 %> + <% acc_count = 0%> + <% grand_total = 0%> + <% total_discount = 0.0 %> + + <% @sale_data.order("total_item desc").each do |sale| %> + + <% if !acc_arr.include?(sale.account_id) %> + + + + + + + <% acc_arr.push(sale.account_id) %> + + <% end %> + + + <% if !cate_arr.include?(sale.menu_category_id) %> + + <% cate_arr.push(sale.menu_category_id) %> + <% else %> + + <% end %> + + <% if @item_table == 'sale' %> + <% if sale.item_remark == 'FOC' %> + + <% elsif sale.item_remark == 'FOC ITEM' %> + + <% elsif sale.item_remark == 'DISCOUNT' %> + + <% else %> + + <% end %> + <% if sale.item_remark == 'DISCOUNT' %> + + + + <% total_price += sale.total_price %> + <% else %> + + + + <% end %> + <% else %> + + + + + <% end %> + + + + <% @menu_cate_count.each do |key,value| %> + <% if sale.menu_category_id == key %> + <% count = count + 1 %> + <% sub_total += sale.grand_total %> + <% if count == value %> + + + + + + <% sub_total = 0.0%> + <% total_discount = total_discount + total_price %> + <% total_price = 0.0%> + <% count = 0%> + <% end %> + <% end %> + <% end %> + + <% grand_total += sale.grand_total%> + <% end %> + + + + + + +
    From Date : <%= params[:from] %> , To Date : <%= params[:to] %>
    Shift Name = <%= @shift_from %> - <%= @shift_to %> ( <%= cashier_name %> )
     Menu CategoryCodeProductTotal ItemUnit PriceRevenue
    <%= sale.account_name %> Total Price By <%= sale.account_name %> + <% @totalByAccount.each do |account, total| %> + <% if sale.account_id == account %> + <%= total %> + <% end %> + <% end %> +
     <%= sale.menu_category_name %> <%= sale.code rescue '-' %><%= '[PROMO] '.to_s + sale.product_name.to_s rescue '-' %><%= '[DIS:QTY] '.to_s + sale.product_name.to_s rescue '-' %><%= '[DIS:TP] '.to_s + sale.product_name.to_s rescue '-' %><%= sale.product_name.to_s rescue '-' %> - - <%= sale.total_price.abs rescue '-' %><%= sale.total_item.abs rescue '-' %><%= sale.unit_price rescue '-' %><%= sale.grand_total.abs rescue '-' %><%= sale.product_name.to_s rescue '-' %><%= sale.total_item.abs rescue '-' %><%= sale.unit_price rescue '-' %><%= sale.grand_total.abs rescue '-' %>
     Sub Total<%= sub_total + total_price %>
     Grand Total<%= grand_total + total_discount %>
    +<% end %> +
    + + \ No newline at end of file diff --git a/app/views/reports/sale_items/_shift_sale_report_filter.html.erb b/app/views/reports/sale_items/_shift_sale_report_filter.html.erb new file mode 100644 index 00000000..7f95b6b9 --- /dev/null +++ b/app/views/reports/sale_items/_shift_sale_report_filter.html.erb @@ -0,0 +1,156 @@ +
    +
    + <%= form_tag report_path, :method => :get, :id=>"frm_report", :class => "form" do %> + <% if period_type != false %> +
    +
    + + +
    + + +
    + + + +
    +
    + + +
    +
    + +
    +
    + <% end %> + + + +
    +
    + <% 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 %> + + <% 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 %> + <%= 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 %> +
    +
    + + + + <% end %> +
    +
    + + + + \ No newline at end of file diff --git a/app/views/reports/sale_items/index.html.erb b/app/views/reports/sale_items/index.html.erb new file mode 100644 index 00000000..26ad560e --- /dev/null +++ b/app/views/reports/sale_items/index.html.erb @@ -0,0 +1,141 @@ + + +
    + <%= render :partial=>'shift_sale_report_filter', + :locals=>{ :period_type => true, :shift_name => false, :report_path =>reports_sale_items_path} %> +
    +
    + + + +
    +
    +
    + + + + + + + + + + + + + + + + + + +
    Date
    Menu CategoryCodeProductTotal ItemUnit PriceRevenue
    +
    +
    +
    + + \ No newline at end of file diff --git a/app/views/reports/sale_items/index.xls.erb b/app/views/reports/sale_items/index.xls.erb new file mode 100644 index 00000000..2807ec3f --- /dev/null +++ b/app/views/reports/sale_items/index.xls.erb @@ -0,0 +1,136 @@ + + + + + + + +
    +<% unless @sale_data.blank? %> + + + + + <% if !params[:from].blank?%> + + + + <% end %> + <% if @shift_from %> + + <% if @shift_data.employee %> + <% cashier_name = !@shift_data.nil? ? @shift_data.employee.name : '-' %> + <% end %> + + + <% end %> + + + + + + + + + + + + + <% acc_arr = Array.new %> + <% cate_arr = Array.new %> + + <% sub_total = 0.0 %> + <% count = 0%> + <% total_price = 0.0 %> + <% cate_count = 0 %> + <% acc_count = 0%> + <% grand_total = 0%> + <% total_discount = 0.0 %> + + <% @sale_data.order("total_item desc").each do |sale| %> + + <% if !acc_arr.include?(sale.account_id) %> + + + + + + + <% acc_arr.push(sale.account_id) %> + + <% end %> + + + <% if !cate_arr.include?(sale.menu_category_id) %> + + <% cate_arr.push(sale.menu_category_id) %> + <% else %> + + <% end %> + + <% if @item_table == 'sale' %> + <% if sale.item_remark == 'FOC' %> + + <% elsif sale.item_remark == 'FOC ITEM' %> + + <% elsif sale.item_remark == 'DISCOUNT' %> + + <% else %> + + <% end %> + <% if sale.item_remark == 'DISCOUNT' %> + + + + <% total_price += sale.total_price %> + <% else %> + + + + <% end %> + <% else %> + + + + + <% end %> + + + + <% @menu_cate_count.each do |key,value| %> + <% if sale.menu_category_id == key %> + <% count = count + 1 %> + <% sub_total += sale.grand_total %> + <% if count == value %> + + + + + + <% sub_total = 0.0%> + <% total_discount = total_discount + total_price %> + <% total_price = 0.0%> + <% count = 0%> + <% end %> + <% end %> + <% end %> + + <% grand_total += sale.grand_total%> + <% end %> + + + + + + +
    From Date : <%= params[:from] %> , To Date : <%= params[:to] %>
    Shift Name = <%= @shift_from %> - <%= @shift_to %> ( <%= cashier_name %> )
     Menu CategoryCodeProductTotal ItemUnit PriceRevenue
    <%= sale.account_name %> Total Price By <%= sale.account_name %> + <% @totalByAccount.each do |account, total| %> + <% if sale.account_id == account %> + <%= total %> + <% end %> + <% end %> +
     <%= sale.menu_category_name %> <%= sale.code rescue '-' %><%= '[PROMO] '.to_s + sale.product_name.to_s rescue '-' %><%= '[DIS:QTY] '.to_s + sale.product_name.to_s rescue '-' %><%= '[DIS:TP] '.to_s + sale.product_name.to_s rescue '-' %><%= sale.product_name.to_s rescue '-' %> - - <%= sale.total_price.abs rescue '-' %><%= sale.total_item.abs rescue '-' %><%= sale.unit_price rescue '-' %><%= sale.grand_total.abs rescue '-' %><%= sale.product_name.to_s rescue '-' %><%= sale.total_item.abs rescue '-' %><%= sale.unit_price rescue '-' %><%= sale.grand_total.abs rescue '-' %>
     Sub Total<%= sub_total + total_price %>
     Grand Total<%= grand_total + total_discount %>
    +<% end %> +
    + + \ No newline at end of file diff --git a/app/views/settings/accounts/_form.html.erb b/app/views/settings/accounts/_form.html.erb index 4231ad32..b2101a43 100644 --- a/app/views/settings/accounts/_form.html.erb +++ b/app/views/settings/accounts/_form.html.erb @@ -4,11 +4,14 @@
    <%= f.input :title %> <%= f.input :account_type, :collection => Lookup.collection_of("account_type") %> + <%= f.input :discount %> + <%= f.input :point %> + <%= f.input :bonus %> + <%= f.input :rebate %>
    <%= f.button :submit %>
    - -<% end %> +<% end %> diff --git a/app/views/settings/accounts/index.html.erb b/app/views/settings/accounts/index.html.erb index d8469a69..541bc0a1 100644 --- a/app/views/settings/accounts/index.html.erb +++ b/app/views/settings/accounts/index.html.erb @@ -14,9 +14,14 @@ - - - + + + + + + + + @@ -25,10 +30,14 @@ + + + + <% end %> diff --git a/app/views/settings/accounts/show.html.erb b/app/views/settings/accounts/show.html.erb index 6ec1c80a..6d28df26 100644 --- a/app/views/settings/accounts/show.html.erb +++ b/app/views/settings/accounts/show.html.erb @@ -1,4 +1,4 @@ - + + + + + @@ -25,10 +29,14 @@ - + + + + +
    TitleAccount TypeActionTitleAccount TypeCan get PointsCan rebateAction
    <%= account.title %> <%= account.account_type %><%= account.point %><%= account.rebate %> - <%= link_to 'Edit', edit_settings_account_path(account) %> | + <%= link_to 'Edit', edit_settings_account_path(account) %> | <%= link_to 'Destroy', settings_account_path(account), method: :delete, data: { confirm: 'Are you sure?' } %> - +
    Title Account typeCan get PointsCan rebate Action
    <%= @settings_account.title %> <%= @settings_account.account_type %><%= @settings_account.point %><%= @settings_account.rebate %><%= link_to 'Edit', edit_settings_account_path(@settings_account, @settings_account) %>
    -
    \ No newline at end of file + diff --git a/app/views/settings/employees/index.html.erb b/app/views/settings/employees/index.html.erb index e680eb91..1112f72b 100644 --- a/app/views/settings/employees/index.html.erb +++ b/app/views/settings/employees/index.html.erb @@ -22,7 +22,7 @@ <% @employees.each do |employee| %> - <%= link_to employee.name, employee[:setting] %> + <%= link_to employee.name,settings_employee_path(employee) %> <%= employee.role %> <%= link_to 'Edit', edit_settings_employee_path(employee) %> | <%= link_to 'Destroy', employee[:setting], method: :delete, data: { confirm: 'Are you sure?' } %> diff --git a/app/views/settings/employees/show.html.erb b/app/views/settings/employees/show.html.erb index 084887dc..753298e6 100644 --- a/app/views/settings/employees/show.html.erb +++ b/app/views/settings/employees/show.html.erb @@ -9,3 +9,8 @@ Role: <%= @employee.role %>

    + +

    + Employee ID: + <%= @employee.emp_id %> +

    diff --git a/app/views/settings/lookups/index.html.erb b/app/views/settings/lookups/index.html.erb index f427b561..9ac392a5 100644 --- a/app/views/settings/lookups/index.html.erb +++ b/app/views/settings/lookups/index.html.erb @@ -18,9 +18,9 @@ <%= settings_lookup.lookup_type %> <%= settings_lookup.name %> <%= settings_lookup.value %> - <%= link_to 'Show', settings_lookup %> + <%= link_to 'Show', settings_lookup_path(settings_lookup) %> <%= link_to 'Edit', edit_settings_lookup_path(settings_lookup) %> - <%= link_to 'Destroy', settings_lookup, method: :delete, data: { confirm: 'Are you sure?' } %> + <%= link_to 'Destroy', settings_lookup_path(settings_lookup), method: :delete, data: { confirm: 'Are you sure?' } %> <% end %> diff --git a/app/views/settings/membership_actions/_form.html.erb b/app/views/settings/membership_actions/_form.html.erb index 3084d4ac..ac3e07b0 100644 --- a/app/views/settings/membership_actions/_form.html.erb +++ b/app/views/settings/membership_actions/_form.html.erb @@ -9,7 +9,6 @@ <%= f.input :auth_token %> <%= f.input :merchant_account_id %> <%= f.input :created_by %> - <%= f.input :additional_parameter %>
    diff --git a/app/views/settings/membership_actions/index.html.erb b/app/views/settings/membership_actions/index.html.erb index 635fd34c..4a348ed3 100644 --- a/app/views/settings/membership_actions/index.html.erb +++ b/app/views/settings/membership_actions/index.html.erb @@ -1,41 +1,47 @@ -

    <%= notice %>

    -

    Settings Membership Actions

    - - - - - - - - - - - - - - - - - - <% @settings_membership_actions.each do |settings_membership_action| %> - - - - - - - - - - - - - - <% end %> - -
    Membership typeIs activeGateway communication typeGateway urlAuth tokenMerchant accountCreated byAdditional parameter
    <%= settings_membership_action.membership_type %><%= settings_membership_action.is_active %><%= settings_membership_action.gateway_communication_type %><%= settings_membership_action.gateway_url %><%= settings_membership_action.auth_token %><%= settings_membership_action.merchant_account_id %><%= settings_membership_action.created_by %><%= settings_membership_action.additional_parameter %><%= link_to 'Show', settings_membership_action_path(settings_membership_action) %><%= link_to 'Edit', edit_settings_membership_action_path(settings_membership_action) %><%= link_to 'Destroy', settings_membership_action_path(settings_membership_action), method: :delete, data: { confirm: 'Are you sure?' } %>
    +
    +
    + + + + + + + + + + + + + + -<%= link_to 'New Settings Membership Action', new_settings_membership_action_path %> + + <% @settings_membership_actions.each do |settings_membership_action| %> + + + + + + + + + + + + + + <% end %> + +
    Membership typeIs activeGateway communication typeGateway urlAuth tokenMerchant accountCreated byAdditional parameter
    <%= settings_membership_action.membership_type %><%= settings_membership_action.is_active %><%= settings_membership_action.gateway_communication_type %><%= settings_membership_action.gateway_url %><%= settings_membership_action.auth_token %><%= settings_membership_action.merchant_account_id %><%= settings_membership_action.created_by %><%= settings_membership_action.additional_parameter %><%= link_to 'Show', settings_membership_action_path(settings_membership_action) %><%= link_to 'Edit', edit_settings_membership_action_path(settings_membership_action) %><%= link_to 'Destroy', settings_membership_action_path(settings_membership_action), method: :delete, data: { confirm: 'Are you sure?' } %>
    +
    diff --git a/app/views/settings/order_queue_stations/_form.html.erb b/app/views/settings/order_queue_stations/_form.html.erb index 7a2cba43..67b34798 100644 --- a/app/views/settings/order_queue_stations/_form.html.erb +++ b/app/views/settings/order_queue_stations/_form.html.erb @@ -13,6 +13,7 @@ div.form-inputs span{ <%= f.input :printer_name %> <%= f.input :font_size %> <%= f.input :print_copy %> + <%= f.hidden_field :processing_items %> <%= f.label "Select Zones", :class => 'control-label' %> <%= f.collection_check_boxes :zone_ids , Zone.all, :id, :name , :class => 'ta'%> <%= f.input :cut_per_item %> diff --git a/app/views/settings/rooms/_form.html.erb b/app/views/settings/rooms/_form.html.erb index c164ab67..25af618c 100644 --- a/app/views/settings/rooms/_form.html.erb +++ b/app/views/settings/rooms/_form.html.erb @@ -7,7 +7,6 @@ <%= f.input :seater %> <%= f.input :order_by %> <%= f.input :is_active %> - <%= f.input :created_by, :collection => Employee.collection %>
    diff --git a/app/views/settings/tables/_form.html.erb b/app/views/settings/tables/_form.html.erb index a411175c..169e1601 100644 --- a/app/views/settings/tables/_form.html.erb +++ b/app/views/settings/tables/_form.html.erb @@ -7,7 +7,6 @@ <%= f.input :seater %> <%= f.input :order_by %> <%= f.input :is_active %> - <%= f.input :created_by, :collection => Employee.collection %>
    diff --git a/app/views/settings/zones/_form.html.erb b/app/views/settings/zones/_form.html.erb index a7740211..351f2c94 100644 --- a/app/views/settings/zones/_form.html.erb +++ b/app/views/settings/zones/_form.html.erb @@ -4,7 +4,7 @@
    <%= f.input :name %> <%= f.input :is_active %> - <%= f.input :created_by, :collection => Employee.collection %> +
    diff --git a/app/views/transactions/credit_notes/index.html.erb b/app/views/transactions/credit_notes/index.html.erb new file mode 100644 index 00000000..fba0b52f --- /dev/null +++ b/app/views/transactions/credit_notes/index.html.erb @@ -0,0 +1,70 @@ +
    +
    + +
    +
    + +
    +
    +
    +
    + + + + + + + + + + + + + + <% @sales.each do |sale| %> + + + + + + + + + <% end %> + + +
    Sale Id Receipt no Credit AmountCashierCustomer NameReceipt Date
    <%= link_to sale.sale_id, transactions_sale_path(sale) %><%= sale.receipt_no %><%credit = SalePayment.where('sale_id = ? AND payment_method=?', sale.sale_id,"creditnote").first %> + <%= credit.payment_amount rescue '-' %> + <%= sale.cashier_name rescue '-' %><%= link_to sale.customer.name, crm_customer_path(sale.customer_id) %> <%= sale.receipt_date.strftime("%d-%m-%Y") %>
    +
    + +
    +
    + +
    +
    + + + + + + diff --git a/app/views/transactions/sales/show.html.erb b/app/views/transactions/sales/show.html.erb index 1e5cc41a..b62289b1 100644 --- a/app/views/transactions/sales/show.html.erb +++ b/app/views/transactions/sales/show.html.erb @@ -66,7 +66,7 @@ <%= @sale.receipt_no %> <%= @sale.cashier_name rescue '-' %> <%= @sale.sale_status %> - <%= @sale.requested_at %> + <%= @sale.requested_at.strftime("%m-%d-%Y %H:%M %p") %> Sale item name @@ -110,14 +110,14 @@   - Pay Amount + Total Pay Amount <%= number_with_precision(@sale.amount_received, :precision => 2, :delimiter => ',') rescue ' '%> <% @sale_receivables.each do |r|%> - Payment <%= r.payment_method rescue ' '%> + <%= r.payment_method.capitalize rescue ' '%> Payment <%= number_with_precision(r.payment_amount, :precision => 2, :delimiter => ',') rescue ' '%> @@ -175,63 +175,63 @@
    - -
    -
    -
    -
    -

    Customer Profile

    -
    - - - - - - - - - - - - - - - - - - - - - - - -
    Name<%= @customer.name %>
    Email<%= @customer.email %>
    Contact no<%= @customer.contact_no %>
    Company<%= @customer.company %>
    Date Of Birth<%= @customer.date_of_birth %>
    -
    -
    -
    -
    -

    Membership Detail

    -
    - - - <% if @membership == 0 %> - - - - <% else %> - <% @membership.each do |member| %> - - - - - <% end %> - - <% end %> - -
    "There is no membership data"
    <%= member["accountable_type"] %><%= member["balance"] %>
    -
    -
    -
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <% + if @response["status"] == true %> + <% @response["data"].each do |transaction| %> + + + + + + + + + + + <% end %> + <% end %> + +
    Card NoNameCompanyContact noEmailNRC/Passport NoAddressDOB
    <%= @customer.card_no rescue '-'%><%= @customer.name %><%= @customer.company rescue '-' %><%= @customer.contact_no %><%= @customer.email %><%= @customer.nrc_no %><%= @customer.address%><%= @customer.date_of_birth %>
    Membership Transactions
    DateRedeemRebateBalanceStatusReceipt No
    <%= transaction["date"]%><%= transaction["redeem"]%><%= transaction["rebate"] %><%= transaction["balance"] %><%= transaction["status"] %><%= transaction["receipt_no"] %>
    diff --git a/config/application.rb b/config/application.rb index 2a47de48..5ce0a92a 100644 --- a/config/application.rb +++ b/config/application.rb @@ -13,6 +13,7 @@ module SXRestaurants # -- all .rb files in that directory are automatically loaded. config.active_record.time_zone_aware_types = [:datetime, :time] config.active_job.queue_adapter = :sidekiq + # config.time_zone = 'Asia/Rangoon' end end diff --git a/config/environment.rb b/config/environment.rb index 426333bb..f467c11e 100644 --- a/config/environment.rb +++ b/config/environment.rb @@ -3,3 +3,4 @@ require_relative 'application' # Initialize the Rails application. Rails.application.initialize! + diff --git a/config/initializers/assets.rb b/config/initializers/assets.rb index 9952a7bc..461f6489 100644 --- a/config/initializers/assets.rb +++ b/config/initializers/assets.rb @@ -12,7 +12,7 @@ Rails.application.config.assets.version = '1.0' # --- Waiter/ Cashier - Orgiami ---- Rails.application.config.assets.precompile += %w( origami.css ) -Rails.application.config.assets.precompile += %w( origami.js ) +# Rails.application.config.assets.precompile += %w( origami.js ) # -- Order Queue Station ----- Rails.application.config.assets.precompile += %w( OQS.css ) Rails.application.config.assets.precompile += %w( OQS.js ) @@ -22,3 +22,7 @@ Rails.application.config.assets.precompile += %w( settings.css ) # --- Customer/ Customer - Crm ---- Rails.application.config.assets.precompile += %w( CRM.css ) Rails.application.config.assets.precompile += %w( CRM.js ) + +# --- Customer/ Customer - Crm ---- +Rails.application.config.assets.precompile += %w( jquery-confirm.css ) +Rails.application.config.assets.precompile += %w( jquery-confirm.js ) diff --git a/config/initializers/mime_types.rb b/config/initializers/mime_types.rb index dc189968..3859c754 100644 --- a/config/initializers/mime_types.rb +++ b/config/initializers/mime_types.rb @@ -2,3 +2,4 @@ # Add new mime types for use in respond_to blocks: # Mime::Type.register "text/richtext", :rtf +Mime::Type.register 'application/vnd.ms-excel', :xls diff --git a/config/routes.rb b/config/routes.rb index 11494743..36b23aea 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -2,9 +2,6 @@ require 'sidekiq/web' Rails.application.routes.draw do - namespace :settings do - resources :membership_actions - end root 'home#index' mount Sidekiq::Web => '/kiq' @@ -16,6 +13,9 @@ Rails.application.routes.draw do post 'install' => 'install#create' #--------- Login/Authentication ------------# + get 'auth/:emp_id' => 'home#show' , as: :emp_login + patch "auth/:emp_id" => 'home#update', as: :emp_login_update + post 'login' => 'home#create' delete 'logout' => 'home#destroy' get 'dashboard' => 'home#dashboard' @@ -44,10 +44,9 @@ Rails.application.routes.draw do #Order Controller resources :orders, only: [:create, :show, :update] do - post "bill" => "bill#create" - end + get 'view_orders' => "orders#view_orders" #Current active bookings resources :bookings, only: [:index, :show, :create, :update] @@ -72,18 +71,44 @@ Rails.application.routes.draw do #--------- Cashier ------------# namespace :origami do root "home#index" - get "/:booking_id" => "home#index" do #origami/:booking_id will show + get "table/:dining_id" => "home#show" do #origami/:booking_id will show # resources :discounts, only: [:index,:new, :create ] #add discount type resources :customers #add customer type end + post 'moving' => "movetable#moving" + get "/table/:table_id/sale/:sale_id/edit" => "sale_edit#edit" + post 'item_void' => "sale_edit#item_void" + post 'item_void_cancel' => "sale_edit#item_void_cancel" + post 'cancel_all_void' => 'sale_edit#cancel_all_void' + post 'apply_void' => 'sale_edit#apply_void' + + get 'table/:dining_id/movetable' => "movetable#move_dining" + get 'table/:dining_id/moveroom' => "moveroom#move_dining" + get 'sale/:sale_id' => 'sales#show' + post 'sale/append_order' => 'sales#add_to_existing_invoice' + get 'room/:room_id' => 'rooms#show' + get 'order/:order_id' => "orders#show" post '/:booking_id' => 'home#item_show' get "/:id/discount" => "discounts#index" post "/:id/discount" => "discounts#create" - get "/:id/request_bills" => "request_bills#print" + post "/:id/request_bills" => "request_bills#print",:as => "request_bill" ,:defaults => { :format => 'json' } get '/:sale_id/reprint' => 'payments#reprint' ,:defaults => { :format => 'json' } + + #---------Shift ---------------# + resources :shifts, only: [:index, :show, :new, :create, :edit, :update] + #shift - index (open/close shift landing page) + #shift - show (sales summary display) + #shift - new (open shift) + #shift - edit (close shift) + + resources :cash_mgmt, only: [:new, :create] + #payment - accepting or expending money from cashier - [Cash Journal] + #payment - Incoming payments - [accept all payment types (cash, other payments (except rebate)) + #payment - Outing payments - Cash only [ *Misc expeness tracking] + #--------- Payment ------------# get 'sale/:sale_id/payment' => 'payments#show' @@ -93,6 +118,7 @@ Rails.application.routes.draw do post 'payment/master' => "master#create" post 'payment/visa' => "visa#create" post 'payment/paypar' => 'paypar_payments#create' + post 'payment/credit' => 'credit_payments#create' get 'sale/:sale_id/payment/credit_payment' => "credit_payments#index" get 'sale/:sale_id/payment/others_payment' => "others_payments#index" @@ -102,11 +128,20 @@ Rails.application.routes.draw do get 'sale/:sale_id/payment/others_payment/JCB' => "jcb#index" get 'sale/:sale_id/payment/others_payment/Redeem' => "redeem_payments#index" + #---------Void --------------# + post 'sale/:sale_id/void' => 'void#overall_void' + + #---------Multiple Invoices --------------# + get 'table/:table_id/table_invoices' => "table_invoices#index" , :as => "table_invoice_index" + get 'table/:table_id/table_invoice/:invoice_id' => "table_invoices#show" , :as => "table_invoice_show" + get 'room/:room_id/room_invoices' => "room_invoices#index" , :as => "room_invoice_index" + get 'room/:room_id/room_invoice/:invoice_id' => "room_invoices#show" , :as => "room_invoice_show" + #---------Add Customer --------------# #resources :customers get '/:sale_id/customers', to: "customers#add_customer" - get '/:customer_id/get_customer' => 'home#get_customer' - post '/:sale_id/update_sale' , to: "home#update_sale_by_customer"#update customer id in sale table + get '/:customer_id/get_customer' => 'home#get_customer',:as => "show_customer_details" + post '/:sale_id/update_sale' , to: "customers#update_sale_by_customer" # update customer id in sale table end #--------- Waiter/Ordering Station ------------# @@ -136,6 +171,10 @@ Rails.application.routes.draw do post 'update_delivery', to: "home#update_delivery_status" + # qty update + get "/:id/edit", to: "edit#index" + post "/:id", to: "edit#update" + # Pass assigned_order_item_id get 'print/print/:id', to: "print#print" get 'print/print_order_summary/:id', to: "print#print_order_summary" @@ -189,6 +228,8 @@ Rails.application.routes.draw do resources :payment_method_settings #membership_settings resources :membership_settings + resources :membership_actions + #zones resources :zones do #tables @@ -198,10 +239,12 @@ Rails.application.routes.draw do end end + #--------- Transactions Sections ------------# namespace :transactions do resources :sales resources :orders + resources :credit_notes get "/sales/:sale_id/manual_complete_sale" =>"manual_sales#manual_complete_sale", :as => "manual_complete_sale" get "/sales/:sale_id/void" =>"manual_sales#void", :as => "void" @@ -211,6 +254,8 @@ Rails.application.routes.draw do #--------- Reports Controller Sections ------------# namespace :reports do resources :receipt_no, :only => [:index, :show] + resources :daily_sales, :only => [:index, :show] + resources :sale_items, :only => [:index, :show] # resources :sales, :only => [:index, :show] # resources :orders, :only => [:index, :show] # resources :customers, :only => [:index, :show] diff --git a/db/migrate/20170331024747_create_accounts.rb b/db/migrate/20170331024747_create_accounts.rb index 5816aace..4c4a7b74 100644 --- a/db/migrate/20170331024747_create_accounts.rb +++ b/db/migrate/20170331024747_create_accounts.rb @@ -3,6 +3,10 @@ class CreateAccounts < ActiveRecord::Migration[5.1] create_table :accounts do |t| t.string :title t.string :account_type + t.boolean :discount, :null => false, :default => false + t.boolean :point, :null => false, :default => false + t.boolean :bonus, :null => false, :default => false + t.boolean :rebate, :null => false, :default => false t.timestamps end diff --git a/db/migrate/20170403140820_create_order_items.rb b/db/migrate/20170403140820_create_order_items.rb index c5382030..ca1166dc 100644 --- a/db/migrate/20170403140820_create_order_items.rb +++ b/db/migrate/20170403140820_create_order_items.rb @@ -7,6 +7,7 @@ class CreateOrderItems < ActiveRecord::Migration[5.1] t.string :item_order_by #person who order this t.string :item_code, :null => false t.string :item_name, :null => false + t.integer :account_id, :limit => 8, :null => false, :default => 1 t.decimal :qty, :precision => 10, :scale => 2, :null => false, :default => 0.00 t.decimal :price, :precision => 10, :scale => 2, :null => false, :default => 0.00 t.string :remark diff --git a/db/migrate/20170403161857_create_sale_items.rb b/db/migrate/20170403161857_create_sale_items.rb index cb07db08..48b1363e 100644 --- a/db/migrate/20170403161857_create_sale_items.rb +++ b/db/migrate/20170403161857_create_sale_items.rb @@ -5,6 +5,7 @@ class CreateSaleItems < ActiveRecord::Migration[5.1] t.string :sale_id, foreign_key: true, :limit => 16 t.string :product_code, :null => false t.string :product_name, :null => false + t.integer :account_id, :limit => 8, :null => false, :default => 1 t.string :remark t.decimal :qty, :precision => 10, :scale => 2, :null => false, :default => 0.00 t.decimal :unit_price, :precision => 10, :scale => 2, :null => false, :default => 0.00 diff --git a/db/migrate/20170403135121_create_customers.rb b/db/migrate/20170622050926_create_customers.rb similarity index 67% rename from db/migrate/20170403135121_create_customers.rb rename to db/migrate/20170622050926_create_customers.rb index 318e7bf1..07ec136f 100644 --- a/db/migrate/20170403135121_create_customers.rb +++ b/db/migrate/20170622050926_create_customers.rb @@ -1,17 +1,20 @@ class CreateCustomers < ActiveRecord::Migration[5.1] def change - create_table :customers, :id => false do |t| + create_table :customers, :id => false do |t| t.string :customer_id, :limit => 16, :primary_key => true #custom foreign_key to prevent conflict during sync t.string :name, :null => false t.string :company - t.string :contact_no, :unique => true t.string :email - t.date :date_of_birth + t.string :contact_no, :unique => true + t.date :date_of_birth + t.string :salutation + t.string :gender + t.string :nrc_no + t.string :address + t.string :card_no, :unique => true t.string :membership_id t.string :membership_type t.string :membership_authentication_code - - t.timestamps end end end diff --git a/db/migrate/20170617163811_create_dining_queues.rb b/db/migrate/20170623101708_create_dining_queues.rb similarity index 86% rename from db/migrate/20170617163811_create_dining_queues.rb rename to db/migrate/20170623101708_create_dining_queues.rb index d4b3eacd..dd2ea134 100644 --- a/db/migrate/20170617163811_create_dining_queues.rb +++ b/db/migrate/20170623101708_create_dining_queues.rb @@ -6,7 +6,8 @@ class CreateDiningQueues < ActiveRecord::Migration[5.1] t.string :queue_no t.string :status t.references :dining_facility, foreign_key: true - + t.integer :seater + t.string :remark t.timestamps end end diff --git a/db/migrate/20170626191519_create_shift_sales.rb b/db/migrate/20170626191519_create_shift_sales.rb new file mode 100644 index 00000000..762b4fc3 --- /dev/null +++ b/db/migrate/20170626191519_create_shift_sales.rb @@ -0,0 +1,25 @@ +class CreateShiftSales < ActiveRecord::Migration[5.1] + def change + create_table :shift_sales do |t| + t.references :cashier_terminal, foreign_key: true, :null => false + t.datetime :shift_started_at + t.datetime :shift_closed_at + t.references :employee, foreign_key: true #cashier + t.decimal :opening_balance, :precision => 10, :scale => 2, :null => false, :default => 0.00 + t.decimal :closing_balance, :precision => 10, :scale => 2, :null => false, :default => 0.00 + t.decimal :total_revenue, :precision => 10, :scale => 2, :null => false, :default => 0.00 + t.decimal :total_discounts, :precision => 10, :scale => 2, :null => false, :default => 0.00 + t.decimal :total_taxes, :precision => 10, :scale => 2, :null => false, :default => 0.00 + t.decimal :grand_total, :precision => 10, :scale => 2, :null => false, :default => 0.00 + t.decimal :nett_sales, :precision => 10, :scale => 2, :null => false, :default => 0.00 + t.decimal :cash_sales, :precision => 10, :scale => 2, :null => false, :default => 0.00 + t.decimal :credit_sales, :precision => 10, :scale => 2, :null => false, :default => 0.00 + t.json :other_sales + t.decimal :commercial_taxes, :precision => 10, :scale => 2, :null => false, :default => 0.00 + t.decimal :cash_in, :precision => 10, :scale => 2, :null => false, :default => 0.00 + t.decimal :cash_out, :precision => 10, :scale => 2, :null => false, :default => 0.00 + + t.timestamps + end + end +end diff --git a/db/migrate/20170627035218_create_payment_journals.rb b/db/migrate/20170627035218_create_payment_journals.rb new file mode 100644 index 00000000..e7f4c903 --- /dev/null +++ b/db/migrate/20170627035218_create_payment_journals.rb @@ -0,0 +1,15 @@ +class CreatePaymentJournals < ActiveRecord::Migration[5.1] + def change + create_table :payment_journals do |t| + t.string :payment_references,:null => false + t.string :remark + t.decimal :credit_amount, :precision => 10, :scale => 2, :null => false, :default => 0.00 + t.decimal :debit_amount, :precision => 10, :scale => 2, :null => false, :default => 0.00 + t.string :payment_method,:null => false, :default => "CASH" + t.string :payment_status,:null => false, :default => "NEW" + t.string :payment_method_references + + t.timestamps + end + end +end diff --git a/db/scaffold_structure b/db/scaffold_structure index 064f62d4..cd8a52c0 100644 --- a/db/scaffold_structure +++ b/db/scaffold_structure @@ -22,3 +22,5 @@ rails generate scaffold_controller Setup/CashierTerminal name:string is_active:b rails generate scaffold_controller Settings/OrderQueueStation station_name:string is_active:boolean processing_items:json print_copy:boolean printer_name:string font_size:integer cut_per_item:boolean use_alternate_name:boolean created_by:string --no-migration rails generate scaffold_controller transactions/Sale cashier:references cashier_name:string requested_by:string requested_at:datetime receipt_no:string receipt_date:datetime customer:references payment_status:string sale_status:string total_amount:decimal total_discount:decimal total_tax:decimal tax_type:string grand_total:decimal rounding_adjustment:decimal amount_received:decimal amount_changed:decimal --no-migration + +rails g model shift_sale cashier_terminal:references shift_started_at:datetime shift_closed_at:datetime employee:references opening_balance:decimal closing_balance:decimal total_revenue:decimal total_discounts:decimal total_taxes:decimal grand_total:decimal nett_sales:decimal cash_sales:decimal credit_sales:decimal other_sales:decimal commercial_taxes:decimal cash_in:decimal cash_out:decimal diff --git a/db/seeds.rb b/db/seeds.rb index 56591e2c..841495d4 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -73,18 +73,19 @@ booking_status = Lookup.create([{lookup_type:'booking_status', name: 'Available' {lookup_type:'booking_status', name: 'Moved', value: 'moved'}]) #booking_status -account_type = Lookup.create([{lookup_type:'account_type', name: 'Income', value: 'income'}, - {lookup_type:'account_type', name: 'Expense', value: 'expense'}]) +account_type = Lookup.create([{lookup_type:'account_type', name: 'Income', value: '0'}, + {lookup_type:'account_type', name: 'Expense', value: '1'}]) # sale void reason void_reason = Lookup.create([{lookup_type:'void_reason', name: 'Approve By Manager', value: 'Approve By Manager'}, {lookup_type:'void_reason', name: 'Customer Mistake', value: 'Customer Mistake'}, - {lookup_type:'void_reason', name: 'Cashier Mistake', value: 'Cashier Mistake'}, + {lookup_type:'void_reason', name: 'Cashier Mistake', value: 'Cashier Mistake'}, {lookup_type:'void_reason', name: 'Waiter Mistake', value: 'Waiter Mistake'}]) #WALK CUSTOMER - Default CUSTOMER (take key 1) -customer = Customer.create({name:"WALK-IN", email: "cus1@customer.com", contact_no:"000000000"}) -customer2 = Customer.create({name:"TAKEAWAY", email: "cus2@customer.com", contact_no:"111111111"}) +customer = Customer.create({name:"WALK-IN", email: "cus1@customer.com", contact_no:"000000000",card_no:"000"}) +customer2 = Customer.create({name:"TAKEAWAY", email: "cus2@customer.com", contact_no:"111111111",card_no:"111"}) + #Default ZOne # zone = Zone.create({id:1, name: "Normal Zone", is_active:true, created_by: "SYSTEM DEFAULT"}) @@ -130,7 +131,8 @@ menu_item_attribute_size_small = MenuItemAttribute.create({attribute_type:"size" menu_item_attribute_size_medium = MenuItemAttribute.create({attribute_type:"size",name: "Medium", value: "medium"}) menu_item_attribute_size_large = MenuItemAttribute.create({attribute_type:"size", name: "Large", value: "large"}) - +shop = Shop.create({id:1, name: "Beauty In the Pot", address:'No.42-A, Sayar San Road, Bahan, Yangon', township:"Bahan",state:"Yangon",city:"Yangon", country:"Myanmar", phone_no:"+95(9) 252221188, +95(9) 252221177",reservation_no:"111",license:"123", +activated_at:"2017-06-26 08:36:24",license_data:"test",base_currency:"111",id_prefix:"111"}) #Default Order Queue stations # order_queue_station1 = OrderQueueStation.create({station_name: "Queue Station 1", is_active: true,printer_name: "kitchen_printer", processing_items: JSON.generate(['01001','01002','01003','01004']), print_copy:true, cut_per_item: false, use_alternate_name: false, created_by: "SYSTEM DEFAULT"}) # order_queue_station2 = OrderQueueStation.create({station_name: "Queue Station 2", is_active: true,printer_name: "drink_printer", processing_items: JSON.generate(['02005','02006','02007','02008']), print_copy:true, cut_per_item: true, use_alternate_name: true, created_by: "SYSTEM DEFAULT"}) @@ -161,7 +163,8 @@ member_actions= MembershipAction.create([{membership_type:"get_account_balance", {membership_type:"update_membership_customer",gateway_url:"/api/generic_customer/update_membership_customer",merchant_account_id:"vWSsseoZCzxd6xcNf_uS",auth_token:"code2lab"}, {membership_type:"get_all_member_group",gateway_url:"/api/member_group/get_all_member_group",merchant_account_id:"vWSsseoZCzxd6xcNf_uS",auth_token:"code2lab"}, {membership_type:"rebate",gateway_url:"/api/membership_campaigns/rebate",additional_parameter:{campaign_type_id:1},merchant_account_id:"vWSsseoZCzxd6xcNf_uS",auth_token:"code2lab"}, - {membership_type:"get_all_member_account",gateway_url:"/api/generic_customer/get_membership_data",merchant_account_id:"vWSsseoZCzxd6xcNf_uS",auth_token:"code2lab"} + {membership_type:"get_all_member_account",gateway_url:"/api/generic_customer/get_membership_data",merchant_account_id:"vWSsseoZCzxd6xcNf_uS",auth_token:"code2lab"}, + {membership_type:"get_member_transactions",gateway_url:"/api/generic_customer/get_membership_transactions",merchant_account_id:"vWSsseoZCzxd6xcNf_uS",auth_token:"code2lab"} ]) payment_methods = PaymentMethodSetting.create({payment_method:"MPU",gateway_url: "http://192.168.1.47:3006"}) diff --git a/lib/tasks/menu_import.rake b/lib/tasks/menu_import.rake index b533dbb2..1979d364 100644 --- a/lib/tasks/menu_import.rake +++ b/lib/tasks/menu_import.rake @@ -10,215 +10,224 @@ menu_category1 = MenuCategory.create({menu: menu, code:"C001", name: "Soup Base" # single pot menu_category1_menu_item0 = SimpleMenuItem.create({item_code:"01001", name: "Single Pot", alt_name: "Single Pot",menu_category: menu_category1 , min_selectable_item: 1, max_selectable_item:1, account: food }) menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Single Pot",item_instance_code:"II0011", menu_item: menu_category1_menu_item0, price:10.00, is_on_promotion:false}]) - menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Beauty Collagen Broth",item_instance_code:"II0041", menu_item: menu_category1_menu_item0, price:15800.00, is_on_promotion:false}]) - menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Spicy Nourishing Broth ",item_instance_code:"II0051", menu_item: menu_category1_menu_item0, price:15800.00, is_on_promotion:false}]) - menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Cooling Coconut Broth",item_instance_code:"II0071", menu_item: menu_category1_menu_item0, price:15800.00, is_on_promotion:false}]) - menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Lonevity Wild Pine Mushroom Broth",item_instance_code:"II0081", menu_item: menu_category1_menu_item0, price:15800.00, is_on_promotion:false}]) - menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Herbal Drunken Chicken Broth",item_instance_code:"II0061", menu_item: menu_category1_menu_item0, price:17800.00, is_on_promotion:false}]) - menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Vitamin C Tomato Sweet Corn Broth",item_instance_code:"II0091", menu_item: menu_category1_menu_item0, price:15800.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Beauty Collagen Broth",item_instance_code:"II0051", menu_item: menu_category1_menu_item0, price:15800.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Spicy Nourishing Broth ",item_instance_code:"II0061", menu_item: menu_category1_menu_item0, price:15800.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Herbal Drunken Chicken Broth",item_instance_code:"II0071", menu_item: menu_category1_menu_item0, price:17800.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Cooling Coconut Broth",item_instance_code:"II0081", menu_item: menu_category1_menu_item0, price:15800.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Lonevity Wild Pine Mushroom Broth",item_instance_code:"II0091", menu_item: menu_category1_menu_item0, price:15800.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Vitamin C Tomato Sweet Corn Broth",item_instance_code:"II0101", menu_item: menu_category1_menu_item0, price:15800.00, is_on_promotion:false}]) # twin pot menu_category1_menu_item1 = SimpleMenuItem.create({item_code:"01002", name: "Twin Pot", alt_name: "Twin Pot",menu_category: menu_category1 , min_selectable_item: 2, max_selectable_item:2, account: food }) menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Twin Pot",item_instance_code:"II0021", menu_item: menu_category1_menu_item1, price:10.00, is_on_promotion:false}]) - menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Beauty Collagen Broth",item_instance_code:"II0042", menu_item: menu_category1_menu_item1, price:9800.00, is_on_promotion:false}]) - menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Spicy Nourishing Broth ",item_instance_code:"II0052", menu_item: menu_category1_menu_item1, price:9800.00, is_on_promotion:false}]) - menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Cooling Coconut Broth",item_instance_code:"II0072", menu_item: menu_category1_menu_item1, price:9800.00, is_on_promotion:false}]) - menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Lonevity Wild Pine Mushroom Broth",item_instance_code:"II0082", menu_item: menu_category1_menu_item1, price:9800.00, is_on_promotion:false}]) - menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Herbal Drunken Chicken Broth",item_instance_code:"II0062", menu_item: menu_category1_menu_item1, price:9800.00, is_on_promotion:false}]) - menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Vitamin C Tomato Sweet Corn Broth",item_instance_code:"II0092", menu_item: menu_category1_menu_item1, price:11800.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Beauty Collagen Broth",item_instance_code:"II0052", menu_item: menu_category1_menu_item1, price:9800.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Spicy Nourishing Broth ",item_instance_code:"II0062", menu_item: menu_category1_menu_item1, price:9800.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Herbal Drunken Chicken Broth",item_instance_code:"II0072", menu_item: menu_category1_menu_item1, price:9800.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Cooling Coconut Broth",item_instance_code:"II0082", menu_item: menu_category1_menu_item1, price:9800.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Lonevity Wild Pine Mushroom Broth",item_instance_code:"II0092", menu_item: menu_category1_menu_item1, price:9800.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Vitamin C Tomato Sweet Corn Broth",item_instance_code:"II0102", menu_item: menu_category1_menu_item1, price:11800.00, is_on_promotion:false}]) # vip room Individual pot menu_category1_menu_item2 = SimpleMenuItem.create({item_code:"01003", name: "VIP Room Individual Pot", alt_name: "Single Pot",menu_category: menu_category1 , min_selectable_item: 1, max_selectable_item:1, account: food }) menu_item0_instance = MenuItemInstance.create([{item_instance_name:"VIP Room Individual Pot",item_instance_code:"II0031", menu_item: menu_category1_menu_item2, price:10.00, is_on_promotion:false}]) - menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Beauty Collagen Broth",item_instance_code:"II0043", menu_item: menu_category1_menu_item2, price:6000.00, is_on_promotion:false}]) - menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Spicy Nourishing Broth ",item_instance_code:"II0053", menu_item: menu_category1_menu_item2, price:6000.00, is_on_promotion:false}]) - menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Cooling Coconut Broth",item_instance_code:"II0073", menu_item: menu_category1_menu_item2, price:6000.00, is_on_promotion:false}]) - menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Lonevity Wild Pine Mushroom Broth",item_instance_code:"II0083", menu_item: menu_category1_menu_item2, price:6000.00, is_on_promotion:false}]) - menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Herbal Drunken Chicken Broth",item_instance_code:"II0063", menu_item: menu_category1_menu_item2, price:6000.00, is_on_promotion:false}]) - menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Vitamin C Tomato Sweet Corn Broth",item_instance_code:"II0093", menu_item: menu_category1_menu_item2, price:6000.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Beauty Collagen Broth",item_instance_code:"II0053", menu_item: menu_category1_menu_item2, price:6000.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Spicy Nourishing Broth ",item_instance_code:"II0063", menu_item: menu_category1_menu_item2, price:6000.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Herbal Drunken Chicken Broth",item_instance_code:"II0073", menu_item: menu_category1_menu_item2, price:8000.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Cooling Coconut Broth",item_instance_code:"II0083", menu_item: menu_category1_menu_item2, price:6000.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Lonevity Wild Pine Mushroom Broth",item_instance_code:"II0093", menu_item: menu_category1_menu_item2, price:6000.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Vitamin C Tomato Sweet Corn Broth",item_instance_code:"II0103", menu_item: menu_category1_menu_item2, price:6000.00, is_on_promotion:false}]) + # Quart pot + menu_category1_menu_item3 = SimpleMenuItem.create({item_code:"01004", name: "Quart Pot", alt_name: "Quart Pot",menu_category: menu_category1 , min_selectable_item: 1, max_selectable_item:1, account: food }) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Quart Pot",item_instance_code:"II0041", menu_item: menu_category1_menu_item3, price:10.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Beauty Collagen Broth",item_instance_code:"II0054", menu_item: menu_category1_menu_item3, price:6000.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Spicy Nourishing Broth ",item_instance_code:"II0064", menu_item: menu_category1_menu_item3, price:6000.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Herbal Drunken Chicken Broth",item_instance_code:"II0074", menu_item: menu_category1_menu_item3, price:8000.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Cooling Coconut Broth",item_instance_code:"II0084", menu_item: menu_category1_menu_item3, price:6000.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Lonevity Wild Pine Mushroom Broth",item_instance_code:"II0094", menu_item: menu_category1_menu_item3, price:6000.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Vitamin C Tomato Sweet Corn Broth",item_instance_code:"II0104", menu_item: menu_category1_menu_item3, price:6000.00, is_on_promotion:false}]) + + # Assorted Platter -menu_category2 = MenuCategory.create({menu: menu, code:"C002", name: "Assorted Platter", alt_name: "Assorted Platter", order_by: 2, created_by: "SYSTEM DEFAULT"}) +menu_category2 = MenuCategory.create({menu: menu, code:"C002", name: "Specialty Assorted Platter", alt_name: "Assorted Platter", order_by: 2, created_by: "SYSTEM DEFAULT"}) # Pork Platter - menu_category1_menu_item3 = SimpleMenuItem.create({item_code:"01004", name: "Pork Platter", alt_name: "Twin Pot",menu_category: menu_category2 , min_selectable_item: 1, max_selectable_item:1, account: food }) - menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Pork Platter",item_instance_code:"II0101", menu_item: menu_category1_menu_item3, price:10000.00, is_on_promotion:false}]) + menu_category1_menu_item3 = SimpleMenuItem.create({item_code:"01048", name: "Pork Platter", alt_name: "Twin Pot",menu_category: menu_category2 , min_selectable_item: 1, max_selectable_item:1, account: food }) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Pork Platter",item_instance_code:"II0111", menu_item: menu_category1_menu_item3, price:10000.00, is_on_promotion:false}]) # Beef Platter menu_category1_menu_item4 = SimpleMenuItem.create({item_code:"01005", name: "Beef Platter", alt_name: "Twin Pot",menu_category: menu_category2 , min_selectable_item: 1, max_selectable_item:1, account: food }) - menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Beef Platter",item_instance_code:"II0111", menu_item: menu_category1_menu_item4, price:24000.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Beef Platter",item_instance_code:"II0121", menu_item: menu_category1_menu_item4, price:24000.00, is_on_promotion:false}]) # Assorted Seafood Platter menu_category1_menu_item5 = SimpleMenuItem.create({item_code:"01006", name: "Assorted Seafood Platter", alt_name: "Twin Pot",menu_category: menu_category2 , min_selectable_item: 1, max_selectable_item:1, account: food }) - menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Assorted Seafood Platter",item_instance_code:"II0121", menu_item: menu_category1_menu_item5, price:66000.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Assorted Seafood Platter",item_instance_code:"II0131", menu_item: menu_category1_menu_item5, price:66000.00, is_on_promotion:false}]) # Beef & Mutton menu_category3 = MenuCategory.create({menu: menu, code:"C003", name: "Beef & Mutton", alt_name: "Beef_and_mutton", order_by: 3,created_by: "SYSTEM DEFAULT"}) # Australia Angus Boneless Short Rib menu_category1_menu_item6 = SimpleMenuItem.create({item_code:"01007", name: "Australia Angus Boneless Short Rib", alt_name: "Twin Pot",menu_category: menu_category3 , min_selectable_item: 1, max_selectable_item:1, account: food }) - menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Half Potion",item_instance_code:"II0132", menu_item: menu_category1_menu_item5, price:12500.00, is_on_promotion:false}]) - menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Full Potion",item_instance_code:"II0131", menu_item: menu_category1_menu_item5, price:25000.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Half Potion",item_instance_code:"II0142", menu_item: menu_category1_menu_item5, price:12500.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Full Potion",item_instance_code:"II0141", menu_item: menu_category1_menu_item5, price:25000.00, is_on_promotion:false}]) # Spain Beef menu_category1_menu_item7 = SimpleMenuItem.create({item_code:"01008", name: "Spain Beef", alt_name: "Twin Pot",menu_category: menu_category3 , min_selectable_item: 1, max_selectable_item:1, account: food }) - menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Half Potion",item_instance_code:"II0142", menu_item: menu_category1_menu_item7, price:8000.00, is_on_promotion:false}]) - menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Full Potion",item_instance_code:"II0141", menu_item: menu_category1_menu_item7, price:16000.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Half Potion",item_instance_code:"II0152", menu_item: menu_category1_menu_item7, price:8000.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Full Potion",item_instance_code:"II0151", menu_item: menu_category1_menu_item7, price:16000.00, is_on_promotion:false}]) # Sliced Beef (Thin) menu_category1_menu_item8 = SimpleMenuItem.create({item_code:"01009", name: "Sliced Beef (Thin)", alt_name: "Twin Pot",menu_category: menu_category3 , min_selectable_item: 1, max_selectable_item:1, account: food }) - menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Half Potion",item_instance_code:"II0152", menu_item: menu_category1_menu_item7, price:6000.00, is_on_promotion:false}]) - menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Full Potion",item_instance_code:"II0151", menu_item: menu_category1_menu_item7, price:12000.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Half Potion",item_instance_code:"II0162", menu_item: menu_category1_menu_item8, price:6000.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Full Potion",item_instance_code:"II0161", menu_item: menu_category1_menu_item8, price:12000.00, is_on_promotion:false}]) # Tender Sliced Beef menu_category1_menu_item9 = SimpleMenuItem.create({item_code:"01010", name: "Tender Sliced Beef", alt_name: "Twin Pot",menu_category: menu_category3 , min_selectable_item: 1, max_selectable_item:1, account: food }) - menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Half Potion",item_instance_code:"II0162", menu_item: menu_category1_menu_item7, price:6000.00, is_on_promotion:false}]) - menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Full Potion",item_instance_code:"II0161", menu_item: menu_category1_menu_item7, price:12000.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Half Potion",item_instance_code:"II0172", menu_item: menu_category1_menu_item9, price:6000.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Full Potion",item_instance_code:"II0171", menu_item: menu_category1_menu_item9, price:12000.00, is_on_promotion:false}]) # Beef Tripe menu_category1_menu_item10 = SimpleMenuItem.create({item_code:"01011", name: "Beef Tripe", alt_name: "Twin Pot",menu_category: menu_category3 , min_selectable_item: 1, max_selectable_item:1, account: food }) - menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Half Potion",item_instance_code:"II0172", menu_item: menu_category1_menu_item7, price:3500.00, is_on_promotion:false}]) - menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Full Potion",item_instance_code:"II0171", menu_item: menu_category1_menu_item7, price:7000.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Half Potion",item_instance_code:"II0182", menu_item: menu_category1_menu_item10, price:3500.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Full Potion",item_instance_code:"II0181", menu_item: menu_category1_menu_item10, price:7000.00, is_on_promotion:false}]) # Braised Cow's Stomach menu_category1_menu_item11 = SimpleMenuItem.create({item_code:"01012", name: "Braised Cow's Stomach", alt_name: "Twin Pot",menu_category: menu_category3 , min_selectable_item: 1, max_selectable_item:1, account: food }) - menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Half Potion",item_instance_code:"II0182", menu_item: menu_category1_menu_item11, price:7000.00, is_on_promotion:false}]) - menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Full Potion",item_instance_code:"II0181", menu_item: menu_category1_menu_item11, price:14000.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Half Potion",item_instance_code:"II0192", menu_item: menu_category1_menu_item11, price:7000.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Full Potion",item_instance_code:"II0191", menu_item: menu_category1_menu_item11, price:14000.00, is_on_promotion:false}]) + # Sliced Lamb + menu_category1_menu_item11 = SimpleMenuItem.create({item_code:"01012", name: "Sliced Lamb", alt_name: "Twin Pot",menu_category: menu_category3 , min_selectable_item: 1, max_selectable_item:1, account: food }) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Half Potion",item_instance_code:"II0202", menu_item: menu_category1_menu_item11, price:7000.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Full Potion",item_instance_code:"II0201", menu_item: menu_category1_menu_item11, price:14000.00, is_on_promotion:false}]) + # Pork menu_category4 = MenuCategory.create({menu: menu, code:"C004", name: "Pork", alt_name: "Pork", order_by: 4,created_by: "SYSTEM DEFAULT"}) - # Sliced Lamb - menu_category1_menu_item12 = SimpleMenuItem.create({item_code:"01013", name: "Sliced Lamb", alt_name: "Twin Pot",menu_category: menu_category4 , min_selectable_item: 1, max_selectable_item:1, account: food }) - menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Half Potion",item_instance_code:"II0192", menu_item: menu_category1_menu_item12, price:6000.00, is_on_promotion:false}]) - menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Full Potion",item_instance_code:"II0191", menu_item: menu_category1_menu_item12, price:12000.00, is_on_promotion:false}]) # Sliced Tenderloin Pork menu_category1_menu_item13 = SimpleMenuItem.create({item_code:"01014", name: "Sliced Tenderloin Pork", alt_name: "Twin Pot",menu_category: menu_category4 , min_selectable_item: 1, max_selectable_item:1, account: food }) - menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Half Potion",item_instance_code:"II0202", menu_item: menu_category1_menu_item13, price:4000.00, is_on_promotion:false}]) - menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Full Potion",item_instance_code:"II0201", menu_item: menu_category1_menu_item13, price:8000.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Half Potion",item_instance_code:"II0212", menu_item: menu_category1_menu_item13, price:4000.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Full Potion",item_instance_code:"II0211", menu_item: menu_category1_menu_item13, price:8000.00, is_on_promotion:false}]) # Sliced Pork Belly menu_category1_menu_item14 = SimpleMenuItem.create({item_code:"01015", name: "Sliced Pork Belly", alt_name: "Twin Pot",menu_category: menu_category4 , min_selectable_item: 1, max_selectable_item:1, account: food }) - menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Half Potion",item_instance_code:"II0212", menu_item: menu_category1_menu_item14, price:4000.00, is_on_promotion:false}]) - menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Full Potion",item_instance_code:"II0211", menu_item: menu_category1_menu_item14, price:8000.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Half Potion",item_instance_code:"II0222", menu_item: menu_category1_menu_item14, price:4000.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Full Potion",item_instance_code:"II0221", menu_item: menu_category1_menu_item14, price:8000.00, is_on_promotion:false}]) # Sliced Pork Collar menu_category1_menu_item15 = SimpleMenuItem.create({item_code:"01016", name: "Sliced Pork Collar", alt_name: "Twin Pot",menu_category: menu_category4 , min_selectable_item: 1, max_selectable_item:1, account: food }) - menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Half Potion",item_instance_code:"II0222", menu_item: menu_category1_menu_item15, price:4000.00, is_on_promotion:false}]) - menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Full Potion",item_instance_code:"II0221", menu_item: menu_category1_menu_item15, price:8000.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Half Potion",item_instance_code:"II0232", menu_item: menu_category1_menu_item15, price:4000.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Full Potion",item_instance_code:"II0231", menu_item: menu_category1_menu_item15, price:8000.00, is_on_promotion:false}]) # Pork Jawl menu_category1_menu_item16 = SimpleMenuItem.create({item_code:"01017", name: "Pork Jawl", alt_name: "Twin Pot",menu_category: menu_category4 , min_selectable_item: 1, max_selectable_item:1, account: food }) - menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Half Potion",item_instance_code:"II0232", menu_item: menu_category1_menu_item16, price:4000.00, is_on_promotion:false}]) - menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Full Potion",item_instance_code:"II0231", menu_item: menu_category1_menu_item16, price:8000.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Half Potion",item_instance_code:"II0242", menu_item: menu_category1_menu_item16, price:4000.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Full Potion",item_instance_code:"II0241", menu_item: menu_category1_menu_item16, price:8000.00, is_on_promotion:false}]) # Tender Sliced Tenderloin Pork menu_category1_menu_item17 = SimpleMenuItem.create({item_code:"01018", name: "Tender Sliced Tenderloin Pork", alt_name: "Twin Pot",menu_category: menu_category4 , min_selectable_item: 1, max_selectable_item:1, account: food }) - menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Half Potion",item_instance_code:"II0242", menu_item: menu_category1_menu_item17, price:4000.00, is_on_promotion:false}]) - menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Full Potion",item_instance_code:"II0241", menu_item: menu_category1_menu_item17, price:8000.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Half Potion",item_instance_code:"II0252", menu_item: menu_category1_menu_item17, price:4000.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Full Potion",item_instance_code:"II0251", menu_item: menu_category1_menu_item17, price:8000.00, is_on_promotion:false}]) # Spicy Sliced Pork menu_category1_menu_item18 = SimpleMenuItem.create({item_code:"01019", name: "Spicy Sliced Pork", alt_name: "Twin Pot",menu_category: menu_category4 , min_selectable_item: 1, max_selectable_item:1, account: food }) - menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Half Potion",item_instance_code:"II0252", menu_item: menu_category1_menu_item18, price:4000.00, is_on_promotion:false}]) - menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Full Potion",item_instance_code:"II0251", menu_item: menu_category1_menu_item18, price:8000.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Half Potion",item_instance_code:"II0262", menu_item: menu_category1_menu_item18, price:4000.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Full Potion",item_instance_code:"II0261", menu_item: menu_category1_menu_item18, price:8000.00, is_on_promotion:false}]) # Pig's Tongue menu_category1_menu_item19 = SimpleMenuItem.create({item_code:"01020", name: "Pig's Tongue", alt_name: "Twin Pot",menu_category: menu_category4 , min_selectable_item: 1, max_selectable_item:1, account: food }) - menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Half Potion",item_instance_code:"II0262", menu_item: menu_category1_menu_item19, price:60000.00, is_on_promotion:false}]) - menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Full Potion",item_instance_code:"II0261", menu_item: menu_category1_menu_item19, price:12000.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Half Potion",item_instance_code:"II0272", menu_item: menu_category1_menu_item19, price:60000.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Full Potion",item_instance_code:"II0271", menu_item: menu_category1_menu_item19, price:12000.00, is_on_promotion:false}]) # Luncheon Meat menu_category1_menu_item20 = SimpleMenuItem.create({item_code:"01021", name: "Luncheon Meat", alt_name: "Twin Pot",menu_category: menu_category4 , min_selectable_item: 1, max_selectable_item:1, account: food }) - menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Half Potion",item_instance_code:"II0272", menu_item: menu_category1_menu_item20, price:2500.00, is_on_promotion:false}]) - menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Full Potion",item_instance_code:"II0271", menu_item: menu_category1_menu_item20, price:5000.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Half Potion",item_instance_code:"II0282", menu_item: menu_category1_menu_item20, price:2500.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Full Potion",item_instance_code:"II0281", menu_item: menu_category1_menu_item20, price:5000.00, is_on_promotion:false}]) # Pig's Liver menu_category1_menu_item21 = SimpleMenuItem.create({item_code:"01022", name: "Pig's Liver", alt_name: "Twin Pot",menu_category: menu_category4 , min_selectable_item: 1, max_selectable_item:1, account: food }) - menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Half Potion",item_instance_code:"II0282", menu_item: menu_category1_menu_item21, price:2500.00, is_on_promotion:false}]) - menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Full Potion",item_instance_code:"II0281", menu_item: menu_category1_menu_item21, price:5000.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Half Potion",item_instance_code:"II0292", menu_item: menu_category1_menu_item21, price:2500.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Full Potion",item_instance_code:"II0291", menu_item: menu_category1_menu_item21, price:5000.00, is_on_promotion:false}]) # Pig's Intestine menu_category1_menu_item22 = SimpleMenuItem.create({item_code:"01023", name: "Pig's Intestine", alt_name: "Twin Pot",menu_category: menu_category4 , min_selectable_item: 1, max_selectable_item:1, account: food }) - menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Half Potion",item_instance_code:"II0292", menu_item: menu_category1_menu_item22, price:3000.00, is_on_promotion:false}]) - menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Full Potion",item_instance_code:"II0291", menu_item: menu_category1_menu_item22, price:6000.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Half Potion",item_instance_code:"II0302", menu_item: menu_category1_menu_item22, price:3000.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Full Potion",item_instance_code:"II0301", menu_item: menu_category1_menu_item22, price:6000.00, is_on_promotion:false}]) # Chicken menu_category5 = MenuCategory.create({menu: menu, code:"C005", name: "Chicken", alt_name: "Chicken", order_by: 5, created_by: "SYSTEM DEFAULT"}) # Sliced Chicken Breast menu_category1_menu_item23 = SimpleMenuItem.create({item_code:"01024", name: "Sliced Chicken Breast", alt_name: "Twin Pot",menu_category: menu_category5 , min_selectable_item: 1, max_selectable_item:1, account: food }) - menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Half Potion",item_instance_code:"II0302", menu_item: menu_category1_menu_item23, price:3500.00, is_on_promotion:false}]) - menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Full Potion",item_instance_code:"II0301", menu_item: menu_category1_menu_item23, price:7000.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Half Potion",item_instance_code:"II0312", menu_item: menu_category1_menu_item23, price:3500.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Full Potion",item_instance_code:"II0311", menu_item: menu_category1_menu_item23, price:7000.00, is_on_promotion:false}]) # Sliced Chicken Thigh menu_category1_menu_item24 = SimpleMenuItem.create({item_code:"01025", name: "Sliced Chicken Thigh", alt_name: "Twin Pot",menu_category: menu_category5 , min_selectable_item: 1, max_selectable_item:1, account: food }) - menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Half Potion",item_instance_code:"II0312", menu_item: menu_category1_menu_item24, price:3500.00, is_on_promotion:false}]) - menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Full Potion",item_instance_code:"II0311", menu_item: menu_category1_menu_item24, price:7000.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Half Potion",item_instance_code:"II0322", menu_item: menu_category1_menu_item24, price:3500.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Full Potion",item_instance_code:"II0321", menu_item: menu_category1_menu_item24, price:7000.00, is_on_promotion:false}]) # Crunchy Gourmet Chicken Sausage menu_category1_menu_item25 = SimpleMenuItem.create({item_code:"01026", name: "Crunchy Gourmet Chicken Sausage", alt_name: "Twin Pot",menu_category: menu_category5 , min_selectable_item: 1, max_selectable_item:1, account: food }) - menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Half Potion",item_instance_code:"II0322", menu_item: menu_category1_menu_item25, price:4000.00, is_on_promotion:false}]) - menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Full Potion",item_instance_code:"II0321", menu_item: menu_category1_menu_item25, price:8000.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Half Potion",item_instance_code:"II0332", menu_item: menu_category1_menu_item25, price:4000.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Full Potion",item_instance_code:"II0331", menu_item: menu_category1_menu_item25, price:8000.00, is_on_promotion:false}]) # Cheesy Chicken Sausage menu_category1_menu_item26 = SimpleMenuItem.create({item_code:"01027", name: "Cheesy Chicken Sausage", alt_name: "Twin Pot",menu_category: menu_category5 , min_selectable_item: 1, max_selectable_item:1, account: food }) - menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Half Potion",item_instance_code:"II0332", menu_item: menu_category1_menu_item26, price:4800.00, is_on_promotion:false}]) - menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Full Potion",item_instance_code:"II0331", menu_item: menu_category1_menu_item26, price:9600.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Half Potion",item_instance_code:"II0342", menu_item: menu_category1_menu_item26, price:4800.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Full Potion",item_instance_code:"II0341", menu_item: menu_category1_menu_item26, price:9600.00, is_on_promotion:false}]) # Chicken Feet Skin menu_category1_menu_item27 = SimpleMenuItem.create({item_code:"01028", name: "Chicken Feet Skin", alt_name: "Twin Pot",menu_category: menu_category5 , min_selectable_item: 1, max_selectable_item:1, account: food }) - menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Half Potion",item_instance_code:"II0342", menu_item: menu_category1_menu_item27, price:2500.00, is_on_promotion:false}]) - menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Full Potion",item_instance_code:"II0341", menu_item: menu_category1_menu_item27, price:5000.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Half Potion",item_instance_code:"II0352", menu_item: menu_category1_menu_item27, price:2500.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Full Potion",item_instance_code:"II0351", menu_item: menu_category1_menu_item27, price:5000.00, is_on_promotion:false}]) # Chinese Wine Kampong Chicken menu_category1_menu_item28 = SimpleMenuItem.create({item_code:"01029", name: "Chinese Wine Kampong Chicken", alt_name: "Twin Pot",menu_category: menu_category5 , min_selectable_item: 1, max_selectable_item:1, account: food }) - menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Half Potion",item_instance_code:"II0352", menu_item: menu_category1_menu_item28, price:8000.00, is_on_promotion:false}]) - menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Full Potion",item_instance_code:"II0351", menu_item: menu_category1_menu_item28, price:16000.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Half Potion",item_instance_code:"II0362", menu_item: menu_category1_menu_item28, price:8000.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Full Potion",item_instance_code:"II0361", menu_item: menu_category1_menu_item28, price:16000.00, is_on_promotion:false}]) # Handmade Balls menu_category6 = MenuCategory.create({menu: menu, code:"C006", name: "Handmade Balls", alt_name: "Soup_base", order_by: 6,created_by: "SYSTEM DEFAULT"}) # Soft Bone Pork Meatball menu_category1_menu_item29 = SimpleMenuItem.create({item_code:"01030", name: "Soft Bone Pork Meatball", alt_name: "Twin Pot",menu_category: menu_category6 , min_selectable_item: 1, max_selectable_item:1, account: food }) - menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Half Potion",item_instance_code:"II0362", menu_item: menu_category1_menu_item29, price:3000.00, is_on_promotion:false}]) - menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Full Potion",item_instance_code:"II0361", menu_item: menu_category1_menu_item29, price:6000.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Half Potion",item_instance_code:"II0372", menu_item: menu_category1_menu_item29, price:3000.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Full Potion",item_instance_code:"II0371", menu_item: menu_category1_menu_item29, price:6000.00, is_on_promotion:false}]) # Fish Ball menu_category1_menu_item30 = SimpleMenuItem.create({item_code:"01031", name: "Fish Ball", alt_name: "Twin Pot",menu_category: menu_category6 , min_selectable_item: 1, max_selectable_item:1, account: food }) - menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Half Potion",item_instance_code:"II0372", menu_item: menu_category1_menu_item30, price:3000.00, is_on_promotion:false}]) - menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Full Potion",item_instance_code:"II0371", menu_item: menu_category1_menu_item30, price:6000.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Half Potion",item_instance_code:"II0382", menu_item: menu_category1_menu_item30, price:3000.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Full Potion",item_instance_code:"II0381", menu_item: menu_category1_menu_item30, price:6000.00, is_on_promotion:false}]) # Beef Ball menu_category1_menu_item31 = SimpleMenuItem.create({item_code:"01032", name: "Beef Ball", alt_name: "Twin Pot",menu_category: menu_category6 , min_selectable_item: 1, max_selectable_item:1, account: food }) - menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Half Potion",item_instance_code:"II0382", menu_item: menu_category1_menu_item31, price:3500.00, is_on_promotion:false}]) - menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Full Potion",item_instance_code:"II0381", menu_item: menu_category1_menu_item31, price:7000.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Half Potion",item_instance_code:"II0392", menu_item: menu_category1_menu_item31, price:3500.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Full Potion",item_instance_code:"II0391", menu_item: menu_category1_menu_item31, price:7000.00, is_on_promotion:false}]) # Mushroom Ball - menu_category1_menu_item32 = SimpleMenuItem.create({item_code:"01033", name: "Mushroom Ball", alt_name: "Twin Pot",menu_category: menu_category6 , min_selectable_item: 1, max_selectable_item:1, account: food }) - menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Half Potion",item_instance_code:"II0392", menu_item: menu_category1_menu_item32, price:3000.00, is_on_promotion:false}]) - menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Full Potion",item_instance_code:"II0391", menu_item: menu_category1_menu_item32, price:7000.00, is_on_promotion:false}]) + menu_category1_menu_item32 = SimpleMenuItem.create({item_code:"01033", name: "Mushroom Pork Ball", alt_name: "Twin Pot",menu_category: menu_category6 , min_selectable_item: 1, max_selectable_item:1, account: food }) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Half Potion",item_instance_code:"II0402", menu_item: menu_category1_menu_item32, price:3000.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Full Potion",item_instance_code:"II0401", menu_item: menu_category1_menu_item32, price:7000.00, is_on_promotion:false}]) # Cuttlefish Ball menu_category1_menu_item33 = SimpleMenuItem.create({item_code:"01034", name: "Cuttlefish Ball", alt_name: "Twin Pot",menu_category: menu_category6 , min_selectable_item: 1, max_selectable_item:1, account: food }) - menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Half Potion",item_instance_code:"II0402", menu_item: menu_category1_menu_item33, price:3000.00, is_on_promotion:false}]) - menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Full Potion",item_instance_code:"II0401", menu_item: menu_category1_menu_item33, price:7000.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Half Potion",item_instance_code:"II0412", menu_item: menu_category1_menu_item33, price:3000.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Full Potion",item_instance_code:"II0411", menu_item: menu_category1_menu_item33, price:7000.00, is_on_promotion:false}]) # Cheesy Pork Ball menu_category1_menu_item34 = SimpleMenuItem.create({item_code:"01035", name: "Cheesy Pork Ball", alt_name: "Twin Pot",menu_category: menu_category6 , min_selectable_item: 1, max_selectable_item:1, account: food }) - menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Half Potion",item_instance_code:"II0412", menu_item: menu_category1_menu_item34, price:3500.00, is_on_promotion:false}]) - menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Full Potion",item_instance_code:"II0411", menu_item: menu_category1_menu_item34, price:7000.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Half Potion",item_instance_code:"II0422", menu_item: menu_category1_menu_item34, price:3500.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Full Potion",item_instance_code:"II0421", menu_item: menu_category1_menu_item34, price:7000.00, is_on_promotion:false}]) # Assorted Ball Platter menu_category1_menu_item35 = SimpleMenuItem.create({item_code:"01036", name: "Assorted Ball Platter", alt_name: "Twin Pot",menu_category: menu_category6 , min_selectable_item: 1, max_selectable_item:1, account: food }) - menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Half Potion",item_instance_code:"II0421", menu_item: menu_category1_menu_item35, price:7800.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"",item_instance_code:"II0431", menu_item: menu_category1_menu_item35, price:7800.00, is_on_promotion:false}]) # Specialty Homemade Paste menu_category7 = MenuCategory.create({menu: menu, code:"C007", name: "Specialty Homemade Paste", alt_name: "Beef_and_mutton", order_by: 7,created_by: "SYSTEM DEFAULT"}) # Fish Paste menu_category1_menu_item36 = SimpleMenuItem.create({item_code:"01037", name: "Fish Paste", alt_name: "Twin Pot",menu_category: menu_category7 , min_selectable_item: 1, max_selectable_item:1, account: food }) - menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Full Potion",item_instance_code:"II0431", menu_item: menu_category1_menu_item36, price:4800.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"",item_instance_code:"II0441", menu_item: menu_category1_menu_item36, price:4800.00, is_on_promotion:false}]) # Century Egg Fish Paste menu_category1_menu_item37 = SimpleMenuItem.create({item_code:"01038", name: "Century Egg Fish Paste", alt_name: "Twin Pot",menu_category: menu_category7 , min_selectable_item: 1, max_selectable_item:1, account: food }) - menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Full Potion",item_instance_code:"II0441", menu_item: menu_category1_menu_item37, price:5800.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"",item_instance_code:"II0451", menu_item: menu_category1_menu_item37, price:5800.00, is_on_promotion:false}]) # Pork Paste menu_category1_menu_item38 = SimpleMenuItem.create({item_code:"01039", name: " Pork Paste", alt_name: "Twin Pot",menu_category: menu_category7 , min_selectable_item: 1, max_selectable_item:1, account: food }) - menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Full Potion",item_instance_code:"II0451", menu_item: menu_category1_menu_item38, price:5800.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"",item_instance_code:"II0461", menu_item: menu_category1_menu_item38, price:5800.00, is_on_promotion:false}]) # Dried Scallop Fish Paste menu_category1_menu_item39 = SimpleMenuItem.create({item_code:"01040", name: "Dried Scallop Fish Paste", alt_name: "Twin Pot",menu_category: menu_category7 , min_selectable_item: 1, max_selectable_item:1, account: food }) - menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Full Potion",item_instance_code:"II0461", menu_item: menu_category1_menu_item39, price:8800.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"",item_instance_code:"II0471", menu_item: menu_category1_menu_item39, price:8800.00, is_on_promotion:false}]) # Ebiko Prawn Paste menu_category1_menu_item40 = SimpleMenuItem.create({item_code:"01041", name: "Ebiko Prawn Paste", alt_name: "Twin Pot",menu_category: menu_category7 , min_selectable_item: 1, max_selectable_item:1, account: food }) - menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Full Potion",item_instance_code:"II0471", menu_item: menu_category1_menu_item40, price:11800.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"",item_instance_code:"II0481", menu_item: menu_category1_menu_item40, price:11800.00, is_on_promotion:false}]) # Seafood -menu_category8 = MenuCategory.create({menu: menu, code:"C008", name: "Seafood", alt_name: "Pork", order_by: 8,created_by: "SYSTEM DEFAULT"}) +menu_category8 = MenuCategory.create({menu: menu, code:"C008", name: "Seafood", alt_name: "Seafood", order_by: 8,created_by: "SYSTEM DEFAULT"}) # Promfret menu_category1_menu_item41 = SimpleMenuItem.create({item_code:"01042", name: "Promfret", alt_name: "Twin Pot",menu_category: menu_category7 , min_selectable_item: 1, max_selectable_item:1, account: food }) - menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Half Potion",item_instance_code:"II0481", menu_item: menu_category1_menu_item41, price:30.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Half Potion",item_instance_code:"II0492", menu_item: menu_category1_menu_item41, price:30.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Full Potion",item_instance_code:"II0491", menu_item: menu_category1_menu_item41, price:30.00, is_on_promotion:false}]) # Garoupa menu_category1_menu_item42 = SimpleMenuItem.create({item_code:"01043", name: "Garoupa", alt_name: "Twin Pot",menu_category: menu_category7 , min_selectable_item: 1, max_selectable_item:1, account: food }) - menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Small",item_instance_code:"II0491", menu_item: menu_category1_menu_item42, price:13800.00, is_on_promotion:false}]) - menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Medium",item_instance_code:"II0492", menu_item: menu_category1_menu_item42, price:18800.00, is_on_promotion:false}]) - menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Large",item_instance_code:"II0493", menu_item: menu_category1_menu_item42, price:23900.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Small",item_instance_code:"II0501", menu_item: menu_category1_menu_item42, price:13800.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Medium",item_instance_code:"II0502", menu_item: menu_category1_menu_item42, price:18800.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Large",item_instance_code:"II0503", menu_item: menu_category1_menu_item42, price:23900.00, is_on_promotion:false}]) # Sliced Fish menu_category1_menu_item43 = SimpleMenuItem.create({item_code:"01044", name: "Sliced Fish", alt_name: "Twin Pot",menu_category: menu_category7 , min_selectable_item: 1, max_selectable_item:1, account: food }) - menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Half Potion",item_instance_code:"II0502", menu_item: menu_category1_menu_item43, price:4800.00, is_on_promotion:false}]) - menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Full Potion",item_instance_code:"II0501", menu_item: menu_category1_menu_item43, price:9600.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Half Potion",item_instance_code:"II0512", menu_item: menu_category1_menu_item43, price:4800.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Full Potion",item_instance_code:"II0511", menu_item: menu_category1_menu_item43, price:9600.00, is_on_promotion:false}]) # Fresh Sea Prawns menu_category1_menu_item44 = SimpleMenuItem.create({item_code:"01045", name: "Fresh Sea Prawns", alt_name: "Twin Pot",menu_category: menu_category7 , min_selectable_item: 1, max_selectable_item:1, account: food }) - menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Half Potion",item_instance_code:"II0512", menu_item: menu_category1_menu_item44, price:9800.00, is_on_promotion:false}]) - menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Full Potion",item_instance_code:"II0511", menu_item: menu_category1_menu_item44, price:19600.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Half Potion",item_instance_code:"II0522", menu_item: menu_category1_menu_item44, price:9800.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Full Potion",item_instance_code:"II0521", menu_item: menu_category1_menu_item44, price:19600.00, is_on_promotion:false}]) # Drunken Prawns menu_category1_menu_item45 = SimpleMenuItem.create({item_code:"01046", name: "Drunken Prawns", alt_name: "Twin Pot",menu_category: menu_category7 , min_selectable_item: 1, max_selectable_item:1, account: food }) - menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Half Potion",item_instance_code:"II0522", menu_item: menu_category1_menu_item45, price:11000.00, is_on_promotion:false}]) - menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Full Potion",item_instance_code:"II0521", menu_item: menu_category1_menu_item45, price:22000.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Half Potion",item_instance_code:"II0532", menu_item: menu_category1_menu_item45, price:11000.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Full Potion",item_instance_code:"II0531", menu_item: menu_category1_menu_item45, price:22000.00, is_on_promotion:false}]) # Fish Maw menu_category1_menu_item46 = SimpleMenuItem.create({item_code:"01047", name: "Fish Maw", alt_name: "Twin Pot",menu_category: menu_category7 , min_selectable_item: 1, max_selectable_item:1, account: food }) - menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Half Potion",item_instance_code:"II0532", menu_item: menu_category1_menu_item46, price:11000.00, is_on_promotion:false}]) - menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Full Potion",item_instance_code:"II0531", menu_item: menu_category1_menu_item46, price:22000.00, is_on_promotion:false}]) - # Fresh Cittlefish - menu_category1_menu_item47 = SimpleMenuItem.create({item_code:"01048", name: "Fresh Cittlefish", alt_name: "Twin Pot",menu_category: menu_category7 , min_selectable_item: 1, max_selectable_item:1, account: food }) - menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Half Potion",item_instance_code:"II0542", menu_item: menu_category1_menu_item47, price:4700.00, is_on_promotion:false}]) - menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Full Potion",item_instance_code:"II0541", menu_item: menu_category1_menu_item47, price:9400.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Half Potion",item_instance_code:"II0542", menu_item: menu_category1_menu_item46, price:11000.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Full Potion",item_instance_code:"II0541", menu_item: menu_category1_menu_item46, price:22000.00, is_on_promotion:false}]) # Sea Cucumber menu_category1_menu_item48 = SimpleMenuItem.create({item_code:"01049", name: "Sea Cucumber", alt_name: "Twin Pot",menu_category: menu_category7 , min_selectable_item: 1, max_selectable_item:1, account: food }) menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Half Potion",item_instance_code:"II0552", menu_item: menu_category1_menu_item48, price:28800.00, is_on_promotion:false}]) @@ -232,7 +241,7 @@ menu_category8 = MenuCategory.create({menu: menu, code:"C008", name: "Seafood", menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Half Potion",item_instance_code:"II0572", menu_item: menu_category1_menu_item50, price:4400.00, is_on_promotion:false}]) menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Full Potion",item_instance_code:"II0571", menu_item: menu_category1_menu_item50, price:8800.00, is_on_promotion:false}]) # Fish Head - menu_category1_menu_item51 = SimpleMenuItem.create({item_code:"01052", name: "Fish Head", alt_name: "Twin Pot",menu_category: menu_category7 , min_selectable_item: 1, max_selectable_item:1, account: food }) + menu_category1_menu_item51 = SimpleMenuItem.create({item_code:"01052", name: "Fresh Fish Head", alt_name: "Twin Pot",menu_category: menu_category7 , min_selectable_item: 1, max_selectable_item:1, account: food }) menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Half Potion",item_instance_code:"II0582", menu_item: menu_category1_menu_item51, price:2800.00, is_on_promotion:false}]) menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Full Potion",item_instance_code:"II0581", menu_item: menu_category1_menu_item51, price:5600.00, is_on_promotion:false}]) # 10-Head Abalone @@ -249,15 +258,15 @@ menu_category8 = MenuCategory.create({menu: menu, code:"C008", name: "Seafood", menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Full Potion",item_instance_code:"II0611", menu_item: menu_category1_menu_item54, price:38000.00, is_on_promotion:false}]) # Baby Octopus menu_category1_menu_item55 = SimpleMenuItem.create({item_code:"01056", name: "Baby Octopus", alt_name: "Twin Pot",menu_category: menu_category7 , min_selectable_item: 1, max_selectable_item:1, account: food }) - menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Half Potion",item_instance_code:"II0622", menu_item: menu_category1_menu_item55, price:2900.00, is_on_promotion:false}]) - menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Full Potion",item_instance_code:"II0621", menu_item: menu_category1_menu_item55, price:58000.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Half Potion",item_instance_code:"II0622", menu_item: menu_category1_menu_item55, price:3000.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Full Potion",item_instance_code:"II0621", menu_item: menu_category1_menu_item55, price:6000.00, is_on_promotion:false}]) # Fresh Cuttlefish menu_category1_menu_item56 = SimpleMenuItem.create({item_code:"01057", name: "Fresh Cuttlefish", alt_name: "Twin Pot",menu_category: menu_category7 , min_selectable_item: 1, max_selectable_item:1, account: food }) - menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Half Potion",item_instance_code:"II0632", menu_item: menu_category1_menu_item56, price:10.00, is_on_promotion:false}]) - menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Full Potion",item_instance_code:"II0631", menu_item: menu_category1_menu_item56, price:10.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Half Potion",item_instance_code:"II0632", menu_item: menu_category1_menu_item56, price:4700.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Full Potion",item_instance_code:"II0631", menu_item: menu_category1_menu_item56, price:9400.00, is_on_promotion:false}]) # Squid Rings menu_category1_menu_item57 = SimpleMenuItem.create({item_code:"01058", name: "Squid Rings", alt_name: "Twin Pot",menu_category: menu_category7 , min_selectable_item: 1, max_selectable_item:1, account: food }) - menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Half Potion",item_instance_code:"II0042", menu_item: menu_category1_menu_item57, price:3400.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Half Potion",item_instance_code:"II0642", menu_item: menu_category1_menu_item57, price:3400.00, is_on_promotion:false}]) menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Full Potion",item_instance_code:"II0641", menu_item: menu_category1_menu_item57, price:6800.00, is_on_promotion:false}]) # Green Mussels menu_category1_menu_item58 = SimpleMenuItem.create({item_code:"01059", name: "Green Mussels", alt_name: "Twin Pot",menu_category: menu_category7 , min_selectable_item: 1, max_selectable_item:1, account: food }) @@ -265,16 +274,16 @@ menu_category8 = MenuCategory.create({menu: menu, code:"C008", name: "Seafood", menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Full Potion",item_instance_code:"II0651", menu_item: menu_category1_menu_item58, price:13000.00, is_on_promotion:false}]) # Live Crab menu_category1_menu_item59 = SimpleMenuItem.create({item_code:"01060", name: "Live Crab", alt_name: "Twin Pot",menu_category: menu_category7 , min_selectable_item: 1, max_selectable_item:1, account: food }) - menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Half Potion",item_instance_code:"II0661", menu_item: menu_category1_menu_item59, price:60.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"",item_instance_code:"II0661", menu_item: menu_category1_menu_item59, price:10.00, is_on_promotion:false}]) # Fresh Flower Crabs menu_category1_menu_item60 = SimpleMenuItem.create({item_code:"01061", name: "Fresh Flower Crabs", alt_name: "Twin Pot",menu_category: menu_category7 , min_selectable_item: 1, max_selectable_item:1, account: food }) - menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Half Potion",item_instance_code:"II0671", menu_item: menu_category1_menu_item60, price:60.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"",item_instance_code:"II0671", menu_item: menu_category1_menu_item60, price:10.00, is_on_promotion:false}]) # Live Lobster menu_category1_menu_item61 = SimpleMenuItem.create({item_code:"01062", name: "Live Lobster", alt_name: "Twin Pot",menu_category: menu_category7 , min_selectable_item: 1, max_selectable_item:1, account: food }) - menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Half Potion",item_instance_code:"II0681", menu_item: menu_category1_menu_item61, price:150.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"",item_instance_code:"II0681", menu_item: menu_category1_menu_item61, price:10.00, is_on_promotion:false}]) # Live Mantis menu_category1_menu_item62 = SimpleMenuItem.create({item_code:"01063", name: "Live Mantis", alt_name: "Twin Pot",menu_category: menu_category7 , min_selectable_item: 1, max_selectable_item:1, account: food }) - menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Half Potion",item_instance_code:"II0691", menu_item: menu_category1_menu_item62, price:150.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:" ",item_instance_code:"II0691", menu_item: menu_category1_menu_item62, price:10.00, is_on_promotion:false}]) # Dumpling menu_category9 = MenuCategory.create({menu: menu, code:"C009", name: "Dumpling", alt_name: "Chicken", order_by: 9, created_by: "SYSTEM DEFAULT"}) # Pork and Chives Dumpling @@ -295,12 +304,12 @@ menu_category9 = MenuCategory.create({menu: menu, code:"C009", name: "Dumpling", menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Full Potion",item_instance_code:"II0731", menu_item: menu_category1_menu_item66, price:5000.00, is_on_promotion:false}]) # Assorted Dumpling Platter menu_category1_menu_item67 = SimpleMenuItem.create({item_code:"01068", name: "Assorted Dumpling Platter", alt_name: "Twin Pot",menu_category: menu_category9 , min_selectable_item: 1, max_selectable_item:1, account: food }) - menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Half Potion",item_instance_code:"II0741", menu_item: menu_category1_menu_item67, price:7800.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"",item_instance_code:"II0741", menu_item: menu_category1_menu_item67, price:7800.00, is_on_promotion:false}]) # Tofu & Beancurd menu_category10 = MenuCategory.create({menu: menu, code:"C0010", name: "Tofu & Beancurd", alt_name: "Soup_base", order_by: 10,created_by: "SYSTEM DEFAULT"}) # Signature Homemade Fish Tofu menu_category1_menu_item68 = SimpleMenuItem.create({item_code:"01069", name: "Signature Homemade Fish Tofu ", alt_name: "Twin Pot",menu_category: menu_category10 , min_selectable_item: 1, max_selectable_item:1, account: food }) - menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Half Potion",item_instance_code:"II0751", menu_item: menu_category1_menu_item68, price:1500.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"",item_instance_code:"II0751", menu_item: menu_category1_menu_item68, price:1500.00, is_on_promotion:false}]) # SilkenTofu menu_category1_menu_item69 = SimpleMenuItem.create({item_code:"01070", name: "SilkenTofu", alt_name: "Twin Pot",menu_category: menu_category10 , min_selectable_item: 1, max_selectable_item:1, account: food }) menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Half Potion",item_instance_code:"II0762", menu_item: menu_category1_menu_item69, price:1000.00, is_on_promotion:false}]) @@ -337,7 +346,7 @@ menu_category12 = MenuCategory.create({menu: menu, code:"C0012", name: "Mushroom menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Full Potion",item_instance_code:"II0831", menu_item: menu_category1_menu_item76, price:4600.00, is_on_promotion:false}]) # Enoki Mushroom menu_category1_menu_item77 = SimpleMenuItem.create({item_code:"01078", name: "Enoki Mushroom", alt_name: "Twin Pot",menu_category: menu_category12 , min_selectable_item: 1, max_selectable_item:1, account: food }) - menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Half Potion",item_instance_code:"II0824", menu_item: menu_category1_menu_item77, price:2300.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Half Potion",item_instance_code:"II0842", menu_item: menu_category1_menu_item77, price:2300.00, is_on_promotion:false}]) menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Full Potion",item_instance_code:"II0841", menu_item: menu_category1_menu_item77, price:4600.00, is_on_promotion:false}]) # Fresh Mushroom menu_category1_menu_item78 = SimpleMenuItem.create({item_code:"01079", name: "Fresh Mushroom", alt_name: "Twin Pot",menu_category: menu_category12 , min_selectable_item: 1, max_selectable_item:1, account: food }) @@ -353,7 +362,7 @@ menu_category12 = MenuCategory.create({menu: menu, code:"C0012", name: "Mushroom menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Full Potion",item_instance_code:"II0871", menu_item: menu_category1_menu_item80, price:3600.00, is_on_promotion:false}]) # Assorted Mushroom Platter menu_category1_menu_item81 = SimpleMenuItem.create({item_code:"01082", name: "Assorted Mushroom Platter", alt_name: "Twin Pot",menu_category: menu_category12 , min_selectable_item: 1, max_selectable_item:1, account: food }) - menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Full Potion",item_instance_code:"II0881", menu_item: menu_category1_menu_item81, price:10000.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"",item_instance_code:"II0881", menu_item: menu_category1_menu_item81, price:10000.00, is_on_promotion:false}]) # Vegetables menu_category13 = MenuCategory.create({menu: menu, code:"C0012", name: "Vegetables", alt_name: "Beef_and_mutton", order_by: 12,created_by: "SYSTEM DEFAULT"}) # Baby Chinese Spinach @@ -381,7 +390,7 @@ menu_category13 = MenuCategory.create({menu: menu, code:"C0012", name: "Vegetabl menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Half Potion",item_instance_code:"II0942", menu_item: menu_category1_menu_item87, price:1800.00, is_on_promotion:false}]) menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Full Potion",item_instance_code:"II0941", menu_item: menu_category1_menu_item87, price:3600.00, is_on_promotion:false}]) # Sliced Potato - menu_category1_menu_item88 = SimpleMenuItem.create({item_code:"01089", name: "Sliced Potato ", alt_name: "Twin Pot",menu_category: menu_category13 , min_selectable_item: 1, max_selectable_item:1, account: food }) + menu_category1_menu_item88 = SimpleMenuItem.create({item_code:"01089", name: "Sliced Potato ", alt_name: "Twin Pot",menu_category: menu_category13 , min_selectable_item: 1, max_selectable_item:1, account: food }) menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Half Potion",item_instance_code:"II0952", menu_item: menu_category1_menu_item88, price:1300.00, is_on_promotion:false}]) menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Full Potion",item_instance_code:"II0951", menu_item: menu_category1_menu_item88, price:2600.00, is_on_promotion:false}]) # Sliced Winter Melon @@ -389,7 +398,7 @@ menu_category13 = MenuCategory.create({menu: menu, code:"C0012", name: "Vegetabl menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Half Potion",item_instance_code:"II0962", menu_item: menu_category1_menu_item89, price:1200.00, is_on_promotion:false}]) menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Full Potion",item_instance_code:"II0961", menu_item: menu_category1_menu_item89, price:2400.00, is_on_promotion:false}]) # Fried Yam - menu_category1_menu_item90 = SimpleMenuItem.create({item_code:"01091", name: "Fried Yam ", alt_name: "Twin Pot",menu_category: menu_category13 , min_selectable_item: 1, max_selectable_item:1, account: food }) + menu_category1_menu_item90 = SimpleMenuItem.create({item_code:"01091", name: "Golden Taro", alt_name: "Twin Pot",menu_category: menu_category13 , min_selectable_item: 1, max_selectable_item:1, account: food }) menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Half Potion",item_instance_code:"II0972", menu_item: menu_category1_menu_item90, price:1800.00, is_on_promotion:false}]) menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Full Potion",item_instance_code:"II0971", menu_item: menu_category1_menu_item90, price:3600.00, is_on_promotion:false}]) # Pearl Sweet Corn @@ -452,32 +461,32 @@ menu_category13 = MenuCategory.create({menu: menu, code:"C0012", name: "Vegetabl menu_category1_menu_item105 = SimpleMenuItem.create({item_code:"01106", name: "Kangkung", alt_name: "Twin Pot",menu_category: menu_category13 , min_selectable_item: 1, max_selectable_item:1, account: food }) menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Half Potion",item_instance_code:"II1122", menu_item: menu_category1_menu_item105, price:1200.00, is_on_promotion:false}]) menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Full Potion",item_instance_code:"II1121", menu_item: menu_category1_menu_item105, price:2400.00, is_on_promotion:false}]) +# Bamboo Shoot + menu_category1_menu_item105 = SimpleMenuItem.create({item_code:"01112", name: "Bamboo Shoot", alt_name: "Twin Pot",menu_category: menu_category13 , min_selectable_item: 1, max_selectable_item:1, account: food }) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Half Potion",item_instance_code:"II1132", menu_item: menu_category1_menu_item105, price:1200.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Full Potion",item_instance_code:"II1131", menu_item: menu_category1_menu_item105, price:2400.00, is_on_promotion:false}]) # Others menu_category14 = MenuCategory.create({menu: menu, code:"C0013", name: "Others", alt_name: "Pork", order_by: 13,created_by: "SYSTEM DEFAULT"}) # Quail’s Egg menu_category1_menu_item106 = SimpleMenuItem.create({item_code:"01107", name: "Quail’s Egg", alt_name: "Twin Pot",menu_category: menu_category14 , min_selectable_item: 1, max_selectable_item:1, account: food }) - menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Half Potion",item_instance_code:"II1132", menu_item: menu_category1_menu_item106, price:1500.00, is_on_promotion:false}]) - menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Full Potion",item_instance_code:"II1131", menu_item: menu_category1_menu_item106, price:3000.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Half Potion",item_instance_code:"II1142", menu_item: menu_category1_menu_item106, price:1500.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Full Potion",item_instance_code:"II1141", menu_item: menu_category1_menu_item106, price:3000.00, is_on_promotion:false}]) # Sliced Kelp menu_category1_menu_item107 = SimpleMenuItem.create({item_code:"01108", name: "Sliced Kelp", alt_name: "Twin Pot",menu_category: menu_category14 , min_selectable_item: 1, max_selectable_item:1, account: food }) - menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Half Potion",item_instance_code:"II1142", menu_item: menu_category1_menu_item107, price:1800.00, is_on_promotion:false}]) - menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Full Potion",item_instance_code:"II1141", menu_item: menu_category1_menu_item107, price:3600.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Half Potion",item_instance_code:"II1152", menu_item: menu_category1_menu_item107, price:1800.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Full Potion",item_instance_code:"II1151", menu_item: menu_category1_menu_item107, price:3600.00, is_on_promotion:false}]) # Crystal Vermicelli menu_category1_menu_item108 = SimpleMenuItem.create({item_code:"01109", name: "Crystal Vermicelli", alt_name: "Twin Pot",menu_category: menu_category14 , min_selectable_item: 1, max_selectable_item:1, account: food }) - menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Half Potion",item_instance_code:"II1152", menu_item: menu_category1_menu_item108, price:1800.00, is_on_promotion:false}]) - menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Full Potion",item_instance_code:"II1151", menu_item: menu_category1_menu_item108, price:3600.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Half Potion",item_instance_code:"II1162", menu_item: menu_category1_menu_item108, price:1800.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Full Potion",item_instance_code:"II1161", menu_item: menu_category1_menu_item108, price:3600.00, is_on_promotion:false}]) # Duck Blood menu_category1_menu_item109 = SimpleMenuItem.create({item_code:"01110", name: "Duck Blood", alt_name: "Twin Pot",menu_category: menu_category14 , min_selectable_item: 1, max_selectable_item:1, account: food }) - menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Half Potion",item_instance_code:"II1162", menu_item: menu_category1_menu_item109, price:1200.00, is_on_promotion:false}]) - menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Full Potion",item_instance_code:"II1161", menu_item: menu_category1_menu_item109, price:2400.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Half Potion",item_instance_code:"II1172", menu_item: menu_category1_menu_item109, price:1200.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Full Potion",item_instance_code:"II1171", menu_item: menu_category1_menu_item109, price:2400.00, is_on_promotion:false}]) # HK Fried Fish Skin menu_category1_menu_item110 = SimpleMenuItem.create({item_code:"01111", name: "HK Fried Fish Skin", alt_name: "Twin Pot",menu_category: menu_category14 , min_selectable_item: 1, max_selectable_item:1, account: food }) - menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Half Potion",item_instance_code:"II1172", menu_item: menu_category1_menu_item110, price:7000.00, is_on_promotion:false}]) - menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Full Potion",item_instance_code:"II1171", menu_item: menu_category1_menu_item110, price:14000.00, is_on_promotion:false}]) -# Bamboo Shoot - menu_category1_menu_item111 = SimpleMenuItem.create({item_code:"01112", name: "Bamboo Shoot", alt_name: "Twin Pot",menu_category: menu_category14 , min_selectable_item: 1, max_selectable_item:1, account: food }) - menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Half Potion",item_instance_code:"II1182", menu_item: menu_category1_menu_item111, price:2300.00, is_on_promotion:false}]) - menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Full Potion",item_instance_code:"II1181", menu_item: menu_category1_menu_item111, price:4600.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Half Potion",item_instance_code:"II1182", menu_item: menu_category1_menu_item110, price:7000.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Full Potion",item_instance_code:"II1181", menu_item: menu_category1_menu_item110, price:14000.00, is_on_promotion:false}]) # Fried Dough Sticks menu_category1_menu_item112 = SimpleMenuItem.create({item_code:"01113", name: "Fried Dough Sticks", alt_name: "Twin Pot",menu_category: menu_category14 , min_selectable_item: 1, max_selectable_item:1, account: food }) menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Half Potion",item_instance_code:"II1192", menu_item: menu_category1_menu_item112, price:1000.00, is_on_promotion:false}]) @@ -498,76 +507,76 @@ menu_category15 = MenuCategory.create({menu: menu, code:"C0014", name: "Noodles" menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Full Potion",item_instance_code:"II1221", menu_item: menu_category1_menu_item115, price:3800.00, is_on_promotion:false}]) # La Mian menu_category1_menu_item116 = SimpleMenuItem.create({item_code:"01117", name: "La Mian", alt_name: "Twin Pot",menu_category: menu_category15 , min_selectable_item: 1, max_selectable_item:1, account: food }) - menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Half Potion",item_instance_code:"II1231", menu_item: menu_category1_menu_item116, price:1800.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"",item_instance_code:"II1231", menu_item: menu_category1_menu_item116, price:1800.00, is_on_promotion:false}]) # Glass Noodle menu_category1_menu_item117 = SimpleMenuItem.create({item_code:"01118", name: "Glass Noodle ", alt_name: "Twin Pot",menu_category: menu_category15 , min_selectable_item: 1, max_selectable_item:1, account: food }) menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Half Potion",item_instance_code:"II1242", menu_item: menu_category1_menu_item117, price:1200.00, is_on_promotion:false}]) menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Full Potion",item_instance_code:"II1241", menu_item: menu_category1_menu_item117, price:2400.00, is_on_promotion:false}]) # Rice menu_category1_menu_item118 = SimpleMenuItem.create({item_code:"01119", name: "Rice", alt_name: "Twin Pot",menu_category: menu_category15 , min_selectable_item: 1, max_selectable_item:1, account: food }) - menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Half Potion",item_instance_code:"II1251", menu_item: menu_category1_menu_item118, price:1000.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"",item_instance_code:"II1251", menu_item: menu_category1_menu_item118, price:1000.00, is_on_promotion:false}]) # Drinks menu_category16 = MenuCategory.create({menu: menu, code:"C0015", name: "Drinks", alt_name: "Soup_base", order_by: 15,created_by: "SYSTEM DEFAULT"}) # Hot Homemade Fruit Tea menu_category1_menu_item119 = SimpleMenuItem.create({item_code:"01120", name: "Hot Homemade Fruit Tea", alt_name: "Twin Pot",menu_category: menu_category16 , min_selectable_item: 1, max_selectable_item:1, account: beverage }) - menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Half Potion",item_instance_code:"II1261", menu_item: menu_category1_menu_item119, price:1500.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"",item_instance_code:"II1261", menu_item: menu_category1_menu_item119, price:1500.00, is_on_promotion:false}]) # Chinese Tea menu_category1_menu_item120 = SimpleMenuItem.create({item_code:"01121", name: "Chinese Tea", alt_name: "Twin Pot",menu_category: menu_category16 , min_selectable_item: 1, max_selectable_item:1, account: beverage }) - menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Half Potion",item_instance_code:"II1271", menu_item: menu_category1_menu_item120, price:1500.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"",item_instance_code:"II1271", menu_item: menu_category1_menu_item120, price:1500.00, is_on_promotion:false}]) # Juice menu_category17 = MenuCategory.create({menu: menu, code:"C0016", name: "Juice", alt_name: "Beef_and_mutton", order_by: 16,created_by: "SYSTEM DEFAULT"}) # Orange Juice menu_category1_menu_item121 = SimpleMenuItem.create({item_code:"01122", name: "Orange Juice", alt_name: "Twin Pot",menu_category: menu_category17 , min_selectable_item: 1, max_selectable_item:1, account: beverage }) - menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Half Potion",item_instance_code:"II1281", menu_item: menu_category1_menu_item121, price:2000.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"",item_instance_code:"II1281", menu_item: menu_category1_menu_item121, price:2000.00, is_on_promotion:false}]) # Watermelon Juice menu_category1_menu_item122 = SimpleMenuItem.create({item_code:"01123", name: "Watermelon Juice ", alt_name: "Twin Pot",menu_category: menu_category17 , min_selectable_item: 1, max_selectable_item:1, account: beverage }) - menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Half Potion",item_instance_code:"II1291", menu_item: menu_category1_menu_item122, price:2000.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"",item_instance_code:"II1291", menu_item: menu_category1_menu_item122, price:2000.00, is_on_promotion:false}]) # Lime Juice menu_category1_menu_item123 = SimpleMenuItem.create({item_code:"01124", name: "Lime Juice", alt_name: "Twin Pot",menu_category: menu_category17 , min_selectable_item: 1, max_selectable_item:1, account: beverage }) - menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Half Potion",item_instance_code:"II1301", menu_item: menu_category1_menu_item123, price:2000.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"",item_instance_code:"II1301", menu_item: menu_category1_menu_item123, price:2000.00, is_on_promotion:false}]) # Sour Plum Juice - menu_category1_menu_item124 = SimpleMenuItem.create({item_code:"01125", name: "Sour Plum Juice ", alt_name: "Twin Pot",menu_category: menu_category17 , min_selectable_item: 1, max_selectable_item:1, account: beverage }) - menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Half Potion",item_instance_code:"II1311", menu_item: menu_category1_menu_item124, price:2000.00, is_on_promotion:false}]) + menu_category1_menu_item124 = SimpleMenuItem.create({item_code:"01125", name: "Sour Plum Juice ", alt_name: "Twin Pot",menu_category: menu_category17 , min_selectable_item: 1, max_selectable_item:1, account: beverage }) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"",item_instance_code:"II1311", menu_item: menu_category1_menu_item124, price:2000.00, is_on_promotion:false}]) # Canned Drinks menu_category18 = MenuCategory.create({menu: menu, code:"C0017", name: "Canned Drinks", alt_name: "Pork", order_by: 17,created_by: "SYSTEM DEFAULT"}) # Coke menu_category1_menu_item125 = SimpleMenuItem.create({item_code:"01126", name: "Coke ", alt_name: "Twin Pot",menu_category: menu_category18 , min_selectable_item: 1, max_selectable_item:1, account: beverage }) - menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Half Potion",item_instance_code:"II1321", menu_item: menu_category1_menu_item125, price:1000.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"",item_instance_code:"II1321", menu_item: menu_category1_menu_item125, price:1000.00, is_on_promotion:false}]) # Coke Light menu_category1_menu_item126 = SimpleMenuItem.create({item_code:"01127", name: "Coke Light ", alt_name: "Twin Pot",menu_category: menu_category18 , min_selectable_item: 1, max_selectable_item:1, account: beverage }) - menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Half Potion",item_instance_code:"II1331", menu_item: menu_category1_menu_item126, price:1000.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"",item_instance_code:"II1331", menu_item: menu_category1_menu_item126, price:1000.00, is_on_promotion:false}]) # Sprite menu_category1_menu_item127 = SimpleMenuItem.create({item_code:"01128", name: "Sprite ", alt_name: "Twin Pot",menu_category: menu_category18 , min_selectable_item: 1, max_selectable_item:1, account: beverage }) - menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Half Potion",item_instance_code:"II1341", menu_item: menu_category1_menu_item127, price:1000.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"",item_instance_code:"II1341", menu_item: menu_category1_menu_item127, price:1000.00, is_on_promotion:false}]) # Red Bull menu_category1_menu_item128 = SimpleMenuItem.create({item_code:"01129", name: "Red Bull ", alt_name: "Twin Pot",menu_category: menu_category18 , min_selectable_item: 1, max_selectable_item:1, account: beverage }) - menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Half Potion",item_instance_code:"II1351", menu_item: menu_category1_menu_item128, price:1000.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"",item_instance_code:"II1351", menu_item: menu_category1_menu_item128, price:1000.00, is_on_promotion:false}]) # 100 Plus menu_category1_menu_item129 = SimpleMenuItem.create({item_code:"01130", name: "100 Plus ", alt_name: "Twin Pot",menu_category: menu_category18 , min_selectable_item: 1, max_selectable_item:1, account: beverage }) - menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Half Potion",item_instance_code:"II1361", menu_item: menu_category1_menu_item129, price:1000.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"",item_instance_code:"II1361", menu_item: menu_category1_menu_item129, price:1000.00, is_on_promotion:false}]) # POP Soda menu_category1_menu_item130 = SimpleMenuItem.create({item_code:"01131", name: "POP Soda ", alt_name: "Twin Pot",menu_category: menu_category18 , min_selectable_item: 1, max_selectable_item:1, account: beverage }) - menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Half Potion",item_instance_code:"II1371", menu_item: menu_category1_menu_item130, price:1000.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"",item_instance_code:"II1371", menu_item: menu_category1_menu_item130, price:1000.00, is_on_promotion:false}]) # Mineral Water menu_category1_menu_item131 = SimpleMenuItem.create({item_code:"01132", name: "Mineral Water ", alt_name: "Twin Pot",menu_category: menu_category18 , min_selectable_item: 1, max_selectable_item:1, account: beverage }) - menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Half Potion",item_instance_code:"II1381", menu_item: menu_category1_menu_item131, price:500.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"",item_instance_code:"II1381", menu_item: menu_category1_menu_item131, price:500.00, is_on_promotion:false}]) # Beer menu_category19 = MenuCategory.create({menu: menu, code:"C0018", name: "Beer", alt_name: "Chicken", order_by: 18, created_by: "SYSTEM DEFAULT"}) # Myanmar Beer menu_category1_menu_item132 = SimpleMenuItem.create({item_code:"01133", name: "Myanmar Beer", alt_name: "Twin Pot",menu_category: menu_category19 , min_selectable_item: 1, max_selectable_item:1, account: beverage }) menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Can",item_instance_code:"II1392", menu_item: menu_category1_menu_item132, price:1500.00, is_on_promotion:false}]) menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Bottle",item_instance_code:"II1391", menu_item: menu_category1_menu_item132, price:3000.00, is_on_promotion:false}]) -# Tiger Beer - menu_category1_menu_item133 = SimpleMenuItem.create({item_code:"01134", name: "Tiger Beer ", alt_name: "Twin Pot",menu_category: menu_category19 , min_selectable_item: 1, max_selectable_item:1, account: beverage }) - menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Can",item_instance_code:"II1402", menu_item: menu_category1_menu_item133, price:1500.00, is_on_promotion:false}]) - menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Bottle",item_instance_code:"II1401", menu_item: menu_category1_menu_item133, price:3000.00, is_on_promotion:false}]) +# # Tiger Beer +# menu_category1_menu_item133 = SimpleMenuItem.create({item_code:"01134", name: "Tiger Beer ", alt_name: "Twin Pot",menu_category: menu_category19 , min_selectable_item: 1, max_selectable_item:1, account: beverage }) +# menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Can",item_instance_code:"II1402", menu_item: menu_category1_menu_item133, price:1500.00, is_on_promotion:false}]) +# menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Bottle",item_instance_code:"II1401", menu_item: menu_category1_menu_item133, price:3000.00, is_on_promotion:false}]) # Heineken Beer menu_category1_menu_item134 = SimpleMenuItem.create({item_code:"01135", name: "Heineken Beer", alt_name: "Twin Pot",menu_category: menu_category19 , min_selectable_item: 1, max_selectable_item:1, account: beverage }) - menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Can",item_instance_code:"II1412", menu_item: menu_category1_menu_item134, price:1800.00, is_on_promotion:false}]) - menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Bottle",item_instance_code:"II1411", menu_item: menu_category1_menu_item134, price:3600.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Can",item_instance_code:"II1402", menu_item: menu_category1_menu_item134, price:1800.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Bottle",item_instance_code:"II1401", menu_item: menu_category1_menu_item134, price:3600.00, is_on_promotion:false}]) # Tsing Tao Beer menu_category1_menu_item135 = SimpleMenuItem.create({item_code:"01136", name: "Tsing Tao Beer", alt_name: "Twin Pot",menu_category: menu_category19 , min_selectable_item: 1, max_selectable_item:1, account: beverage }) - menu_item0_instance = MenuItemInstance.create([{item_instance_name:"",item_instance_code:"II1421", menu_item: menu_category1_menu_item135, price:2800.00, is_on_promotion:false}]) + menu_item0_instance = MenuItemInstance.create([{item_instance_name:"",item_instance_code:"II141", menu_item: menu_category1_menu_item135, price:2800.00, is_on_promotion:false}]) # ABC Stout menu_category1_menu_item136 = SimpleMenuItem.create({item_code:"01137", name: "ABC Stout ", alt_name: "Twin Pot",menu_category: menu_category19 , min_selectable_item: 1, max_selectable_item:1, account: beverage }) menu_item0_instance = MenuItemInstance.create([{item_instance_name:"Can",item_instance_code:"II1432", menu_item: menu_category1_menu_item136, price:2000.00, is_on_promotion:false}]) diff --git a/spec/controllers/cash_mgmt_controller_spec.rb b/spec/controllers/cash_mgmt_controller_spec.rb new file mode 100644 index 00000000..0772e07e --- /dev/null +++ b/spec/controllers/cash_mgmt_controller_spec.rb @@ -0,0 +1,26 @@ +require 'rails_helper' + +RSpec.describe CashMgmtController, type: :controller do + + describe "GET #index" do + it "returns http success" do + get :index + expect(response).to have_http_status(:success) + end + end + + describe "GET #new" do + it "returns http success" do + get :new + expect(response).to have_http_status(:success) + end + end + + describe "GET #create" do + it "returns http success" do + get :create + expect(response).to have_http_status(:success) + end + end + +end diff --git a/spec/controllers/origami/shifts_controller_spec.rb b/spec/controllers/origami/shifts_controller_spec.rb new file mode 100644 index 00000000..6bc402b9 --- /dev/null +++ b/spec/controllers/origami/shifts_controller_spec.rb @@ -0,0 +1,33 @@ +require 'rails_helper' + +RSpec.describe Origami::ShiftsController, type: :controller do + + describe "GET #index" do + it "returns http success" do + get :index + expect(response).to have_http_status(:success) + end + end + + describe "GET #show" do + it "returns http success" do + get :show + expect(response).to have_http_status(:success) + end + end + + describe "GET #new" do + it "returns http success" do + get :new + expect(response).to have_http_status(:success) + end + end + + describe "GET #edit" do + it "returns http success" do + get :edit + expect(response).to have_http_status(:success) + end + end + +end diff --git a/spec/controllers/reports/daily_sales_controller_spec.rb b/spec/controllers/reports/daily_sales_controller_spec.rb new file mode 100644 index 00000000..6cc8e9fd --- /dev/null +++ b/spec/controllers/reports/daily_sales_controller_spec.rb @@ -0,0 +1,5 @@ +require 'rails_helper' + +RSpec.describe Reports::DailySalesController, type: :controller do + +end diff --git a/spec/controllers/reports/dailysales_controller_spec.rb b/spec/controllers/reports/dailysales_controller_spec.rb new file mode 100644 index 00000000..83fcb321 --- /dev/null +++ b/spec/controllers/reports/dailysales_controller_spec.rb @@ -0,0 +1,5 @@ +require 'rails_helper' + +RSpec.describe Reports::DailysalesController, type: :controller do + +end diff --git a/spec/controllers/reports/sale_items_controller_spec.rb b/spec/controllers/reports/sale_items_controller_spec.rb new file mode 100644 index 00000000..546fc874 --- /dev/null +++ b/spec/controllers/reports/sale_items_controller_spec.rb @@ -0,0 +1,5 @@ +require 'rails_helper' + +RSpec.describe Reports::SaleItemsController, type: :controller do + +end diff --git a/spec/helpers/cash_mgmt_helper_spec.rb b/spec/helpers/cash_mgmt_helper_spec.rb new file mode 100644 index 00000000..c1b99e8f --- /dev/null +++ b/spec/helpers/cash_mgmt_helper_spec.rb @@ -0,0 +1,15 @@ +require 'rails_helper' + +# Specs in this file have access to a helper object that includes +# the CashMgmtHelper. For example: +# +# describe CashMgmtHelper do +# describe "string concat" do +# it "concats two strings with spaces" do +# expect(helper.concat_strings("this","that")).to eq("this that") +# end +# end +# end +RSpec.describe CashMgmtHelper, type: :helper do + pending "add some examples to (or delete) #{__FILE__}" +end diff --git a/spec/helpers/origami/shifts_helper_spec.rb b/spec/helpers/origami/shifts_helper_spec.rb new file mode 100644 index 00000000..52cd53cc --- /dev/null +++ b/spec/helpers/origami/shifts_helper_spec.rb @@ -0,0 +1,15 @@ +require 'rails_helper' + +# Specs in this file have access to a helper object that includes +# the Origami::ShiftsHelper. For example: +# +# describe Origami::ShiftsHelper do +# describe "string concat" do +# it "concats two strings with spaces" do +# expect(helper.concat_strings("this","that")).to eq("this that") +# end +# end +# end +RSpec.describe Origami::ShiftsHelper, type: :helper do + pending "add some examples to (or delete) #{__FILE__}" +end diff --git a/spec/helpers/reports/daily_sales_helper_spec.rb b/spec/helpers/reports/daily_sales_helper_spec.rb new file mode 100644 index 00000000..17d70035 --- /dev/null +++ b/spec/helpers/reports/daily_sales_helper_spec.rb @@ -0,0 +1,15 @@ +require 'rails_helper' + +# Specs in this file have access to a helper object that includes +# the Reports::DailySalesHelper. For example: +# +# describe Reports::DailySalesHelper do +# describe "string concat" do +# it "concats two strings with spaces" do +# expect(helper.concat_strings("this","that")).to eq("this that") +# end +# end +# end +RSpec.describe Reports::DailySalesHelper, type: :helper do + pending "add some examples to (or delete) #{__FILE__}" +end diff --git a/spec/helpers/reports/dailysales_helper_spec.rb b/spec/helpers/reports/dailysales_helper_spec.rb new file mode 100644 index 00000000..96853812 --- /dev/null +++ b/spec/helpers/reports/dailysales_helper_spec.rb @@ -0,0 +1,15 @@ +require 'rails_helper' + +# Specs in this file have access to a helper object that includes +# the Reports::DailysalesHelper. For example: +# +# describe Reports::DailysalesHelper do +# describe "string concat" do +# it "concats two strings with spaces" do +# expect(helper.concat_strings("this","that")).to eq("this that") +# end +# end +# end +RSpec.describe Reports::DailysalesHelper, type: :helper do + pending "add some examples to (or delete) #{__FILE__}" +end diff --git a/spec/helpers/reports/sale_items_helper_spec.rb b/spec/helpers/reports/sale_items_helper_spec.rb new file mode 100644 index 00000000..ea2807c4 --- /dev/null +++ b/spec/helpers/reports/sale_items_helper_spec.rb @@ -0,0 +1,15 @@ +require 'rails_helper' + +# Specs in this file have access to a helper object that includes +# the Reports::SaleItemsHelper. For example: +# +# describe Reports::SaleItemsHelper do +# describe "string concat" do +# it "concats two strings with spaces" do +# expect(helper.concat_strings("this","that")).to eq("this that") +# end +# end +# end +RSpec.describe Reports::SaleItemsHelper, type: :helper do + pending "add some examples to (or delete) #{__FILE__}" +end diff --git a/spec/models/payment_journal_spec.rb b/spec/models/payment_journal_spec.rb new file mode 100644 index 00000000..1d69ec1b --- /dev/null +++ b/spec/models/payment_journal_spec.rb @@ -0,0 +1,5 @@ +require 'rails_helper' + +RSpec.describe PaymentJournal, type: :model do + pending "add some examples to (or delete) #{__FILE__}" +end diff --git a/spec/models/shift_sale_spec.rb b/spec/models/shift_sale_spec.rb new file mode 100644 index 00000000..18b726dc --- /dev/null +++ b/spec/models/shift_sale_spec.rb @@ -0,0 +1,5 @@ +require 'rails_helper' + +RSpec.describe ShiftSale, type: :model do + pending "add some examples to (or delete) #{__FILE__}" +end diff --git a/spec/views/cash_mgmt/create.html.erb_spec.rb b/spec/views/cash_mgmt/create.html.erb_spec.rb new file mode 100644 index 00000000..99f19970 --- /dev/null +++ b/spec/views/cash_mgmt/create.html.erb_spec.rb @@ -0,0 +1,5 @@ +require 'rails_helper' + +RSpec.describe "cash_mgmt/create.html.erb", type: :view do + pending "add some examples to (or delete) #{__FILE__}" +end diff --git a/spec/views/cash_mgmt/index.html.erb_spec.rb b/spec/views/cash_mgmt/index.html.erb_spec.rb new file mode 100644 index 00000000..47aac0d1 --- /dev/null +++ b/spec/views/cash_mgmt/index.html.erb_spec.rb @@ -0,0 +1,5 @@ +require 'rails_helper' + +RSpec.describe "cash_mgmt/index.html.erb", type: :view do + pending "add some examples to (or delete) #{__FILE__}" +end diff --git a/spec/views/cash_mgmt/new.html.erb_spec.rb b/spec/views/cash_mgmt/new.html.erb_spec.rb new file mode 100644 index 00000000..75ceeb52 --- /dev/null +++ b/spec/views/cash_mgmt/new.html.erb_spec.rb @@ -0,0 +1,5 @@ +require 'rails_helper' + +RSpec.describe "cash_mgmt/new.html.erb", type: :view do + pending "add some examples to (or delete) #{__FILE__}" +end diff --git a/spec/views/origami/shifts/edit.html.erb_spec.rb b/spec/views/origami/shifts/edit.html.erb_spec.rb new file mode 100644 index 00000000..3e38121f --- /dev/null +++ b/spec/views/origami/shifts/edit.html.erb_spec.rb @@ -0,0 +1,5 @@ +require 'rails_helper' + +RSpec.describe "shifts/edit.html.erb", type: :view do + pending "add some examples to (or delete) #{__FILE__}" +end diff --git a/spec/views/origami/shifts/index.html.erb_spec.rb b/spec/views/origami/shifts/index.html.erb_spec.rb new file mode 100644 index 00000000..6a148d25 --- /dev/null +++ b/spec/views/origami/shifts/index.html.erb_spec.rb @@ -0,0 +1,5 @@ +require 'rails_helper' + +RSpec.describe "shifts/index.html.erb", type: :view do + pending "add some examples to (or delete) #{__FILE__}" +end diff --git a/spec/views/origami/shifts/new.html.erb_spec.rb b/spec/views/origami/shifts/new.html.erb_spec.rb new file mode 100644 index 00000000..60e9a23c --- /dev/null +++ b/spec/views/origami/shifts/new.html.erb_spec.rb @@ -0,0 +1,5 @@ +require 'rails_helper' + +RSpec.describe "shifts/new.html.erb", type: :view do + pending "add some examples to (or delete) #{__FILE__}" +end diff --git a/spec/views/origami/shifts/show.html.erb_spec.rb b/spec/views/origami/shifts/show.html.erb_spec.rb new file mode 100644 index 00000000..372203e3 --- /dev/null +++ b/spec/views/origami/shifts/show.html.erb_spec.rb @@ -0,0 +1,5 @@ +require 'rails_helper' + +RSpec.describe "shifts/show.html.erb", type: :view do + pending "add some examples to (or delete) #{__FILE__}" +end