Merge pull request #257 from goutham-M/mifosx-accounting-validation

validation is added to accounting
This commit is contained in:
Nayan Ambali 2013-11-08 21:43:16 -08:00
commit bac4e01420
9 changed files with 84 additions and 51 deletions

View File

@ -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":"...................",

View File

@ -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;
}
}

View File

@ -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';
}
}

View File

@ -10,18 +10,14 @@
<label ng-show="errorStatus">{{errorStatus}}</label>
<label ng-hide="errorStatus" ng-repeat="error in errorDetails">{{error.code | translate}}</label>
</div>
<form name="addaccountruleform" novalidate="" class="form-horizontal" ng-controller="AccCreateRuleController" ng-submit="submit()">
<form name="addaccountruleform" novalidate="" class="form-horizontal" ng-controller="AccCreateRuleController" rc-submit="submit()">
<fieldset>
<legend>{{ 'label.accounting.rule.title' | translate }}</legend>
<div class="control-group">
<label class="control-label" for="name">{{ 'label.accounting.rule.name' | translate }}<span class="required">*</span></label>
<div class="controls">
<input type="text" id="name" name="name" ng-model="formData.name" required ng-minlength=3 late-Validate/>
<span ng-show="addaccountruleform.name.$invalid">
<small class="error" ng-show="addaccountruleform.name.$error.req">
{{ 'label.requiredfield' | translate }}
</small>
</span>
<input type="text" id="name" name="name" ng-model="formData.name" required late-Validate/>
<form-validate valattributeform="addaccountruleform" valattribute="name"/>
</div>
</div>
<div class="control-group">

View File

@ -6,7 +6,7 @@
</ul>
</div>
<form name="createglaccountingform" novalidate="" class="form-horizontal well"
ng-controller="AccCreateGLAccountController" ng-submit="submit()">
ng-controller="AccCreateGLAccountController" rc-submit="submit()">
<div class="error" ng-show="errorStatus || errorDetails">
<label>{{'label.error' | translate}}</label>
<label ng-show="errorStatus">{{errorStatus}}</label>
@ -25,11 +25,7 @@
<div class="controls">
<input id="name" type="text" ng-autofocus="true" name="name" id="name"
ng-model="formData.name" required late-Validate/>
<span ng-show="createglaccountingform.name.$invalid">
<small class="error" ng-show="createglaccountingform.name.$error.req">
{{'label.requiredfield' | translate}}
</small>
</span>
<form-validate valattributeform="createglaccountingform" valattribute="name"/>
</div>
</div>
</td>
@ -43,11 +39,7 @@
<div class="controls">
<input type="text" id="glCode" name="glCode" ng-model="formData.glCode" required
late-Validate/>
<span ng-show="createglaccountingform.glCode.$invalid">
<small class="error" ng-show="createglaccountingform.glCode.$error.req">
{{'label.requiredfield' | translate}}
</small>
</span>
<form-validate valattributeform="createglaccountingform" valattribute="glCode"/>
</div>
</div>
</td>

View File

@ -12,18 +12,14 @@
<label ng-show="errorStatus">{{errorStatus}}</label>
<label ng-hide="errorStatus" ng-repeat="error in errorDetails">{{error.code | translate}}</label>
</div>
<form name="editaccountruleform" novalidate="" class="form-horizontal" ng-submit="submit()">
<form name="editaccountruleform" novalidate="" class="form-horizontal" rc-submit="submit()">
<fieldset>
<legend>{{ 'label.accounting.rule.edit.title' | translate }}</legend>
<div class="control-group">
<label class="control-label" for="name">{{ 'label.accounting.rule.name' | translate }}<span class="required">*</span></label>
<div class="controls">
<input type="text" ng-autofocus="true" id="name" name="name" ng-model="formData.name" required late-Validate/>
<span ng-show="editaccountruleform.name.$invalid">
<small class="error">
Required Field
</small>
</span>
<form-validate valattributeform="editaccountruleform" valattribute="name"/>
</div>
</div>
<div class="control-group">

View File

@ -12,7 +12,7 @@
<label ng-show="errorStatus">{{errorStatus}}</label>
<label ng-hide="errorStatus" ng-repeat="error in errorDetails">{{error.code | translate}}</label>
</div>
<form name="editglaccountingform" novalidate="" class="form-horizontal well" ng-submit="submit()">
<form name="editglaccountingform" novalidate="" class="form-horizontal well" rc-submit="submit()">
<fieldset>
<legend>{{'label.editglaccount' | translate}}</legend>
@ -23,11 +23,7 @@
<label class="control-label" for="name">{{'label.accountname' | translate}}<span class="required">*</span></label>
<div class="controls">
<input ng-autofocus="true" type="text" id="name" name="name" ng-model="formData.name" required late-Validate/>
<span ng-show="editglaccountingform.name.$invalid">
<small class="error">
Required Field
</small>
</span>
<form-validate valattributeform="editglaccountingform" valattribute="name"/>
</div>
</div>
</td>
@ -38,11 +34,7 @@
<label class="control-label" for="glCode">{{'label.glcode' | translate}}<span class="required">*</span></label>
<div class="controls">
<input type="text" id="glCode" name="glCode" ng-model="formData.glCode" required late-Validate/>
<span ng-show="editglaccountingform.glCode.$invalid">
<small class="error">
Required Field
</small>
</span>
<form-validate valattributeform="editglaccountingform" valattribute="glCode"/>
</div>
</div>
</td>

View File

@ -5,7 +5,7 @@
</ul>
</div>
<form name="freqpostingform" novalidate="" class="form-horizontal well" ng-controller="AccFreqPostingController" ng-submit="submit()">
<form name="freqpostingform" novalidate="" class="form-horizontal well" ng-controller="AccFreqPostingController" rc-submit="submit()">
<div class="error" ng-show="errorStatus || errorDetails">
<label>{{'label.error' | translate}}</label>
<label ng-show="errorStatus">{{errorStatus}}</label>
@ -23,17 +23,19 @@
<div class="control-group">
<label class="control-label">{{ 'label.journalentry.accounting.rules' | translate }}<span class="required">*</span></label>
<div class="controls">
<select id="rule" name="rule" ng-model="formData.rule" ng-options="rule.name for rule in rules" ng-change="resetCrAndDb(formData.rule)" required late-Validate>
<select id="rule" name="rule" ng-model="formData.rule" ng-options="rule.name for rule in rules" ng-change="resetCrAndDb(formData.rule)" required>
<option style="display:none" value="">{{'label.select.accountingrule' | translate}}</option>
</select>
<form-validate valattributeform="freqpostingform" valattribute="rule"/>
</div>
</div>
<div class="control-group">
<label class="control-label">{{ 'label.currency' | translate }}&nbsp;<span class="required">*</span></label>
<div class="controls">
<select id="currencyCode" ng-model="formData.currencyCode" ng-options="currency.code as (currency.name+' ('+ currency.displaySymbol +')') for currency in currencyOptions" value="{{currency.code}}" required="required">
<select id="currencyCode" name="currency" ng-model="formData.currencyCode" ng-options="currency.code as (currency.name+' ('+ currency.displaySymbol +')') for currency in currencyOptions" value="{{currency.code}}" required>
<option style="display:none" value="">{{'label.select.currency' | translate}}</option>
</select>
<form-validate valattributeform="freqpostingform" valattribute="currency"/>
</div>
</div>
<div class="control-group">
@ -52,21 +54,31 @@
<td>
<div ng-show="formData.rule.creditAccounts.length > 0" >
<select class="input-small" ng-model="formData.creditAccountTemplate" ng-options="creditAccount.name for creditAccount in formData.rule.creditAccounts" ></select>
&nbsp; <input type="text" class="input-small" ng-model="formData.crAmountTemplate">
&nbsp; <input type="text" class="input-small" name="creditamount" ng-model="formData.crAmountTemplate">
&nbsp; <a ng-click="addCrAccount()" ng-show="allowCreditEntries">&nbsp;<i class="icon-plus icon-white"></i></a>
<span ng-show="freqpostingform.creditamount.$invalid || errorcreditevent">
<small class="error" ng-show="freqpostingform.creditamount.$error.req || errorcreditevent">
{{'label.requiredfield' | translate}}
</small>
</span>
</div>
<br>
<div ng-repeat="crAccount in formData.crAccounts">
<input type="text" class="input-small" ng-model="crAccount.crGlName" readonly>
<input type="text" class="input-small" ng-model="crAccount.crAmount">
<input type="text" class="input-small" ng-model="crAccount.crAmount">{{allowDebitEntries}}
<a ng-click="removeCrAccount($index)">&nbsp;<i class="icon-remove icon-white"></i></a>
</div>
</td>
<td>
<div ng-show="formData.rule.debitAccounts.length > 0" >
<select class="input-small" ng-model="formData.debitAccountTemplate" ng-options="debitAccount.name for debitAccount in formData.rule.debitAccounts" ></select>
&nbsp; <input type="text" class="input-small" ng-model="formData.debitAmountTemplate">
&nbsp; <input type="text" class="input-small" name="debitamount" ng-model="formData.debitAmountTemplate">
&nbsp; <a ng-click="addDebitAccount()" ng-show="allowDebitEntries">&nbsp;<i class="icon-plus icon-white"></i></a>
<span ng-show="freqpostingform.debitamount.$invalid || errordebitevent">
<small class="error" ng-show="freqpostingform.debitamount.$error.req || errordebitevent">
{{'label.requiredfield' | translate}}
</small>
</span>
</div>
<br>
<div ng-repeat="dbAccount in formData.dbAccounts">
@ -88,7 +100,7 @@
<div class="control-group">
<label class="control-label" >{{ 'label.journalentry.transaction.date' | translate }}<span class="required">*</span></label>
<div class="controls">
<input id="transactionDate" type="text" datepicker-pop="dd MMMM yyyy" ng-model="first.date" is-open="opened" min="minDate" max="'2020-06-22'" date-disabled="disabled(date, mode)" required late-Validate />
<input id="transactionDate" type="text" datepicker-pop="dd MMMM yyyy" ng-model="first.date" is-open="opened" min="minDate" max="'2020-06-22'" date-disabled="disabled(date, mode)"/>
</div>
</div>
<div class="control-group">

View File

@ -4,7 +4,7 @@
<li class="active">{{'label.journalentry.posting.title' | translate}}</li>
</ul>
</div>
<form name="journalpostingform" novalidate="" class="form-horizontal well" ng-controller="JournalEntryController" ng-submit="submit()">
<form name="journalpostingform" novalidate="" class="form-horizontal well" ng-controller="JournalEntryController" rc-submit="submit()">
<div class="error" ng-show="errorStatus || errorDetails">
<label>{{'label.error' | translate}}</label>
<label ng-show="errorStatus">{{errorStatus}}</label>
@ -22,9 +22,10 @@
<div class="control-group">
<label class="control-label">{{ 'label.currency' | translate }}&nbsp;<span class="required">*</span></label>
<div class="controls">
<select id="currencyCode" ng-model="formData.currencyCode" ng-options="currency.code as (currency.name+' ('+ currency.displaySymbol +')') for currency in currencyOptions" value="{{currency.code}}" required="required">
<select id="currencyCode" name="currency" ng-model="formData.currencyCode" ng-options="currency.code as (currency.name+' ('+ currency.displaySymbol +')') for currency in currencyOptions" value="{{currency.code}}" required>
<option style="display:none" value="">{{'label.select.currency' | translate}}</option>
</select>
<form-validate valattributeform="journalpostingform" valattribute="currency"/>
</div>
</div>
<div class="control-group">
@ -45,8 +46,13 @@
<select class="input-small" ng-model="formData.creditAccountTemplate" ng-options="creditAccount.name for creditAccount in glAccounts" >
<option style="display:none" value="">{{'label.select.credit' | translate}}</option>
</select>
&nbsp; <input type="text" class="input-small" ng-model="formData.crAmountTemplate">
&nbsp; <input type="text" class="input-small" name="creditamount" ng-model="formData.crAmountTemplate">
&nbsp; <a ng-click="addCrAccount()">&nbsp;<i class="icon-plus icon-white"></i></a>
<span ng-show="journalpostingform.creditamount.$invalid || errorcreditevent || creditaccounttemplate">
<small class="error" ng-show="freqpostingform.creditamount.$error.req || errorcreditevent || creditaccounttemplate">
{{'label.'+labelcrediterror | translate}}
</small>
</span>
</div>
<br>
<div ng-repeat="crAccount in formData.crAccounts">
@ -60,8 +66,13 @@
<select class="input-small" ng-model="formData.debitAccountTemplate" ng-options="debitAccount.name for debitAccount in glAccounts" >
<option style="display:none" value="">{{'label.select.debit' | translate}}</option>
</select>
&nbsp; <input type="text" class="input-small" ng-model="formData.debitAmountTemplate">
&nbsp; <input type="text" class="input-small" name="debitamount" ng-model="formData.debitAmountTemplate">
&nbsp; <a ng-click="addDebitAccount()">&nbsp;<i class="icon-plus icon-white"></i></a>
<span ng-show="freqpostingform.debitamount.$invalid || errordebitevent || debitaccounttemplate">
<small class="error" ng-show="freqpostingform.debitamount.$error.req || errordebitevent || debitaccounttemplate">
{{'label.'+labeldebiterror | translate}}
</small>
</span>
</div>
<br>
<div ng-repeat="dbAccount in formData.dbAccounts">
@ -83,7 +94,7 @@
<div class="control-group">
<label class="control-label">{{ 'label.journalentry.transaction.date' | translate }}<span class="required">*</span></label>
<div class="controls">
<input id="transactionDate" type="text" datepicker-pop="dd MMMM yyyy" ng-model="first.date" is-open="opened" min="minDate" max="'2020-06-22'" date-disabled="disabled(date, mode)" required late-Validate />
<input id="transactionDate" type="text" datepicker-pop="dd MMMM yyyy" ng-model="first.date" is-open="opened" min="minDate" max="'2020-06-22'" date-disabled="disabled(date, mode)"/>
</div>
</div>
<div class="control-group">