private void buttonAcctSync_Click(object sender, EventArgs e)
        {
            string outmsg = "";
            string flowNO = textBoxFlowNO.Text.Trim();
            #region 多借多贷同步

            List<CoreBillRecord> list = new List<CoreBillRecord>();
            CoreAcctResult outresult = new CoreAcctResult();

            CoreBillRecord bill = new CoreBillRecord();
            bill.Currency = "CNY";
            bill.InnerSN = "1";
            bill.InterAcctSN = "0003";
            bill.IsEliminateFlag = "0";
            bill.IsNote = null;
            bill.Opt = "2";
            bill.OptAcct = null;
            bill.OrgNO = "801000";
            bill.PendingAcctSN = null;
            bill.RedBlueFlag = "1";
            bill.Subject = "111299";
            bill.TradeAcctNO = null;
            bill.TradeMoney = "104840.00";
            list.Add(bill);

            CoreBillRecord bill1 = new CoreBillRecord();
            bill1.Currency = "CNY";
            bill1.InnerSN = "2";
            bill1.InterAcctSN = "0001";
            bill1.IsEliminateFlag = "0";
            bill1.IsNote = null;
            bill1.Opt = "1";
            bill1.OptAcct = null;
            bill1.OrgNO = "801000";
            bill1.PendingAcctSN = null;
            bill1.RedBlueFlag = "1";
            bill1.Subject = "143101";
            bill1.TradeAcctNO = null;
            bill1.TradeMoney = "102340.00";
            list.Add(bill1);

            CoreBillRecord bill2 = new CoreBillRecord();
            bill2.Currency = "CNY";
            bill2.InnerSN = "3";
            bill2.InterAcctSN = "0001";
            bill2.IsEliminateFlag = "0";
            bill2.IsNote = null;
            bill2.Opt = "1";
            bill2.OptAcct = null;
            bill2.OrgNO = "801000";
            bill2.PendingAcctSN = null;
            bill2.RedBlueFlag = "1";
            bill2.Subject = "132158";
            bill2.TradeAcctNO = null;
            bill2.TradeMoney = "2500.00";
            list.Add(bill2);

            //CoreBillRecord bill3 = new CoreBillRecord();
            //bill3.Currency = "CNY";
            //bill3.InnerSN = "3";
            //bill3.InterAcctSN = "0001";
            //bill3.IsEliminateFlag = "0";
            //bill3.IsNote = null;
            //bill3.Opt = "1";
            //bill3.OptAcct = null;
            //bill3.OrgNO = "801000";
            //bill3.PendingAcctSN = null;
            //bill3.RedBlueFlag = "1";
            //bill3.Subject = "145103";
            //bill3.TradeAcctNO = null;
            //bill3.TradeMoney = "20000";
            //list.Add(bill3);


            AidSysClientSyncWrapper.CoreAcctRecord("801000", "8010001", DateTime.Now, flowNO, list, out outresult, out outmsg);
            #endregion

        }
        private List<CoreBillRecord> GetAccoutingEntry()
        {
            List<CoreBillRecord> billList = new List<CoreBillRecord>();
            #region 分录1
            if (!string.IsNullOrEmpty(textBoxInterAcctSN.Text.Trim()) && !string.IsNullOrEmpty(textBoxSubject.Text.Trim()) || !string.IsNullOrEmpty(textBoxTradeAcct.Text.Trim()))
            {
                CoreBillRecord bill = new CoreBillRecord();
                bill.InnerSN = (billList.Count + 1).ToString();
                bill.TradeAcctNO = textBoxTradeAcct.Text.Trim(); //交易客户账
                if (bill.TradeAcctNO.Length > 0)
                {
                    bill.IsNote = "1"; // 钞汇属性
                }
                bill.Currency = textBoxCurrency.Text.Trim();
                bill.InterAcctSN = textBoxInterAcctSN.Text.Trim();
                bill.Subject = textBoxSubject.Text.Trim();
                bill.OptAcct = textBoxTradeAcct.Text.Trim();
                bill.TradeMoney = textBoxMoney.Text.Trim();
                bill.Opt = radioButtonBorrow.Checked ? "1" : "2";
                string flag = "1";
                if (radioButtonFlagRed.Checked)
                {
                    flag = "2";
                }
                else if (radioButtonFlagBlue.Checked)
                {
                    flag = "3";
                }
                bill.RedBlueFlag = flag;

                if (!radioButtonNor.Checked)
                {
                    bill.IsEliminateFlag = radioButtonRecord.Checked ? "1" : "2";
                    if (radioButtonRemove.Checked)
                    {
                        bill.PendingAcctSN = textBoxRemove.Text;
                    }
                }
                if (string.IsNullOrEmpty(textBoxOppOrg.Text.Trim()))
                {
                    bill.OrgNO = textBoxOrgNO.Text.Trim();
                }
                else
                {
                    bill.OrgNO = textBoxOppOrg.Text.Trim();
                }
                billList.Add(bill);
            }
            #endregion

            #region 分录2
            //记账2
            if (!string.IsNullOrEmpty(textBoxInterAcctSN1.Text.Trim()) && !string.IsNullOrEmpty(textBoxSubject1.Text.Trim()))
            {
                CoreBillRecord bill1 = new CoreBillRecord();
                bill1.InnerSN = (billList.Count + 1).ToString();
                //bill1.TradeAcct = textBoxTradeAcct1.Text.Trim();
                bill1.Currency = textBoxCurrency1.Text.Trim();
                bill1.InterAcctSN = textBoxInterAcctSN1.Text.Trim();
                bill1.Subject = textBoxSubject1.Text.Trim();
                bill1.OptAcct = textBoxOptAcct1.Text.Trim();
                bill1.TradeMoney = textBoxMoney1.Text.Trim();
                bill1.Opt = radioButtonBorrow1.Checked ? "1" : "2";
                string flag = "1";
                if (radioButtonFlagRed1.Checked)
                {
                    flag = "2";
                }
                else if (radioButtonFlagBlue1.Checked)
                {
                    flag = "3";
                }
                bill1.RedBlueFlag = flag;
                //bill.Opt = "2";
                if (!radioButtonNor1.Checked)
                {
                    bill1.IsEliminateFlag = radioButtonRecord1.Checked ? "1" : "2";
                    if (radioButtonRemove1.Checked)
                    {
                        bill1.PendingAcctSN = textBoxRemove1.Text;
                    }
                }
                if (string.IsNullOrEmpty(textBoxOppOrg1.Text.Trim()))
                {
                    bill1.OrgNO = textBoxOrgNO.Text.Trim();
                }
                else
                {
                    bill1.OrgNO = textBoxOppOrg1.Text.Trim();
                }
                billList.Add(bill1);
            }
            #endregion

            #region 分录3
            if (!string.IsNullOrEmpty(textBoxInterAcctSN2.Text.Trim()) && !string.IsNullOrEmpty(textBoxSubject2.Text.Trim()))
            {
                CoreBillRecord bill = new CoreBillRecord();
                bill.InnerSN = (billList.Count + 1).ToString();
                //bill1.TradeAcct = textBoxTradeAcct1.Text.Trim();
                bill.Currency = textBoxCurrency2.Text.Trim();
                bill.InterAcctSN = textBoxInterAcctSN2.Text.Trim();
                bill.Subject = textBoxSubject2.Text.Trim();
                bill.OptAcct = textBoxOptAcct2.Text.Trim();
                bill.TradeMoney = textBoxMoney2.Text.Trim();
                bill.Opt = radioButtonBorrow2.Checked ? "1" : "2";
                string flag = "1";
                if (radioButtonFlagRed2.Checked)
                {
                    flag = "2";
                }
                else if (radioButtonFlagBlue2.Checked)
                {
                    flag = "3";
                }
                bill.RedBlueFlag = flag;
                //bill.Opt = "2";
                if (!radioButtonNor2.Checked)
                {
                    bill.IsEliminateFlag = radioButtonRecord2.Checked ? "1" : "2";
                    if (radioButtonRemove2.Checked)
                    {
                        bill.PendingAcctSN = textBoxRemove2.Text;
                    }
                }
                if (string.IsNullOrEmpty(textBoxOppOrg2.Text.Trim()))
                {
                    bill.OrgNO = textBoxOrgNO.Text.Trim();
                }
                else
                {
                    bill.OrgNO = textBoxOppOrg2.Text.Trim();
                }
                billList.Add(bill);
            }
            #endregion

            #region 分录4
            if (!string.IsNullOrEmpty(textBoxInterAcctSN3.Text.Trim()) && !string.IsNullOrEmpty(textBoxSubject3.Text.Trim()))
            {
                CoreBillRecord bill = new CoreBillRecord();
                bill.InnerSN = (billList.Count + 1).ToString();
                bill.Currency = textBoxCurrency3.Text.Trim();
                bill.InterAcctSN = textBoxInterAcctSN3.Text.Trim();
                bill.Subject = textBoxSubject3.Text.Trim();
                bill.OptAcct = textBoxOptAcct3.Text.Trim();
                bill.TradeMoney = textBoxMoney3.Text.Trim();
                bill.Opt = radioButtonBorrow3.Checked ? "1" : "2";
                string flag = "1";
                if (radioButtonFlagRed3.Checked)
                {
                    flag = "2";
                }
                else if (radioButtonFlagBlue3.Checked)
                {
                    flag = "3";
                }
                bill.RedBlueFlag = flag;
                if (!radioButtonNor3.Checked)
                {
                    bill.IsEliminateFlag = radioButtonRecord3.Checked ? "1" : "2";
                    if (radioButtonRemove3.Checked)
                    {
                        bill.PendingAcctSN = textBoxRemove3.Text;
                    }
                }
                if (string.IsNullOrEmpty(textBoxOppOrg3.Text.Trim()))
                {
                    bill.OrgNO = textBoxOrgNO.Text.Trim();
                }
                else
                {
                    bill.OrgNO = textBoxOppOrg3.Text.Trim();
                }
                billList.Add(bill);
            }
            #endregion
            #region 分录5
            if (!string.IsNullOrEmpty(textBoxInterAcctSN4.Text.Trim()) && !string.IsNullOrEmpty(textBoxSubject4.Text.Trim()))
            {
                CoreBillRecord bill = new CoreBillRecord();
                bill.InnerSN = (billList.Count + 1).ToString();
                bill.Currency = textBoxCurrency4.Text.Trim();
                bill.InterAcctSN = textBoxInterAcctSN4.Text.Trim();
                bill.Subject = textBoxSubject4.Text.Trim();
                bill.OptAcct = textBoxOptAcct4.Text.Trim();
                bill.TradeMoney = textBoxMoney4.Text.Trim();
                bill.Opt = radioButtonBorrow4.Checked ? "1" : "2";
                string flag = "1";
                if (radioButtonFlagRed4.Checked)
                {
                    flag = "2";
                }
                else if (radioButtonFlagBlue4.Checked)
                {
                    flag = "3";
                }
                bill.RedBlueFlag = flag;
                if (!radioButtonNor4.Checked)
                {
                    bill.IsEliminateFlag = radioButtonRecord4.Checked ? "1" : "2";
                    if (radioButtonRemove4.Checked)
                    {
                        bill.PendingAcctSN = textBoxRemove4.Text;
                    }
                }
                if (string.IsNullOrEmpty(textBoxOppOrg4.Text.Trim()))
                {
                    bill.OrgNO = textBoxOrgNO.Text.Trim();
                }
                else
                {
                    bill.OrgNO = textBoxOppOrg4.Text.Trim();
                }
                billList.Add(bill);
            }
            #endregion

            #region 分录6
            if (!string.IsNullOrEmpty(textBoxInterAcctSN5.Text.Trim()) && !string.IsNullOrEmpty(textBoxSubject5.Text.Trim()))
            {
                CoreBillRecord bill = new CoreBillRecord();
                bill.InnerSN = (billList.Count + 1).ToString();
                bill.Currency = textBoxCurrency5.Text.Trim();
                bill.InterAcctSN = textBoxInterAcctSN5.Text.Trim();
                bill.Subject = textBoxSubject5.Text.Trim();
                bill.OptAcct = textBoxOptAcct5.Text.Trim();
                bill.TradeMoney = textBoxMoney5.Text.Trim();
                bill.Opt = radioButtonBorrow5.Checked ? "1" : "2";
                string flag = "1";
                if (radioButtonFlagRed5.Checked)
                {
                    flag = "2";
                }
                else if (radioButtonFlagBlue5.Checked)
                {
                    flag = "3";
                }
                bill.RedBlueFlag = flag;
                if (!radioButtonNor5.Checked)
                {
                    bill.IsEliminateFlag = radioButtonRecord5.Checked ? "1" : "2";
                    if (radioButtonRemove5.Checked)
                    {
                        bill.PendingAcctSN = textBoxRemove5.Text;
                    }
                }
                if (string.IsNullOrEmpty(textBoxOppOrg5.Text.Trim()))
                {
                    bill.OrgNO = textBoxOrgNO.Text.Trim();
                }
                else
                {
                    bill.OrgNO = textBoxOppOrg5.Text.Trim();
                }
                billList.Add(bill);
            }
            #endregion
            #region 分录7
            if (!string.IsNullOrEmpty(textBoxInterAcctSN6.Text.Trim()) && !string.IsNullOrEmpty(textBoxSubject6.Text.Trim()))
            {
                CoreBillRecord bill = new CoreBillRecord();
                bill.InnerSN = (billList.Count + 1).ToString();
                bill.Currency = textBoxCurrency6.Text.Trim();
                bill.InterAcctSN = textBoxInterAcctSN6.Text.Trim();
                bill.Subject = textBoxSubject6.Text.Trim();
                bill.OptAcct = textBoxOptAcct6.Text.Trim();
                bill.TradeMoney = textBoxMoney6.Text.Trim();
                bill.Opt = radioButtonBorrow6.Checked ? "1" : "2";

                if (!radioButtonNor6.Checked)
                {
                    bill.IsEliminateFlag = radioButtonRecord6.Checked ? "1" : "2";
                    if (radioButtonRemove6.Checked)
                    {
                        bill.PendingAcctSN = textBoxRemove6.Text;
                    }
                }
                bill.OrgNO = textBoxOrgNO.Text.Trim();
                billList.Add(bill);
            }
            #endregion

            #region 分录8
            if (!string.IsNullOrEmpty(textBoxInterAcctSN7.Text.Trim()) && !string.IsNullOrEmpty(textBoxSubject7.Text.Trim()))
            {
                CoreBillRecord bill = new CoreBillRecord();
                bill.InnerSN = (billList.Count + 1).ToString();
                bill.Currency = textBoxCurrency7.Text.Trim();
                bill.InterAcctSN = textBoxInterAcctSN7.Text.Trim();
                bill.Subject = textBoxSubject7.Text.Trim();
                bill.OptAcct = textBoxOptAcct7.Text.Trim();
                bill.TradeMoney = textBoxMoney7.Text.Trim();
                bill.Opt = radioButtonBorrow7.Checked ? "1" : "2";
                if (!radioButtonNor7.Checked)
                {
                    bill.IsEliminateFlag = radioButtonRecord7.Checked ? "1" : "2";
                    if (radioButtonRemove7.Checked)
                    {
                        bill.PendingAcctSN = textBoxRemove7.Text;
                    }
                }
                bill.OrgNO = textBoxOrgNO.Text.Trim();
                billList.Add(bill);
            }
            #endregion

            #region 分录9
            if (!string.IsNullOrEmpty(textBoxInterAcctSN8.Text.Trim()) && !string.IsNullOrEmpty(textBoxSubject8.Text.Trim()))
            {
                CoreBillRecord bill = new CoreBillRecord();
                bill.InnerSN = (billList.Count + 1).ToString();
                bill.Currency = textBoxCurrency8.Text.Trim();
                bill.InterAcctSN = textBoxInterAcctSN8.Text.Trim();
                bill.Subject = textBoxSubject8.Text.Trim();
                bill.OptAcct = textBoxOptAcct8.Text.Trim();
                bill.TradeMoney = textBoxMoney8.Text.Trim();
                bill.Opt = radioButtonBorrow8.Checked ? "1" : "2";
                if (!radioButtonNor8.Checked)
                {
                    bill.IsEliminateFlag = radioButtonRecord8.Checked ? "1" : "2";
                    if (radioButtonRemove8.Checked)
                    {
                        bill.PendingAcctSN = textBoxRemove8.Text;
                    }
                }
                bill.OrgNO = textBoxOrgNO.Text.Trim();
                billList.Add(bill);
            }
            #endregion

            return billList;
        }
        private List<CoreBillRecord> GetAccoutingEntry()
        {
            List<CoreBillRecord> billList = new List<CoreBillRecord>();
            //记账1
            CoreBillRecord bill = new CoreBillRecord();
            bill.InnerSN = (billList.Count + 1).ToString();
            //bill.TradeAcct = textBoxTradeAcct.Text.Trim();
            bill.Currency = textBoxCurrency.Text.Trim();
            bill.InterAcctSN = textBoxInterAcctSN.Text.Trim();
            bill.Subject = textBoxSubject.Text.Trim();
            bill.OptAcct = textBoxOptAcct.Text.Trim();
            bill.TradeMoney = textBoxMoney.Text.Trim();
            bill.Opt = radioButtonBorrow.Checked ? "1" : "2";
            
            if (!radioButtonNor.Checked)
            {
                bill.IsEliminateFlag = radioButtonRecord.Checked ? "1" : "2";
                if (radioButtonRemove.Checked)
                {
                    bill.PendingAcctSN = textBoxRemove.Text;
                }
            }
            bill.OrgNO = textBoxOrgNO.Text.Trim();
            billList.Add(bill);     
            

            //记账2
            CoreBillRecord bill1 = new CoreBillRecord();            
            bill1.InnerSN = (billList.Count + 1).ToString();
            //bill1.TradeAcct = textBoxTradeAcct1.Text.Trim();
            bill1.Currency = textBoxCurrency1.Text.Trim();
            bill1.InterAcctSN = textBoxInterAcctSN1.Text.Trim();
            bill1.Subject = textBoxSubject1.Text.Trim();
            bill1.OptAcct = textBoxOptAcct1.Text.Trim();
            bill1.TradeMoney = textBoxMoney1.Text.Trim();
            bill1.Opt = radioButtonBorrow1.Checked ? "1" : "2";
            //bill.Opt = "2";
            if (!radioButtonNor1.Checked)
            {
                bill1.IsEliminateFlag = radioButtonRecord1.Checked ? "1" : "2";
                if (radioButtonRemove1.Checked)
                {
                    bill1.PendingAcctSN = textBoxRemove1.Text;
                }
            }
            bill1.OrgNO = textBoxOrgNO.Text.Trim();
            billList.Add(bill1);

            return billList;
        }