| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372 |
- Ext.QuickTips.init();
- Ext.define('erp.controller.pm.mould.MouldFeePlease', {
- extend: 'Ext.app.Controller',
- FormUtil: Ext.create('erp.util.FormUtil'),
- GridUtil: Ext.create('erp.util.GridUtil'),
- BaseUtil: Ext.create('erp.util.BaseUtil'),
- views:[
- 'core.form.Panel','pm.mould.MouldFeePlease','core.grid.Panel2','core.toolbar.Toolbar','core.form.MultiField', 'core.form.SeparNumber',
- 'core.button.Save','core.button.Add','core.button.Submit','core.button.Print','core.button.ResAudit',
- 'core.button.Audit','core.button.Close','core.button.Delete','core.button.Update','core.button.DeleteDetail','core.button.ResSubmit',
- 'core.button.TurnPurcProdIO','core.form.FileField','core.button.UpdatePayStatus',
- 'core.button.TurnBankRegister','core.button.TurnBillAP','core.button.TurnBillARChange',
- 'core.button.End', 'core.button.ResEnd',
- 'core.trigger.TextAreaTrigger','core.trigger.DbfindTrigger','core.trigger.MultiDbfindTrigger','core.form.YnField'
- ],
- init:function(){
- var me = this;
- this.control({
- 'textfield[name=mp_thispayamount]':{
- beforerender: function(field){
- field.readOnly=false;
- }
- },
- 'field[name=mp_thispaydate]':{
- beforerender: function(field){
- field.readOnly=false;
- }
- },
- 'field[name=mp_bankcode]':{
- beforerender: function(field){
- field.readOnly=false;
- }
- },
- 'erpGridPanel2': {
- afterrender: function(grid){
- var status = Ext.getCmp('mp_statuscode');
- if(status && status.value != 'ENTERING' && status.value != 'COMMITED'){
- Ext.each(grid.columns, function(c){
- c.setEditor(null);
- });
- }
- },
- itemclick: this.onGridItemClick
- },
- '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(this);
- }
- },
- 'erpDeleteButton' : {
- click: function(btn){
- me.FormUtil.onDelete(Ext.getCmp('mp_id').value);
- }
- },
- 'erpPrintButton': {
- click: function(btn){
- var condition = '{MOULDFEEPLEASE.mp_id}=' + Ext.getCmp('mp_id').value;
- var reportName="AccountRegZW_zw";
- var id = Ext.getCmp('mp_id').value;
- me.FormUtil.onwindowsPrint(id, reportName, condition);
- }
- },
- 'erpUpdateButton': {
- afterrender: function(btn){
- var status = Ext.getCmp('mp_statuscode');
- if(status && status.value != 'ENTERING'){
- btn.hide();
- }
- },
- click: function(btn){
- this.FormUtil.onUpdate(this);
- }
- },
- 'erpAddButton': {
- click: function(){
- me.FormUtil.onAdd('addPurMould', '新增模具付款申请单', 'jsps/pm/mould/mouldFeePlease.jsp');
- }
- },
- 'erpCloseButton': {
- click: function(btn){
- me.FormUtil.beforeClose(me);
- }
- },
- 'erpSubmitButton': {
- afterrender: function(btn){
- var status = Ext.getCmp('mp_statuscode');
- if(status && status.value != 'ENTERING'){
- btn.hide();
- }
- },
- click: function(btn){
- me.FormUtil.onSubmit(Ext.getCmp('mp_id').value);
- }
- },
- 'erpResSubmitButton': {
- afterrender: function(btn){
- var status = Ext.getCmp('mp_statuscode');
- if(status && status.value != 'COMMITED'){
- btn.hide();
- }
- },
- click: function(btn){
- me.FormUtil.onResSubmit(Ext.getCmp('mp_id').value);
- }
- },
- 'erpAuditButton': {
- afterrender: function(btn){
- var status = Ext.getCmp('mp_statuscode');
- if(status && status.value != 'COMMITED'){
- btn.hide();
- }
- },
- click: function(btn){
- me.FormUtil.onAudit(Ext.getCmp('mp_id').value);
- }
- },
- 'erpResAuditButton': {
- afterrender: function(btn){
- var status = Ext.getCmp('mp_statuscode'),
- paystatus = Ext.getCmp('mp_paystatus'),
- turnstatus = Ext.getCmp('mp_turnstatuscode');
- if(status && status.value != 'AUDITED'){
- btn.hide();
- }
- if(paystatus && paystatus.value != '未付款'){
- btn.hide();
- }
- if(turnstatus && turnstatus.value){
- btn.hide();
- }
- },
- click: function(btn){
- me.FormUtil.onResAudit(Ext.getCmp('mp_id').value);
- }
- },
- 'erpEndButton': {
- afterrender: function(btn) {
- var status = Ext.getCmp('mp_statuscode');
- if (status && status.value != 'AUDITED') {
- btn.hide();
- }
- },
- click: function(btn) {
- me.FormUtil.onEnd(Ext.getCmp('mp_id').value);
- }
- },
- 'erpResEndButton': {
- afterrender: function(btn) {
- var status = Ext.getCmp('mp_statuscode');
- if (status && status.value != 'FINISH') {
- btn.hide();
- }
- },
- click: function(btn) {
- me.FormUtil.onResEnd(Ext.getCmp('mp_id').value);
- }
- },
- //转银行登记
- 'erpTurnBankRegisterButton':{
- click:function(btn){
- me.turnBankRegister();
- },
- afterrender: function(btn){
- var status = Ext.getCmp(me.getForm(btn).statuscodeField);
- if(status && status.value != 'AUDITED'){
- btn.hide();
- }
- }
- },
- //应付票据付款
- 'erpTurnBillAPButton':{
- click:function(btn){
- me.turnBillAP();
- },
- afterrender: function(btn){
- var status = Ext.getCmp(me.getForm(btn).statuscodeField);
- if(status && status.value != 'AUDITED'){
- btn.hide();
- }
- }
- },
- //应付票据付款
- 'erpTurnBillARChangeButton':{
- click:function(btn){
- me.turnBillARChange();
- },
- afterrender: function(btn){
- var status = Ext.getCmp(me.getForm(btn).statuscodeField);
- if(status && status.value != 'AUDITED'){
- btn.hide();
- }
- }
- },
- 'field[name=mfd_purccode]': {
- focus: function(t){
- t.setHideTrigger(false);
- t.setReadOnly(false);
- if(Ext.getCmp('mp_vendcode')){
- var code = Ext.getCmp('mp_vendcode').value;
- if(code == null || code == ''){
- showError("请先选择供应商!");
- t.setHideTrigger(true);
- t.setReadOnly(true);
- } else {
- var obj = me.getBaseCondition();
- if(obj.vendor){
- t.dbBaseCondition = "pm_vendcode='" + code + "'";
- }
- }
- }
- }
- }
- });
- },
- onGridItemClick: function(selModel, record){//grid行选择
- this.GridUtil.onGridItemClick(selModel, record);
- },
- getForm: function(btn){
- return btn.ownerCt.ownerCt;
- },
- turnBankRegister: function(){
- var me = this;
- var grid = Ext.getCmp('grid'), catecode = Ext.getCmp('mp_bankcode').value;
- var thisamount = Ext.getCmp('mp_thispayamount').value, amount = Ext.getCmp('mp_payamount').value;
- var ppamount = Ext.getCmp('mp_total').value;
- var thispaydate = Ext.getCmp('mp_thispaydate').value;
- if(Ext.isEmpty(thispaydate)){
- Ext.Msg.alert('警告','请填写本次付款日期!');
- return;
- }
- if(thisamount-(ppamount-amount)>0.01){
- Ext.Msg.alert('警告','本次付款金额超过剩余未转金额!未转金额:'+ (ppamount-amount));
- return;
- }
- if(catecode == null || catecode == ''){
- Ext.Msg.alert('警告','请填写需要转银行登记的付款方信息!');
- return;
- }
- if(thisamount == null || thisamount=='' || thisamount==0){
- Ext.Msg.alert('警告','本次付款金额未填写!');
- return;
- }
- me.FormUtil.getActiveTab().setLoading(true);//loading...
- Ext.Ajax.request({
- url : basePath + 'pm/mould/turnAccountRegister.action',
- params: {
- id: Ext.getCmp('mp_id').value,
- thisamount: thisamount,
- catecode : catecode,
- thisdate : thispaydate,
- caller : caller
- },
- method : 'post',
- callback : function(options,success,response){
- me.FormUtil.getActiveTab().setLoading(false);
- var localJson = new Ext.decode(response.responseText);
- if(localJson.exceptionInfo){
- showError(localJson.exceptionInfo);
- }
- if(localJson.success){
- turnSuccess(function(){
- var id = localJson.id;
- var url = "jsps/fa/gs/accountRegister.jsp?whoami=AccountRegister!Bank&formCondition=ar_id=" + id + "&gridCondition=ard_arid=" + id;
- me.FormUtil.onAdd('AccountRegister' + id, '银行登记' + id, url);
- });
- }
- }
- });
- },
- turnBillAP: function(){
- var me = this;
- var grid = Ext.getCmp('grid'), catecode = Ext.getCmp('mp_bankcode').value;
- var thisamount = Ext.getCmp('mp_thispayamount').value, amount = Ext.getCmp('mp_payamount').value;
- var ppamount = Ext.getCmp('mp_total').value;
- var thispaydate = Ext.getCmp('mp_thispaydate').value;
- if(Ext.isEmpty(thispaydate)){
- Ext.Msg.alert('警告','请填写本次付款日期!');
- return;
- }
- if(thisamount-(ppamount-amount)>0.01){
- Ext.Msg.alert('警告','本次付款金额超过剩余未转金额!未转金额:'+ (ppamount-amount));
- return;
- }
- if(catecode == null || catecode == ''){
- Ext.Msg.alert('警告','请填写需要转银行登记的付款方信息!');
- return;
- }
- if(thisamount == null || thisamount=='' || thisamount==0){
- Ext.Msg.alert('警告','本次付款金额未填写!');
- return;
- }
- me.FormUtil.getActiveTab().setLoading(true);//loading...
- Ext.Ajax.request({
- url : basePath + 'pm/mould/turnBillAP.action',
- params: {
- id: Ext.getCmp('mp_id').value,
- thisamount: thisamount,
- catecode : catecode,
- thisdate : thispaydate,
- caller : caller
- },
- method : 'post',
- callback : function(options,success,response){
- me.FormUtil.getActiveTab().setLoading(false);
- var localJson = new Ext.decode(response.responseText);
- if(localJson.exceptionInfo){
- showError(localJson.exceptionInfo);
- }
- if(localJson.success){
- turnSuccess(function(){
- var id = localJson.id;
- var url = "jsps/fa/gs/billAP.jsp?formCondition=bap_id=" + id;
- me.FormUtil.onAdd('BillAP' + id, '应付票据' + id, url);
- });
- }
- }
- });
- },
- turnBillARChange: function(){
- var me = this;
- var grid = Ext.getCmp('grid'), catecode = Ext.getCmp('mp_bankcode').value;
- var thisamount = Ext.getCmp('mp_thispayamount').value, amount = Ext.getCmp('mp_payamount').value;
- var ppamount = Ext.getCmp('mp_total').value;
- var thispaydate = Ext.getCmp('mp_thispaydate').value;
- if(Ext.isEmpty(thispaydate)){
- Ext.Msg.alert('警告','请填写本次付款日期!');
- return;
- }
- if(thisamount-(ppamount-amount)>0.01){
- Ext.Msg.alert('警告','本次付款金额超过剩余未转金额!未转金额:'+ (ppamount-amount));
- return;
- }
- if(catecode == null || catecode == ''){
- Ext.Msg.alert('警告','请填写需要转银行登记的付款方信息!');
- return;
- }
- if(thisamount == null || thisamount=='' || thisamount==0){
- Ext.Msg.alert('警告','本次付款金额未填写!');
- return;
- }
- me.FormUtil.getActiveTab().setLoading(true);//loading...
- Ext.Ajax.request({
- url : basePath + 'pm/mould/turnBillARChange.action',
- params: {
- id: Ext.getCmp('mp_id').value,
- thisamount: thisamount,
- catecode : catecode,
- thisdate : thispaydate,
- caller : caller
- },
- method : 'post',
- callback : function(options,success,response){
- me.FormUtil.getActiveTab().setLoading(false);
- var localJson = new Ext.decode(response.responseText);
- if(localJson.exceptionInfo){
- showError(localJson.exceptionInfo);
- }
- if(localJson.success){
- turnSuccess(function(){
- var id = localJson.id;
- var url = "jsps/fa/gs/billARChange.jsp?formCondition=brc_id=" + id + "&gridCondition=brd_brcid=" + id;
- me.FormUtil.onAdd('BillARChange' + id, '应收票据异动' + id, url);
- });
- }
- }
- });
- }
- });
|