diff --git a/app/global-translations/locale-en.json b/app/global-translations/locale-en.json index 19921f86..08f5bb40 100644 --- a/app/global-translations/locale-en.json +++ b/app/global-translations/locale-en.json @@ -712,6 +712,8 @@ "label.credit":"Credit", "label.searchbytransaction":"Search by Transaction", "label.editglaccount":"Edit GL Account", + "label.selectcredit":"Select credit", + "label.selectdebit":"Select debit", "#Reports Related":"...................", diff --git a/app/scripts/controllers/accounting/AccFreqPostingController.js b/app/scripts/controllers/accounting/AccFreqPostingController.js index ce7bf564..0bafcb8e 100644 --- a/app/scripts/controllers/accounting/AccFreqPostingController.js +++ b/app/scripts/controllers/accounting/AccFreqPostingController.js @@ -8,6 +8,8 @@ scope.first = {}; scope.allowCreditEntries = true; scope.allowDebitEntries = true; + scope.errorcreditevent = false; + scope.errordebitevent = false; resourceFactory.accountingRulesResource.getAllRules({associations : 'all'}, function(data){ scope.rules = data; @@ -35,6 +37,7 @@ //events for credits scope.addCrAccount = function () { if(scope.formData.crAmountTemplate != undefined){ + scope.errorcreditevent = false; scope.formData.crAccounts.push({crGlAccountId: scope.formData.creditAccountTemplate.id, crGlcode: scope.formData.creditAccountTemplate.glCode, crGlName : scope.formData.creditAccountTemplate.name , crAmount : scope.formData.crAmountTemplate}); scope.formData.crAmountTemplate = undefined; if (scope.formData.rule) { @@ -42,6 +45,8 @@ scope.allowCreditEntries = false; } } + } else { + scope.errorcreditevent = true; } } @@ -55,6 +60,7 @@ //events for debits scope.addDebitAccount = function () { if(scope.formData.debitAmountTemplate != undefined){ + scope.errordebitevent = false; scope.formData.dbAccounts.push({debitGlAccountId: scope.formData.debitAccountTemplate.id, debitGlcode: scope.formData.debitAccountTemplate.glCode, debitGlName : scope.formData.debitAccountTemplate.name , debitAmount : scope.formData.debitAmountTemplate}); scope.formData.debitAmountTemplate = undefined; if (scope.formData.rule) { @@ -62,6 +68,8 @@ scope.allowDebitEntries = false; } } + } else { + scope.errordebitevent = true; } } diff --git a/app/scripts/controllers/accounting/JournalEntryController.js b/app/scripts/controllers/accounting/JournalEntryController.js index 4f41841a..03ba268b 100644 --- a/app/scripts/controllers/accounting/JournalEntryController.js +++ b/app/scripts/controllers/accounting/JournalEntryController.js @@ -6,6 +6,10 @@ scope.formData.crAccounts = []; scope.formData.dbAccounts = []; scope.first = {}; + scope.errorcreditevent = false; + scope.errordebitevent = false; + scope.creditaccounttemplate = false; + scope.debitaccounttemplate = false; resourceFactory.accountCoaResource.getAllAccountCoas({manualEntriesAllowed:true, usage:1, disabled:false}, function(data){ scope.glAccounts = data; @@ -23,8 +27,18 @@ //events for credits scope.addCrAccount = function () { if(scope.formData.crAmountTemplate != undefined){ - scope.formData.crAccounts.push({crGlAccountId: scope.formData.creditAccountTemplate.id, crGlcode: scope.formData.creditAccountTemplate.glCode, crGlName : scope.formData.creditAccountTemplate.name , crAmount : scope.formData.crAmountTemplate}); - scope.formData.crAmountTemplate = undefined; + scope.errorcreditevent = false; + if (scope.formData.creditAccountTemplate) { + scope.creditaccounttemplate = false; + scope.formData.crAccounts.push({crGlAccountId: scope.formData.creditAccountTemplate.id, crGlcode: scope.formData.creditAccountTemplate.glCode, crGlName : scope.formData.creditAccountTemplate.name , crAmount : scope.formData.crAmountTemplate}); + scope.formData.crAmountTemplate = undefined; + } else { + scope.creditaccounttemplate = true; + scope.labelcrediterror = 'selectcredit'; + } + } else { + scope.errorcreditevent = true; + scope.labelcrediterror = 'requiredfield'; } } @@ -35,8 +49,18 @@ //events for debits scope.addDebitAccount = function () { if(scope.formData.debitAmountTemplate != undefined){ - scope.formData.dbAccounts.push({debitGlAccountId: scope.formData.debitAccountTemplate.id, debitGlcode: scope.formData.debitAccountTemplate.glCode, debitGlName : scope.formData.debitAccountTemplate.name , debitAmount : scope.formData.debitAmountTemplate}); - scope.formData.debitAmountTemplate = undefined; + scope.errordebitevent = false; + if (scope.formData.debitAccountTemplate) { + scope.debitaccounttemplate = false; + scope.formData.dbAccounts.push({debitGlAccountId: scope.formData.debitAccountTemplate.id, debitGlcode: scope.formData.debitAccountTemplate.glCode, debitGlName : scope.formData.debitAccountTemplate.name , debitAmount : scope.formData.debitAmountTemplate}); + scope.formData.debitAmountTemplate = undefined; + } else { + scope.debitaccounttemplate = true; + scope.labeldebiterror = 'selectdebit'; + } + } else { + scope.errordebitevent = true; + scope.labeldebiterror = 'requiredfield'; } } diff --git a/app/views/accounting/add_acc_rule.html b/app/views/accounting/add_acc_rule.html index 9134bbe0..412092cc 100644 --- a/app/views/accounting/add_acc_rule.html +++ b/app/views/accounting/add_acc_rule.html @@ -10,18 +10,14 @@ -