예제 #1
0
        /// <summary>
        /// 收款明细
        /// </summary>
        /// <param name="ctx"></param>
        /// <param name="data"></param>
        /// <returns></returns>
        private JArray BuildReceiveBillEntry(Context ctx, AbsSynchroDataInfo data)
        {
            JArray  FRECEIVEBILLENTRY = null;
            JObject baseData          = null;

            if (data != null)
            {
                if (data.GetType() == typeof(K3SalOrderInfo))
                {
                    K3SalOrderInfo order = data as K3SalOrderInfo;

                    FRECEIVEBILLENTRY = new JArray();
                    baseData          = new JObject();

                    JObject FSETTLETYPEID = new JObject();//结算方式"JSFS01_SYS"
                    FSETTLETYPEID.Add("FNumber", SQLUtils.GetSettleTypeNo(K3CloudContext, SQLUtils.GetPaymentMethodId(K3CloudContext, order.F_HS_PaymentModeNew)));
                    baseData.Add("FSETTLETYPEID", FSETTLETYPEID);

                    JObject FPURPOSEID = new JObject();//收款用途
                    FPURPOSEID.Add("FNumber", "SFKYT02_SYS");
                    baseData.Add("FPURPOSEID", FPURPOSEID);

                    baseData.Add("FRECEIVEITEMTYPE", "1");                                                //预收项目类型
                    baseData.Add("FRECEIVEITEM", order.FBillNo);                                          //销售订单
                    baseData.Add("FSaleOrderID", SQLUtils.GetSaleOrderId(K3CloudContext, order.FBillNo)); //销售订单内码


                    if (Convert.ToDecimal(order.F_HS_PayTotal) > 0)
                    {
                        if (order.FSettleCurrId.CompareTo("JPY") == 0)
                        {
                            baseData.Add("FRECTOTALAMOUNTFOR", Math.Truncate(Convert.ToDecimal(order.F_HS_PayTotal) * order.F_HS_RateToUSA));//财务实收金额
                        }
                        else
                        {
                            baseData.Add("FRECTOTALAMOUNTFOR", Convert.ToDecimal(order.F_HS_PayTotal) * order.F_HS_RateToUSA);//财务实收金额
                        }
                    }
                    else if (string.IsNullOrWhiteSpace(order.F_HS_PayTotal))
                    {
                        if (order.FSettleCurrId.CompareTo("JPY") == 0)
                        {
                            baseData.Add("FRECTOTALAMOUNTFOR", Math.Truncate(order.F_HS_Total));//财务实收金额
                        }
                        else
                        {
                            baseData.Add("FRECTOTALAMOUNTFOR", order.F_HS_Total);//财务实收金额
                        }
                    }

                    JObject FACCOUNTID = new JObject();//我方银行账号
                    FACCOUNTID.Add("FNumber", SQLUtils.GetBankAccountNo(K3CloudContext, SQLUtils.GetBankAccountId(K3CloudContext, order.F_HS_PaymentModeNew)));
                    baseData.Add("FACCOUNTID", FACCOUNTID);

                    baseData.Add("FSETTLENO", order.F_HS_TransactionID.Trim());//结算号

                    FRECEIVEBILLENTRY.Add(baseData);
                }
                else if (data.GetType() == typeof(AbsDataInfo))
                {
                    AbsDataInfo info = data as AbsDataInfo;

                    FRECEIVEBILLENTRY = new JArray();
                    baseData          = new JObject();

                    JObject FSETTLETYPEID = new JObject();//结算方式"JSFS01_SYS"
                    FSETTLETYPEID.Add("FNumber", info.FSettleTypeId);
                    baseData.Add("FSETTLETYPEID", FSETTLETYPEID);

                    JObject FPURPOSEID = new JObject();//收款用途
                    FPURPOSEID.Add("FNumber", "SFKYT02_SYS");
                    baseData.Add("FPURPOSEID", FPURPOSEID);

                    if (Convert.ToDecimal(info.FRealAmountFor) > 0)
                    {
                        baseData.Add("FRECTOTALAMOUNTFOR", info.FRealAmountFor);//财务实收金额
                    }

                    JObject FACCOUNTID = new JObject();//我方银行账号
                    FACCOUNTID.Add("FNumber", SQLUtils.GetBankAccountNo(K3CloudContext, SQLUtils.GetBankAccountId(K3CloudContext, info.FSettleTypeId)));
                    baseData.Add("FACCOUNTID", FACCOUNTID);

                    baseData.Add("FSETTLENO", "");//结算号
                    baseData.Add("F_HS_YNRecharge", false);
                    baseData.Add("F_HS_SynchronizedRecharge", false);

                    FRECEIVEBILLENTRY.Add(baseData);
                }
            }

            return(FRECEIVEBILLENTRY);
        }