Просмотр исходного кода

收入凭证新建一键核销按钮,点击后自动跳转并生成核销单

沈静伟 4 лет назад
Родитель
Сommit
86ea0a90bb
2 измененных файлов с 32 добавлено и 1 удалено
  1. 23 1
      src/apps/ficashbill/ficashbill.java
  2. 9 0
      src/apps/ficashbill/ficashbillAppBean.java

+ 23 - 1
src/apps/ficashbill/ficashbill.java

@@ -55,7 +55,7 @@ public class ficashbill extends PaoCust {
             }
         }
 
-        setValue("FUNWRITEOFFAMOUNT",getDouble("FAMOUNT")-getDouble("FWRITEOFFAMOUNT"),11l);
+        setValue("FUNWRITEOFFAMOUNT", getDouble("FAMOUNT") - getDouble("FWRITEOFFAMOUNT"), 11l);
     }
 
     @Override
@@ -526,4 +526,26 @@ public class ficashbill extends PaoCust {
             }
         }
     }
+
+    public void writeoffValidate() throws P2Exception {
+        if (!"审核".equals(getString("fstatus"))) {
+            throw new P2AppException("", "非审核状态不可进行核销操作");
+        }
+        if (!"收入".equals(getString("ftype"))) {
+            throw new P2AppException("", "非收入凭证不可进行核销操作");
+        }
+        if (getDouble("funwriteoffamount") == 0) {
+            throw new P2AppException("", "未核销金额为0!");
+        }
+    }
+
+    public long writeoff() throws P2Exception {
+        PaoSetRemote twriteoffbillSet = getPaoSet("twriteoffbill");
+        twriteoffbillSet.setApp("WRITEOFF");
+        PaoRemote pao = twriteoffbillSet.addAtEnd();
+        pao.setValue("fdate", getDate());
+        pao.setValue("fagentnum", getString("fagentnum"));
+        pao.setValue("ficashbillnum", getString("fbillnum"));
+        return pao.getUniqueIDValue();
+    }
 }

+ 9 - 0
src/apps/ficashbill/ficashbillAppBean.java

@@ -237,4 +237,13 @@ public class ficashbillAppBean extends AppBeanCust {
         return super.DELETE();
     }
 
+    public int WRITEOFF() throws P2Exception {
+        ficashbill ficashbill = (ficashbill) getPao();
+        long id = ficashbill.writeoff();
+        this.save();
+        closeApp("WRITEOFF");
+        openApp("WRITEOFF", id);
+        byrefresh();
+        return 1;
+    }
 }