| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157 |
- Ext.QuickTips.init();
- Ext.define('erp.controller.fa.gs.BillAP', {
- extend: 'Ext.app.Controller',
- FormUtil: Ext.create('erp.util.FormUtil'),
- BaseUtil: Ext.create('erp.util.BaseUtil'),
- views:[
- 'fa.gs.BillAP','core.form.Panel','core.form.MultiField','core.form.FileField','core.form.MultiField',
- 'core.button.Add','core.button.Submit','core.button.Audit','core.button.Save','core.button.Close',
- 'core.button.ResSubmit','core.button.Update','core.button.Delete','core.button.Nullify',
- 'core.button.ResAudit','core.button.UpdateInfo',
- 'core.trigger.TextAreaTrigger','core.trigger.DbfindTrigger','core.form.SeparNumber','core.form.YnField'
- ],
- init:function(){
- var me = this;
- this.control({
- 'field[name=bap_duedate]':{
- beforerender: function(field){
- field.readOnly=false;
- }
- },
- 'textfield[name=bap_doublebalance]':{
- beforerender: function(field){
- if(Ext.getCmp('bap_paybillcode')&&Ext.getCmp('bap_paybillcode').value!=""){
- field.readOnly=true;
- }
- }
- },
- 'erpSaveButton': {
- click: function(btn){
- var form = me.getForm(btn);
- if(Ext.getCmp(form.codeField).value == null || Ext.getCmp(form.codeField).value == ''){
- me.BaseUtil.getRandomNumber();
- }
- this.FormUtil.beforeSave(me);
- }
- },
- 'erpCloseButton': {
- click: function(btn){
- this.FormUtil.beforeClose(this);
- }
- },
- 'erpAddButton': {
- click: function(){
- me.FormUtil.onAdd('addBillAP', '新增应付票据', 'jsps/fa/gs/billAP.jsp');
- }
- },
- 'erpUpdateButton': {
- click: function(btn){
- this.FormUtil.onUpdate(this);
- }
- },
- 'erpDeleteButton': {
- click: function(btn){
- this.FormUtil.onDelete(Ext.getCmp('bap_id').value);
- }
- },
- 'erpSubmitButton': {
- afterrender: function(btn){
- var status = Ext.getCmp('bap_statuscode');
- if(status && status.value != 'ENTERING'){
- btn.hide();
- }
- },
- click: function(btn){
- me.FormUtil.onSubmit(Ext.getCmp('bap_id').value);
- }
- },
- 'erpResSubmitButton': {
- afterrender: function(btn){
- var status = Ext.getCmp('bap_statuscode');
- if(status && status.value != 'COMMITED'){
- btn.hide();
- }
- },
- click: function(btn){
- me.FormUtil.onResSubmit(Ext.getCmp('bap_id').value);
- }
- },
- 'erpAuditButton': {
- afterrender: function(btn){
- var status = Ext.getCmp('bap_statuscode');
- if(status && status.value != 'COMMITED'){
- btn.hide();
- }
- },
- click: function(btn){
- me.FormUtil.onAudit(Ext.getCmp('bap_id').value);
- }
- },
- 'erpResAuditButton': {
- afterrender: function(btn){
- var status = Ext.getCmp('bap_statuscode');
- if(status && status.value != 'AUDITED'){
- btn.hide();
- }
- },
- click: function(btn){
- me.FormUtil.onResAudit(Ext.getCmp('bap_id').value);
- }
- },
- 'erpNullifyButton': {
- afterrender: function(btn){
- var status = Ext.getCmp('bap_nowstatus');
- if(status && status.value != '已作废'){
- btn.hide();
- }
- },
- click: function(btn){
- me.FormUtil.onNullify(Ext.getCmp('bap_id').value);
- }
- },
- 'textfield[name=bap_cmrate]':{
- change: me.gettopaybalance
- },
- 'textfield[name=bap_doublebalance]':{
- change: me.gettopaybalance
- },
- 'erpUpdateInfoButton':{
- click:function(){
- var text=Ext.getCmp('bap_duedate');
- me.updateInfo(text.value,Ext.getCmp('bap_id').value);
-
- }
- },
- });
- },
- updateInfo:function(text,id){
- Ext.Ajax.request({
- url : basePath + 'fa/gs/billap/updateInfo.action',
- params: {text:text,id:id},
- method : 'post',
- async:false,
- callback : function(options,success,response){
- var res = new Ext.decode(response.responseText);
- if(res.exceptionInfo != null){
- showError(res.exceptionInfo);return;
- }
- showMessage("提示", '更新成功!');
- window.location.reload();
- }
- });
- },
- getForm: function(btn){
- return btn.ownerCt.ownerCt;
- },
- gettopaybalance: function(){
- if(Ext.getCmp('bap_doublebalance') && Ext.getCmp('bap_cmrate')) {
- var doublebalance = Ext.Number.from(Ext.getCmp('bap_doublebalance').getValue(), 0);
- var cmrate = Ext.Number.from(Ext.getCmp('bap_cmrate').getValue(), 0);
- Ext.getCmp('bap_topaybalance').setValue(Ext.Number.toFixed(doublebalance*cmrate, 2));
- if (typeof (f = Ext.getCmp('bap_leftamount')) != 'undefined' ) {
- var v1 = (Ext.getCmp('bap_settleamount').value || 0);
- Ext.getCmp('bap_leftamount').setValue(Ext.Number.toFixed(doublebalance-v1, 2));
- }
- }
- }
- });
|