| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186 |
- package tinvoicebill;
- import baseclass.DataBeanCust;
- import p2.pao.PaoSetRemote;
- import p2.util.P2AppException;
- import p2.util.P2Exception;
- import tinvoiceapply.tinvoiceapply;
- public class tinvoiceapplyBillDataBean extends DataBeanCust {
- /**
- * 发票一键添加
- *
- * @return
- * @throws P2Exception
- */
- public int ADDINVOICES() throws P2Exception {
- parent.save();
- if ("审核".equals(parent.getString("fstatus"))) {
- throw new P2AppException("", "审核状态下不可添加");
- }
- tinvoiceapply tinvoiceapply = (tinvoiceapply) parent.getPao();
- tinvoiceapply.addBills();
- parent.save();
- byrefresh();
- return 1;
- }
- public int ADDROW() throws P2Exception {
- parent.save();
- if ("审核".equals(parent.getString("fstatus"))) {
- throw new P2AppException("", "审核状态下不可添加");
- }
- return super.ADDROW();
- }
- @Override
- public int TOGGLEDELETEROW() throws P2Exception {
- if ("审核".equals(parent.getString("fstatus"))) {
- throw new P2AppException("", "审核状态下不可删除");
- }
- return super.TOGGLEDELETEROW();
- }
- /**
- * 勾选创建发票
- *
- * @return
- * @throws P2Exception
- */
- public int CREATEINVOICEBILL() throws P2Exception {
- parent.save();
- tinvoiceapply tinvoiceapply = (tinvoiceapply) parent.getPao();
- if (runLongOp("CREATEINVOICEBILL")) {
- if (!"审核".equals(parent.getString("fstatus"))) {
- throw new P2AppException("", "非审核状态下不可进行发票生成");
- }
- tinvoiceapply.createBlueInvoice();
- parent.save();
- }
- if (LongOpCompleted()) {
- PaoSetRemote tinvoicebillSet = tinvoiceapply.getPaoSet("tinvoicebill");
- int i = 0;
- tinvoicebill tinvoicebill = null;
- while ((tinvoicebill = (tinvoicebill) tinvoicebillSet.getPao(i)) != null) {
- if (!"".equals(tinvoicebill.getString("finvoiceserialnum"))) {
- tinvoicebill.queryInvoice();
- parent.save();
- }
- i++;
- }
- byrefresh();
- }
- return 1;
- }
- /**
- * 勾选创建红字发票
- *
- * @return
- * @throws P2Exception
- */
- public int CREATEREDINVOICEBILL() throws P2Exception {
- parent.save();
- tinvoiceapply tinvoiceapply = (tinvoiceapply) parent.getPao();
- if (runLongOp("CREATEREDINVOICEBILL")) {
- if (!"审核".equals(parent.getString("fstatus"))) {
- throw new P2AppException("", "非审核状态下不可进行发票生成");
- }
- tinvoiceapply.createRedInvoice();
- parent.save();
- }
- if (LongOpCompleted()) {
- PaoSetRemote tinvoicebillSet = tinvoiceapply.getPaoSet("tinvoicebill_red");
- int i = 0;
- tinvoicebill tinvoicebill = null;
- while ((tinvoicebill = (tinvoicebill) tinvoicebillSet.getPao(i)) != null) {
- if (!"".equals(tinvoicebill.getString("finvoiceserialnum"))) {
- tinvoicebill.queryInvoice();
- parent.save();
- }
- i++;
- }
- byrefresh();
- }
- return 1;
- }
- /**
- * 发票创建查询
- *
- * @return
- * @throws P2Exception
- */
- public int QUERYINVOICEBILL() throws P2Exception {
- //parent.save();
- if (runLongOp("QUERYINVOICEBILL")) {
- if (!"审核".equals(parent.getString("fstatus"))) {
- throw new P2AppException("", "非审核状态下不可进行发票查询");
- }
- tinvoiceapply tinvoiceapply = (tinvoiceapply) parent.getPao();
- PaoSetRemote tinvoicebillSet = tinvoiceapply.getPaoSet("tinvoicebill");
- int i = 0;
- tinvoicebill tinvoicebill = null;
- while ((tinvoicebill = (tinvoicebill) tinvoicebillSet.getPao(i)) != null) {
- if (!"".equals(tinvoicebill.getString("finvoiceserialnum"))) {
- tinvoicebill.queryInvoice();
- tinvoicebillSet.save();
- }
- i++;
- }
- }
- if (LongOpCompleted()) {
- byrefresh();
- }
- return 1;
- }
- /**
- * 发票创建查询
- *
- * @return
- * @throws P2Exception
- */
- public int QUERYREDINVOICEBILL() throws P2Exception {
- parent.save();
- if (runLongOp("QUERYREDINVOICEBILL")) {
- if (!"审核".equals(parent.getString("fstatus"))) {
- throw new P2AppException("", "非审核状态下不可进行发票查询");
- }
- tinvoiceapply tinvoiceapply = (tinvoiceapply) parent.getPao();
- PaoSetRemote tinvoicebillSet = tinvoiceapply.getPaoSet("tinvoicebill_red");
- int i = 0;
- tinvoicebill tinvoicebill = null;
- while ((tinvoicebill = (tinvoicebill) tinvoicebillSet.getPao(i)) != null) {
- if (!"".equals(tinvoicebill.getString("finvoiceserialnum"))) {
- tinvoicebill.queryInvoice();
- tinvoicebillSet.save();
- }
- i++;
- }
- }
- if (LongOpCompleted()) {
- byrefresh();
- }
- return 1;
- }
- /**
- * 红冲
- *
- * @return
- * @throws P2Exception
- */
- public int CREATEREDBILL() throws P2Exception {
- parent.save();
- if (!"审核".equals(parent.getString("fstatus"))) {
- throw new P2AppException("", "非审核状态下不可进行发票生成");
- }
- tinvoiceapply tinvoiceapply = (tinvoiceapply) parent.getPao();
- tinvoiceapply.addRedBill();
- parent.save();
- byrefresh();
- return 1;
- }
- }
|