www/js/inv_miscs-min.js

Thu, 17 Oct 2019 16:00:10 +0200

author
Michiel Broek <mbroek@mbse.eu>
date
Thu, 17 Oct 2019 16:00:10 +0200
changeset 515
9d771385a8a0
parent 488
77f1617b6994
permissions
-rw-r--r--

Added dried yeast form. Pitch rate for Kveik initially set at 0.25. Dried Kveik cells set to 9000000000 cells/gram.

515
9d771385a8a0 Added dried yeast form. Pitch rate for Kveik initially set at 0.25. Dried Kveik cells set to 9000000000 cells/gram.
Michiel Broek <mbroek@mbse.eu>
parents: 488
diff changeset
1 function createDelElements(){$("#eventWindow").jqxWindow({theme:theme,position:{x:490,y:210},width:300,height:175,resizable:false,isModal:true,modalOpacity:0.4,okButton:$("#delOk"),cancelButton:$("#delCancel"),initContent:function(){$("#delOk").jqxButton({template:"danger",width:"65px",theme:theme});$("#delCancel").jqxButton({template:"success",width:"65px",theme:theme});$("#delCancel").focus()}});$("#eventWindow").jqxWindow("hide")}$(document).ready(function(){function e(i,h){$("#totval").val(i*(h/1000))}function a(h){if(h){$("#pmpt_cost").html("Prijs per kg:");$("#pmpt_inventory").html("Voorraad gram:")}else{$("#pmpt_cost").html("Prijs per liter:");$("#pmpt_inventory").html("Voorraad ml:")}}var c={},b="includes/db_inventory_miscs.php",f={datatype:"json",cache:false,datafields:[{name:"record",type:"number"},{name:"name",type:"string"},{name:"type",type:"string"},{name:"use_use",type:"string"},{name:"time",type:"int"},{name:"amount",type:"float"},{name:"amount_is_weight",type:"int"},{name:"use_for",type:"string"},{name:"notes",type:"string"},{name:"always_on_stock",type:"int"},{name:"inventory",type:"float"},{name:"cost",type:"float"},{name:"production_date",type:"string"},{name:"tht_date",type:"string"}],id:"record",url:b,deleterow:function(h,j){var i="delete=true&"+$.param({record:h});$.ajax({dataType:"json",url:b,cache:false,data:i,type:"POST",success:function(l,k,m){j(true);location.reload(true)},error:function(k,m,l){j(false)}})},addrow:function(i,l,h,k){var j="insert=true&"+$.param(l);$.ajax({dataType:"json",url:b,cache:false,data:j,type:"POST",success:function(n,m,o){k(true);location.reload(true)},error:function(m,o,n){k(false)}})},updaterow:function(h,k,j){var i="update=true&"+$.param(k);$.ajax({dataType:"json",url:b,cache:false,data:i,type:"POST",success:function(m,l,n){j(true);location.reload(true)},error:function(l,n,m){j(false)}})}},g=new $.jqx.dataAdapter(f),d=-1;$("#name").jqxInput({theme:theme,width:640,height:23});$("#notes").jqxInput({theme:theme,width:800,height:100});$("#type").jqxDropDownList({theme:theme,source:MiscTypeAdapter,valueMember:"nl",displayMember:"nl",width:180,height:23,autoDropDownHeight:true});$("#use_use").jqxDropDownList({theme:theme,source:MiscUseAdapter,valueMember:"nl",displayMember:"nl",width:180,height:23,autoDropDownHeight:true});$("#time").jqxNumberInput(PosInt);$("#amount_is_weight").jqxCheckBox({theme:theme,width:120,height:23});$("#use_for").jqxInput({theme:theme,width:640,height:48});$("#always_on_stock").jqxCheckBox({theme:theme,width:120,height:23});$("#inventory").jqxNumberInput(Spin1dec);$("#production_date").jqxDateTimeInput(Dateopts);$("#cost").jqxNumberInput(Spin2dec);$("#tht_date").jqxDateTimeInput(Dateopts);$("#totval").jqxNumberInput(Show2dec);$("#jqxgrid").jqxGrid({width:1280,height:630,source:g,theme:theme,showstatusbar:true,renderstatusbar:function(j){var h,i,k;h=$("<div style='overflow: hidden; position: relative; margin: 5px;'></div>");i=$("<div style='float: right; margin-right: 15px;'><img style='position: relative; margin-top: 2px;' src='images/add.png'/><span style='margin-left: 4px; position: relative; top: -3px;'>Nieuw</span></div>");k=$("<div style='float: right; margin-right: 50px;'><img style='position: relative; margin-top: 2px;' src='images/add.png'/><span style='margin-left: 4px; position: relative; top: -3px;'>Import</span></div>");h.append(i);h.append(k);j.append(h);i.jqxButton({theme:theme,width:90,height:20});k.jqxButton({theme:theme,width:90,height:20});i.click(function(l){d=-1;$("#popupWindow").jqxWindow({position:{x:110,y:30}});$("#name").val("");$("#type").val("Specerij");$("#use_use").val("Starter");$("#time").val(0);$("#amount_is_weight").val(1);$("#use_for").val("");$("#notes").val("");$("#always_on_stock").val(0);$("#inventory").val(0);$("#cost").val(0);$("#production_date").val("");$("#tht_date").val("");$("#popupWindow").jqxWindow("open")});k.click(function(l){window.location.href="import_ingredients.php?select=miscs"})},filterable:true,filtermode:"excel",columns:[{text:"Ingredient naam",datafield:"name",menu:false},{text:"Type",datafield:"type",align:"left",width:120},{text:"Gebruik",datafield:"use_use",align:"left",width:120},{text:"Tijd",datafield:"time",width:90,align:"left",menu:false,cellsrenderer:function(i,h,l,k,j,n){var m="";if(l>0){if(l==1){m="1 minuut"}else{if(l<60){m=g.formatNumber(l,"f0")+" minuten"}else{if(l==60){m="1 uur"}else{if(l<1440){m=g.formatNumber(l/60,"f0")+" uren"}else{if(l==1440){m="1 dag"}else{m=g.formatNumber(l/1440,"f0")+" dagen"}}}}}}return"<span style='margin: 3px; margin-top: 6px; float: left;'>"+m+"</span>"}},{text:"Voorraad",datafield:"inventory",width:110,menu:false,align:"right",cellsrenderer:function(i,h,m,l,k,n){var j="";if(m>0){if(n.amount_is_weight){j=g.formatNumber(m,"f1")+" gr"}else{j=g.formatNumber(m,"f1")+" ml"}}return"<span style='margin: 3px; margin-top: 6px; float: right;'>"+j+"</span>"}},{text:"THT datum",datafield:"tht_date",width:100,menu:false,align:"center",cellsalign:"center"},{text:"",datafield:"Edit",columntype:"button",width:100,menu:false,align:"center",cellsrenderer:function(){return"Wijzig"},buttonclick:function(h){d=h;$("#popupWindow").jqxWindow({position:{x:110,y:30}});c=$("#jqxgrid").jqxGrid("getrowdata",d);$("#name").val(c.name);$("#type").val(c.type);$("#use_use").val(c.use_use);$("#time").val(c.time);$("#amount_is_weight").val(c.amount_is_weight);$("#use_for").val(c.use_for);$("#notes").val(c.notes);$("#always_on_stock").val(c.always_on_stock);$("#inventory").val(c.inventory);$("#cost").val(c.cost);$("#production_date").val(c.production_date);$("#tht_date").val(c.tht_date);e(c.cost,c.inventory);a(c.amount_is_weight);$("#popupWindow").jqxWindow("open")}}]});$("#cost").on("change",function(h){c.cost=parseFloat(h.args.value);e(c.cost,c.inventory)});$("#inventory").on("change",function(h){c.inventory=parseFloat(h.args.value);e(c.cost,c.inventory)});$("#amount_is_weight").on("checked",function(h){c.amount_is_weight=true;a(true)});$("#amount_is_weight").on("unchecked",function(h){c.amount_is_weight=false;a(false)});$("#popupWindow").jqxWindow({width:1050,height:550,resizable:false,theme:theme,isModal:true,autoOpen:false,cancelButton:$("#Cancel"),modalOpacity:0.4});$("#popupWindow").on("open",function(){$("#name").jqxInput("selectAll")});$("#Delete").jqxButton({template:"danger",width:"90px",theme:theme});$("#Delete").click(function(){if(d>=0){$("#eventWindow").jqxWindow("open");$("#delOk").click(function(){var h=$("#jqxgrid").jqxGrid("getrowid",d);$("#jqxgrid").jqxGrid("deleterow",h)})}$("#popupWindow").jqxWindow("hide")});$("#Cancel").jqxButton({template:"primary",width:"90px",theme:theme});$("#Save").jqxButton({template:"success",width:"90px",theme:theme});$("#Save").click(function(){var i,h=-1;if(d>=0){h=$("#jqxgrid").jqxGrid("getrowid",d)}i={record:h,name:$("#name").val(),type:$("#type").val(),use_use:$("#use_use").val(),time:parseFloat($("#time").jqxNumberInput("decimal")),amount_is_weight:$("#amount_is_weight").val(),use_for:$("#use_for").val(),notes:$("#notes").val(),always_on_stock:$("#always_on_stock").val(),inventory:parseFloat($("#inventory").jqxNumberInput("decimal")),cost:parseFloat($("#cost").jqxNumberInput("decimal")),production_date:$("#production_date").val(),tht_date:$("#tht_date").val()};if(d>=0){$("#jqxgrid").jqxGrid("updaterow",h,i)}else{$("#jqxgrid").jqxGrid("addrow",null,i)}$("#popupWindow").jqxWindow("hide")});createDelElements()});

mercurial