Przeglądaj źródła

核销生成红单添加开票和收货信息

hxh 1 miesiąc temu
rodzic
commit
cc0efa1164

+ 23 - 3
src/custom/restcontroller/webmanage/sale/tpartreimbursement/tpartreimbursement.java

@@ -606,14 +606,34 @@ public class tpartreimbursement extends Controller {
         insertSQL.setValue("billno", billno);
         insertSQL.setValue("outplace", "谈桥");
         insertSQL.setValue("delivery", "");
-        insertSQL.setValue("invoice_enterprisename", "");
-        insertSQL.setValue("invoice_address", "");
-        insertSQL.setValue("invoice_taxno", "");
+        Rows invoicerows = dbConnect.runSqlQuery("select * from sys_enterprise_finance where sys_enterpriseid=" + sys_enterpriseid + " order by isdefault desc");
+        Rows addressrows = dbConnect.runSqlQuery("select * from sys_enterprise_contacts where type='配件' and sys_enterpriseid=" + sys_enterpriseid + " order by isdefault desc");
+        if(invoicerows.isNotEmpty()){
+            insertSQL.setValue("invoice_enterprisename", invoicerows.get(0).getString("enterprisename"));
+            insertSQL.setValue("invoice_address", invoicerows.get(0).getString("address"));
+            insertSQL.setValue("invoice_taxno", invoicerows.get(0).getString("taxno"));
+        }else{
+            insertSQL.setValue("invoice_enterprisename", "");
+            insertSQL.setValue("invoice_address", "");
+            insertSQL.setValue("invoice_taxno", "");
+        }
+
+        if(addressrows.isNotEmpty()){
+            insertSQL.setValue("name", addressrows.get(0).getString("name"));
+            insertSQL.setValue("address", addressrows.get(0).getString("address"));
+            insertSQL.setValue("phonenumber", addressrows.get(0).getString("phonenumber"));
+        }else{
+            insertSQL.setValue("name", "");
+            insertSQL.setValue("address", "");
+            insertSQL.setValue("phonenumber", "");
+        }
+
         insertSQL.setValue("tracknumber", "");
         insertSQL.setValue("isconfirm", 0);
         insertSQL.setValue("sourceobject", "tpartreimbursement");
 
 
+
         SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM");
         Calendar calendar = Calendar.getInstance();
         insertSQL.setValue("period", dateFormat.format(calendar.getTime()));