123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145 |
- Ext.QuickTips.init();
- Ext.define('erp.controller.scm.sale.CreditChange', {
- extend : 'Ext.app.Controller',
- FormUtil : Ext.create('erp.util.FormUtil'),
- BaseUtil : Ext.create('erp.util.BaseUtil'),
- views : [ 'scm.sale.CreditChange', 'core.form.Panel',
- 'core.form.MultiField', 'core.form.FileField', 'core.button.Add',
- 'core.button.Save', 'core.button.Close', 'core.button.Upload',
- 'core.button.Update', 'core.button.Delete', 'core.button.Sync',
- 'core.button.Submit', 'core.button.ResSubmit', 'core.button.Print',
- 'core.button.ResAudit', 'core.button.Audit','core.form.SeparNumber',
- 'core.trigger.DbfindTrigger', 'core.trigger.TextAreaTrigger',
- 'core.form.YnField' ],
- init : function() {
- var me = this;
- this.control({
- 'erpSaveButton' : {
- click : function(btn) {
- var form = me.getForm(btn);
- if (Ext.getCmp(form.codeField).value == null
- || Ext.getCmp(form.codeField).value == '') {
- me.BaseUtil.getRandomNumber();// 自动添加编号
- }
- var newtempdate = new Date(Ext.util.Format.date(Ext
- .getCmp('cc_newtempcreditdate').value, 'Y-m-d'));
- var now = new Date(Ext.util.Format
- .date(new Date(), 'Y-m-d'));
- if(Ext.getCmp('cc_newtempcreditdate').value==null && Ext.getCmp('cc_newtempcredit').value!=null && Ext.getCmp('cc_newtempcredit').value >0){
- showError('请先填写临时额度有效期');
- return;
- }
- if (now > newtempdate) {
- showError('新临时额度有效期小于当前日期,请更改!');
- return;
- }
- this.FormUtil.beforeSave(this);
- }
- },
- 'erpUpdateButton' : {
- click : function(btn) {
- var newtempdate = new Date(Ext.util.Format.date(Ext
- .getCmp('cc_newtempcreditdate').value, 'Y-m-d'));
- var now = new Date(Ext.util.Format
- .date(new Date(), 'Y-m-d'));
- if(Ext.getCmp('cc_newtempcreditdate').value==null && Ext.getCmp('cc_newtempcredit').value!=null && Ext.getCmp('cc_newtempcredit').value >0){
- showError('请先填写临时额度有效期');
- return;
- }
- if (now > newtempdate) {
- showError('新临时额度有效期小于当前日期,请更改!');
- return;
- }
- this.FormUtil.onUpdate(this);
- }
- },
- 'erpAddButton' : {
- click : function() {
- me.FormUtil.onAdd('addCreditChange', '新增客户信用变更',
- 'jsps/scm/sale/creditChange.jsp');
- }
- },
- 'erpCloseButton' : {
- click : function(btn) {
- me.FormUtil.beforeClose(me);
- }
- },
- 'erpDeleteButton' : {
- click : function(btn) {
- me.FormUtil.onDelete(Ext.getCmp('cc_id').value);
- }
- },
- 'erpSubmitButton' : {
- afterrender : function(btn) {
- var status = Ext.getCmp('cc_statuscode');
- if (status && status.value != 'ENTERING') {
- btn.hide();
- }
- },
- click : function(btn) {
- me.FormUtil.onSubmit(Ext.getCmp('cc_id').value);
- }
- },
- 'erpResSubmitButton' : {
- afterrender : function(btn) {
- var status = Ext.getCmp('cc_statuscode');
- if (status && status.value != 'COMMITED') {
- btn.hide();
- }
- },
- click : function(btn) {
- me.FormUtil.onResSubmit(Ext.getCmp('cc_id').value);
- }
- },
- 'erpAuditButton' : {
- afterrender : function(btn) {
- var status = Ext.getCmp('cc_statuscode');
- if (status && status.value != 'COMMITED') {
- btn.hide();
- }
- },
- click : function(btn) {
- me.FormUtil.onAudit(Ext.getCmp('cc_id').value);
- }
- },
- 'erpResAuditButton' : {
- afterrender : function(btn) {
- var status = Ext.getCmp('cc_statuscode');
- if (status && status.value != 'AUDITED') {
- btn.hide();
- }
- },
- click : function(btn) {
- me.FormUtil.onResAudit(Ext.getCmp('cc_id').value);
- }
- },
- 'erpPrintButton' : {
- afterrender : function(btn) {
- var status = Ext.getCmp('cc_statuscode');
- if (status && status.value != 'AUDITED') {
- btn.hide();
- }
- },
- click : function(btn) {
- var reportName = '';
- reportName = "CreditChange";
- var condition = '{CreditChange.cc_id}='
- + Ext.getCmp('cc_id').value + '';
- var id = Ext.getCmp('cc_id').value;
- me.FormUtil.onwindowsPrint(id, reportName, condition);
- }
- },
- 'textfield[name=cc_custcode]' : {
- aftertrigger : function(field) {
- if (field != null && field != '') {
- Ext.getCmp('cc_newcredit').setValue(
- Ext.getCmp('cc_credit').value);
- }
- }
- }
- });
- },
- getForm : function(btn) {
- return btn.ownerCt.ownerCt;
- }
- });
|