add csrf , product and account_state changes
csrf - previous settings were not working on dev1 product - allow sale , if count > stock prodcut - admin - allow search by name account_state - auto sum up money from notes add csrf , product and account_state changes csrf - previous settings were not working on dev1 product - allow sale , if count > stock prodcut - admin - allow search by name account_state - auto sum up money from notes
This commit is contained in:
@@ -87,7 +87,7 @@ class ProductSaleForm extends Model
|
||||
[['comment'], 'string' ,'max' => 255],
|
||||
[['cart'], 'string' ,'max' => 20],
|
||||
[['id_product' ], 'validateProduct'],
|
||||
[['count' ], 'validateCount'],
|
||||
// [['count' ], 'validateCount'],
|
||||
[['id_currency' ], 'validateCurrency'],
|
||||
[['id_account' ], 'validateAccount'],
|
||||
[['id_discount' ], 'validateDiscount'],
|
||||
|
||||
@@ -28,7 +28,7 @@ function AccountState(o){
|
||||
$.extend(app.defaults, o );
|
||||
notes = $(app.defaults.notes);
|
||||
moneyInput = $(app.defaults.selector_money);
|
||||
notes.change(run);
|
||||
notes.change(runNote);
|
||||
moneyInput.change(run);
|
||||
if ( app.defaults.open ){
|
||||
ddAccount = $(app.defaults.selector_dd_account);
|
||||
@@ -40,8 +40,17 @@ function AccountState(o){
|
||||
|
||||
|
||||
|
||||
function run(){
|
||||
function runNote(){
|
||||
run("note");
|
||||
}
|
||||
|
||||
function run(what ){
|
||||
calcTotal();
|
||||
if ( what == 'note' ){
|
||||
setMoneyAsTotal();
|
||||
}else{
|
||||
readMoney();
|
||||
}
|
||||
calcDiff();
|
||||
calcAccount();
|
||||
calcLastDiff();
|
||||
@@ -51,6 +60,7 @@ function AccountState(o){
|
||||
updateLastMoney();
|
||||
updateLastDiff();
|
||||
updatePrevState();
|
||||
|
||||
}
|
||||
|
||||
function calcAccount(){
|
||||
@@ -68,12 +78,21 @@ function AccountState(o){
|
||||
app.diff = Math.abs(app.last_money - app.money );
|
||||
|
||||
}
|
||||
function calcDiff(){
|
||||
|
||||
function setMoneyAsTotal(){
|
||||
app.money = app.total;
|
||||
}
|
||||
|
||||
function readMoney(){
|
||||
app.money = 0;
|
||||
app.money = +moneyInput.val();
|
||||
if ( isNaN(money)){
|
||||
app.money = 0;
|
||||
}
|
||||
}
|
||||
|
||||
function calcDiff(){
|
||||
|
||||
app.diff = Math.abs(app.total - app.money );
|
||||
|
||||
}
|
||||
@@ -103,6 +122,7 @@ function AccountState(o){
|
||||
var money;
|
||||
money = accounting.formatNumber(app.money, 0, " "); // 9 876 543.210
|
||||
$('.money').html(money);
|
||||
$('#accountstate-money').val(money);
|
||||
}
|
||||
|
||||
function updateLastMoney(){
|
||||
|
||||
Reference in New Issue
Block a user