tinvoiceapplyBillDataBean.java 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186
  1. package tinvoicebill;
  2. import baseclass.DataBeanCust;
  3. import p2.pao.PaoSetRemote;
  4. import p2.util.P2AppException;
  5. import p2.util.P2Exception;
  6. import tinvoiceapply.tinvoiceapply;
  7. public class tinvoiceapplyBillDataBean extends DataBeanCust {
  8. /**
  9. * 发票一键添加
  10. *
  11. * @return
  12. * @throws P2Exception
  13. */
  14. public int ADDINVOICES() throws P2Exception {
  15. parent.save();
  16. if ("审核".equals(parent.getString("fstatus"))) {
  17. throw new P2AppException("", "审核状态下不可添加");
  18. }
  19. tinvoiceapply tinvoiceapply = (tinvoiceapply) parent.getPao();
  20. tinvoiceapply.addBills();
  21. parent.save();
  22. byrefresh();
  23. return 1;
  24. }
  25. public int ADDROW() throws P2Exception {
  26. parent.save();
  27. if ("审核".equals(parent.getString("fstatus"))) {
  28. throw new P2AppException("", "审核状态下不可添加");
  29. }
  30. return super.ADDROW();
  31. }
  32. @Override
  33. public int TOGGLEDELETEROW() throws P2Exception {
  34. if ("审核".equals(parent.getString("fstatus"))) {
  35. throw new P2AppException("", "审核状态下不可删除");
  36. }
  37. return super.TOGGLEDELETEROW();
  38. }
  39. /**
  40. * 勾选创建发票
  41. *
  42. * @return
  43. * @throws P2Exception
  44. */
  45. public int CREATEINVOICEBILL() throws P2Exception {
  46. parent.save();
  47. tinvoiceapply tinvoiceapply = (tinvoiceapply) parent.getPao();
  48. if (runLongOp("CREATEINVOICEBILL")) {
  49. if (!"审核".equals(parent.getString("fstatus"))) {
  50. throw new P2AppException("", "非审核状态下不可进行发票生成");
  51. }
  52. tinvoiceapply.createBlueInvoice();
  53. parent.save();
  54. }
  55. if (LongOpCompleted()) {
  56. PaoSetRemote tinvoicebillSet = tinvoiceapply.getPaoSet("tinvoicebill");
  57. int i = 0;
  58. tinvoicebill tinvoicebill = null;
  59. while ((tinvoicebill = (tinvoicebill) tinvoicebillSet.getPao(i)) != null) {
  60. if (!"".equals(tinvoicebill.getString("finvoiceserialnum"))) {
  61. tinvoicebill.queryInvoice();
  62. parent.save();
  63. }
  64. i++;
  65. }
  66. byrefresh();
  67. }
  68. return 1;
  69. }
  70. /**
  71. * 勾选创建红字发票
  72. *
  73. * @return
  74. * @throws P2Exception
  75. */
  76. public int CREATEREDINVOICEBILL() throws P2Exception {
  77. parent.save();
  78. tinvoiceapply tinvoiceapply = (tinvoiceapply) parent.getPao();
  79. if (runLongOp("CREATEREDINVOICEBILL")) {
  80. if (!"审核".equals(parent.getString("fstatus"))) {
  81. throw new P2AppException("", "非审核状态下不可进行发票生成");
  82. }
  83. tinvoiceapply.createRedInvoice();
  84. parent.save();
  85. }
  86. if (LongOpCompleted()) {
  87. PaoSetRemote tinvoicebillSet = tinvoiceapply.getPaoSet("tinvoicebill_red");
  88. int i = 0;
  89. tinvoicebill tinvoicebill = null;
  90. while ((tinvoicebill = (tinvoicebill) tinvoicebillSet.getPao(i)) != null) {
  91. if (!"".equals(tinvoicebill.getString("finvoiceserialnum"))) {
  92. tinvoicebill.queryInvoice();
  93. parent.save();
  94. }
  95. i++;
  96. }
  97. byrefresh();
  98. }
  99. return 1;
  100. }
  101. /**
  102. * 发票创建查询
  103. *
  104. * @return
  105. * @throws P2Exception
  106. */
  107. public int QUERYINVOICEBILL() throws P2Exception {
  108. //parent.save();
  109. if (runLongOp("QUERYINVOICEBILL")) {
  110. if (!"审核".equals(parent.getString("fstatus"))) {
  111. throw new P2AppException("", "非审核状态下不可进行发票查询");
  112. }
  113. tinvoiceapply tinvoiceapply = (tinvoiceapply) parent.getPao();
  114. PaoSetRemote tinvoicebillSet = tinvoiceapply.getPaoSet("tinvoicebill");
  115. int i = 0;
  116. tinvoicebill tinvoicebill = null;
  117. while ((tinvoicebill = (tinvoicebill) tinvoicebillSet.getPao(i)) != null) {
  118. if (!"".equals(tinvoicebill.getString("finvoiceserialnum"))) {
  119. tinvoicebill.queryInvoice();
  120. tinvoicebillSet.save();
  121. }
  122. i++;
  123. }
  124. }
  125. if (LongOpCompleted()) {
  126. byrefresh();
  127. }
  128. return 1;
  129. }
  130. /**
  131. * 发票创建查询
  132. *
  133. * @return
  134. * @throws P2Exception
  135. */
  136. public int QUERYREDINVOICEBILL() throws P2Exception {
  137. parent.save();
  138. if (runLongOp("QUERYREDINVOICEBILL")) {
  139. if (!"审核".equals(parent.getString("fstatus"))) {
  140. throw new P2AppException("", "非审核状态下不可进行发票查询");
  141. }
  142. tinvoiceapply tinvoiceapply = (tinvoiceapply) parent.getPao();
  143. PaoSetRemote tinvoicebillSet = tinvoiceapply.getPaoSet("tinvoicebill_red");
  144. int i = 0;
  145. tinvoicebill tinvoicebill = null;
  146. while ((tinvoicebill = (tinvoicebill) tinvoicebillSet.getPao(i)) != null) {
  147. if (!"".equals(tinvoicebill.getString("finvoiceserialnum"))) {
  148. tinvoicebill.queryInvoice();
  149. tinvoicebillSet.save();
  150. }
  151. i++;
  152. }
  153. }
  154. if (LongOpCompleted()) {
  155. byrefresh();
  156. }
  157. return 1;
  158. }
  159. /**
  160. * 红冲
  161. *
  162. * @return
  163. * @throws P2Exception
  164. */
  165. public int CREATEREDBILL() throws P2Exception {
  166. parent.save();
  167. if (!"审核".equals(parent.getString("fstatus"))) {
  168. throw new P2AppException("", "非审核状态下不可进行发票生成");
  169. }
  170. tinvoiceapply tinvoiceapply = (tinvoiceapply) parent.getPao();
  171. tinvoiceapply.addRedBill();
  172. parent.save();
  173. byrefresh();
  174. return 1;
  175. }
  176. }