|
|
@@ -106,9 +106,9 @@ public class tinvoicebill extends PaoCust {
|
|
|
* @return
|
|
|
*/
|
|
|
public void queryInvoice() throws P2Exception {
|
|
|
-// if (getString("status").equals("2")) {
|
|
|
-// return;
|
|
|
-// }
|
|
|
+ if (getString("status").equals("2") && "红".equals(getString("frb"))) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
String finvoiceserialnum = getString("finvoiceserialnum");//发票流水号
|
|
|
|
|
|
JSONObject contentObject = new JSONObject();
|
|
|
@@ -150,24 +150,25 @@ public class tinvoicebill extends PaoCust {
|
|
|
setValue("invoiceNo", invoiceNo, 11L);
|
|
|
}
|
|
|
createPrintStr(getString("invoiceCode"), getString("invoiceNo"), Double.parseDouble(resultObject.getString("orderAmount")));
|
|
|
-// if ("红".equals(getString("frb"))) {
|
|
|
-// DBConnect dbConnect = new DBConnect();
|
|
|
-// Rows rows = dbConnect.runSqlQuery("select t3.saorderdetailid,sum(t2.taxincludedamount)as taxincludedamount from tinvoicebill t1\n" +
|
|
|
-// "inner join tinvoicebillitem t2 on t1.siteid=t2.siteid and t1.tinvoiceapplyid=t2.tinvoiceapplyid and t1.tinvoicebillid=t2.tinvoicebillid\n" +
|
|
|
-// "inner join tinvoiceapplyorder t3 on t2.siteid=t3.siteid and t2.tinvoiceapplyid=t3.tinvoiceapplyid and t2.tinvoiceapplyordid=t3.tinvoiceapplyordid\n" +
|
|
|
-// "where t1.tinvoicebillid='" + getUniqueIDValue() + "' group by t3.saorderdetailid");
|
|
|
-// PaoSetRemote saorderdetailSet = getPaoSet("$saorderdetail", "saorderdetail", "siteid='" + getString("siteid") + "' and saorderdetailid in " + rows.getInWhere("saorderdetailid"));
|
|
|
-// int i = 0;
|
|
|
-// while (saorderdetailSet.getPao(i) != null) {
|
|
|
-// for (Row row : rows) {
|
|
|
-// if (saorderdetailSet.getPao(i).getUniqueIDValue() == row.getInteger("saorderdetailid")) {
|
|
|
-// double foldinvoiceamount = saorderdetailSet.getPao(i).getDouble("finvoiceamount");
|
|
|
-// saorderdetailSet.getPao(i).setValue("finvoiceamount", Math.add(foldinvoiceamount, row.getDouble("taxincludedamount")), 11L);
|
|
|
-// }
|
|
|
-// }
|
|
|
-// i++;
|
|
|
-// }
|
|
|
-// }
|
|
|
+ if ("红".equals(getString("frb"))) {
|
|
|
+ //红票查询成功后,更新订单已开票数量
|
|
|
+ DBConnect dbConnect = new DBConnect();
|
|
|
+ Rows rows = dbConnect.runSqlQuery("select t3.saorderdetailid,sum(t2.taxincludedamount)as taxincludedamount from tinvoicebill t1\n" +
|
|
|
+ "inner join tinvoicebillitem t2 on t1.siteid=t2.siteid and t1.tinvoiceapplyid=t2.tinvoiceapplyid and t1.tinvoicebillid=t2.tinvoicebillid\n" +
|
|
|
+ "inner join tinvoiceapplyorder t3 on t2.siteid=t3.siteid and t2.tinvoiceapplyid=t3.tinvoiceapplyid and t2.tinvoiceapplyordid=t3.tinvoiceapplyordid\n" +
|
|
|
+ "where t1.tinvoicebillid='" + getUniqueIDValue() + "' group by t3.saorderdetailid");
|
|
|
+ PaoSetRemote saorderdetailSet = getPaoSet("$saorderdetail", "saorderdetail", "siteid='" + getString("siteid") + "' and saorderdetailid in " + rows.getInWhere("saorderdetailid"));
|
|
|
+ int i = 0;
|
|
|
+ while (saorderdetailSet.getPao(i) != null) {
|
|
|
+ for (Row row : rows) {
|
|
|
+ if (saorderdetailSet.getPao(i).getUniqueIDValue() == row.getLong("saorderdetailid")) {
|
|
|
+ double foldinvoiceamount = saorderdetailSet.getPao(i).getDouble("finvoiceamount");
|
|
|
+ saorderdetailSet.getPao(i).setValue("finvoiceamount", Math.add(foldinvoiceamount, row.getDouble("taxincludedamount")), 11L);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ i++;
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|