Ejemplo n.º 1
0
 public BMKH_Edit()
 {
     this.khlogical      = new BMKHManager();
     this.invoiceHandler = new InvoiceHandler();
     this.khModel        = new BMKHModel();
     this.Initialize();
 }
Ejemplo n.º 2
0
        /// <summary>
        /// Executes the plug-in.
        /// </summary>
        /// <param name="localContext">The <see cref="LocalPluginContext"/> which contains the
        /// <see cref="IPluginExecutionContext"/>,
        /// <see cref="IOrganizationService"/>
        /// and <see cref="ITracingService"/>
        /// </param>
        /// <remarks>
        /// For improved performance, Microsoft Dynamics CRM caches plug-in instances.
        /// The plug-in's Execute method should be written to be stateless as the constructor
        /// is not called for every invocation of the plug-in. Also, multiple system threads
        /// could execute the plug-in at the same time. All per invocation state information
        /// is stored in the context. This means that you should not use global variables in plug-ins.
        /// </remarks>
        protected void ExecutePreInvoiceCreate(LocalPluginContext localContext)
        {
            if (localContext == null)
            {
                throw new ArgumentNullException("localContext");
            }

            IPluginExecutionContext context = localContext.PluginExecutionContext;
            IOrganizationService    service = localContext.OrganizationService;
            ITracingService         trace   = localContext.TracingService;
            Entity invoiceEntity            = (Entity)context.InputParameters["Target"];

            string message = context.MessageName;
            string error   = "";

            try
            {
                InvoiceHandler invoiceHandler = new InvoiceHandler(service, trace);

                if (invoiceHandler.IsInvoiceExists(invoiceEntity))
                {
                    throw new InvalidPluginExecutionException("There is already Invoice created for this Sales Order.");
                }
                invoiceHandler.ReplicateOrderInfo(invoiceEntity);
            }
            catch (Exception ex)
            {
                throw new InvalidPluginExecutionException(String.Concat(ex.Message));
            }
        }
Ejemplo n.º 3
0
 public BMKH_Edit(string BM, bool Isupdate) : base(BM, Isupdate)
 {
     this.khlogical      = new BMKHManager();
     this.invoiceHandler = new InvoiceHandler();
     this.khModel        = new BMKHModel();
     this.Initialize();
     this.InitData();
 }
Ejemplo n.º 4
0
 public BMKH_Edit(string SJBM, BMKH Father) : base(SJBM, Father)
 {
     this.khlogical      = new BMKHManager();
     this.invoiceHandler = new InvoiceHandler();
     this.khModel        = new BMKHModel();
     this.Initialize();
     this.InitData();
 }
Ejemplo n.º 5
0
        public LexOfficeApi(string apiKey)
        {
            // Create Handler with a RestClient
            RestClient client = new RestClient("https://api.lexoffice.io/v1", apiKey);

            VoucherListEndPoint = new VoucherListHandler(client);
            InvoiceEndPoint     = new InvoiceHandler(client);
            ContactsEndPoint    = new ContactsHandler(client);
            VouchersEndPoint    = new VouchersHandler(client);
        }
Ejemplo n.º 6
0
 public BMXHDW_Edit(string SJBM, BMXHDW Father)
 {
     this.sfhrManager    = new BMXHDWManager();
     this.xhdwModel      = new BMXHDWModel();
     this.log            = LogUtil.GetLogger <BMXHDW_Edit>();
     this.invoiceHandler = new InvoiceHandler();
     this._bm            = "";
     this._sjbm          = "";
     this.SuggestBM      = "";
     this.Initialize();
     this._sjbm  = SJBM;
     this.father = Father;
     this.Text   = "销货单位编码添加";
 }
Ejemplo n.º 7
0
 public BMSFHR_Edit(string SJBM, BMSFHR Father)
 {
     this.sfhrManager    = new BMSFHRManager();
     this.sfhrModel      = new BMSFHRModel();
     this.log            = LogUtil.GetLogger <BMSFHR_Edit>();
     this.invoiceHandler = new InvoiceHandler();
     this._bm            = "";
     this._sjbm          = "";
     this.SuggestBM      = "";
     this.Initialize();
     this._sjbm  = SJBM;
     this.father = Father;
     this.Text   = "收/发货人编码添加";
 }
Ejemplo n.º 8
0
        /// <summary>
        /// Executes the plug-in.
        /// </summary>
        /// <param name="localContext">The <see cref="LocalPluginContext"/> which contains the
        /// <see cref="IPluginExecutionContext"/>,
        /// <see cref="IOrganizationService"/>
        /// and <see cref="ITracingService"/>
        /// </param>
        /// <remarks>
        /// For improved performance, Microsoft Dynamics CRM caches plug-in instances.
        /// The plug-in's Execute method should be written to be stateless as the constructor
        /// is not called for every invocation of the plug-in. Also, multiple system threads
        /// could execute the plug-in at the same time. All per invocation state information
        /// is stored in the context. This means that you should not use global variables in plug-ins.
        /// </remarks>
        protected void ExecutePostInvoiceCreate(LocalPluginContext localContext)
        {
            if (localContext == null)
            {
                throw new ArgumentNullException("localContext");
            }

            IPluginExecutionContext context = localContext.PluginExecutionContext;
            IOrganizationService    service = localContext.OrganizationService;
            ITracingService         trace   = localContext.TracingService;
            Entity invoiceEntity            = (Entity)context.InputParameters["Target"];

            string message = context.MessageName;
            string error   = "";

            if (context.Depth > 1)
            {
                return;
            }

            try
            {
                EntityCollection invoiceRecords = CommonHandler.RetrieveRecordsByOneValue("invoice", "invoiceid", invoiceEntity.Id, service, null, OrderType.Ascending,
                                                                                          new[] { "salesorderid", "name" });

                if (invoiceRecords != null && invoiceRecords.Entities.Count > 0)
                {
                    InvoiceHandler invoiceHandler = new InvoiceHandler(service, trace);

                    Entity invoice = invoiceRecords.Entities[0];
                    invoiceHandler.ReplicateSalesInvoiceId(invoice);
                    invoiceHandler.ReplicateAllocatedVehicle(invoice);
                    invoiceHandler.ReplicateMonthlyAmortizations(invoice);
                    invoiceHandler.ReplicateDiscount(invoice);
                    invoiceHandler.ReplicateCoverageAvailable(invoice);
                    invoiceHandler.ReplicateCharge(invoice);
                    invoiceHandler.ReplicateRequirementChecklist(invoice);
                    invoiceHandler.ReplicateAccessories(invoice);
                    invoiceHandler.ReplicateCabChassis(invoice);
                    invoiceHandler.ChangeSOInvoiceCreatedDate(invoice);
                    invoiceHandler.UpdateSOStatus(invoice);
                }
            }
            catch (Exception ex)
            {
                //throw new InvalidPluginExecutionException(String.Concat("(Exception)\n", ex.Message, Environment.NewLine, ex.StackTrace, Environment.NewLine, error));
                throw new InvalidPluginExecutionException(ex.Message);
            }
        }
Ejemplo n.º 9
0
 public BMXHDW_Edit(string BM, bool Isupdate)
 {
     this.sfhrManager    = new BMXHDWManager();
     this.xhdwModel      = new BMXHDWModel();
     this.log            = LogUtil.GetLogger <BMXHDW_Edit>();
     this.invoiceHandler = new InvoiceHandler();
     this._bm            = "";
     this._sjbm          = "";
     this.SuggestBM      = "";
     this.Initialize();
     this._bm      = BM;
     this.yuanBM   = BM;
     this.isUpdate = Isupdate;
     this.Text     = "销货单位编码编辑";
 }
Ejemplo n.º 10
0
        /// <summary>
        /// Executes the plug-in.
        /// </summary>
        /// <param name="localContext">The <see cref="LocalPluginContext"/> which contains the
        /// <see cref="IPluginExecutionContext"/>,
        /// <see cref="IOrganizationService"/>
        /// and <see cref="ITracingService"/>
        /// </param>
        /// <remarks>
        /// For improved performance, Microsoft Dynamics CRM caches plug-in instances.
        /// The plug-in's Execute method should be written to be stateless as the constructor
        /// is not called for every invocation of the plug-in. Also, multiple system threads
        /// could execute the plug-in at the same time. All per invocation state information
        /// is stored in the context. This means that you should not use global variables in plug-ins.
        /// </remarks>
        protected void ExecutePreValidateInvoiceDelete(LocalPluginContext localContext)
        {
            if (localContext == null)
            {
                throw new ArgumentNullException("localContext");
            }

            IPluginExecutionContext context = localContext.PluginExecutionContext;
            IOrganizationService    service = localContext.OrganizationService;
            ITracingService         trace   = localContext.TracingService;
            var    SalesInvoiceTargetEntity = (EntityReference)context.InputParameters["Target"];
            string message = context.MessageName;
            string error   = "";

            if (context.Depth > 1)
            {
                return;
            }

            try
            {
                InvoiceHandler InvoiceHandler = new InvoiceHandler(service, trace);

                EntityCollection InvoiceCollection = CommonHandler.RetrieveRecordsByOneValue(SalesInvoiceTargetEntity.LogicalName, "invoiceid", SalesInvoiceTargetEntity.Id, service,
                                                                                             null, OrderType.Ascending, new[] { "invoiceid", "gsc_salesinvoicestatus", "salesorderid" });

                if (InvoiceCollection.Entities.Count > 0)
                {
                    if (InvoiceHandler.ValidateDelete(InvoiceCollection.Entities[0]) == true)
                    {
                        throw new InvalidPluginExecutionException("Unable to delete invoice record(s). Only record(s) with open status can be deleted.");
                    }
                    InvoiceHandler.DeleteOpenInvoice(InvoiceCollection.Entities[0]);
                }
            }
            catch (Exception ex)
            {
                if (ex.Message.Contains("Unable to delete invoice record(s). Only record(s) with open status can be deleted."))
                {
                    throw new InvalidPluginExecutionException(ex.Message);
                }
                else
                {
                    throw new InvalidPluginExecutionException(String.Concat("(Exception)\n", ex.Message, Environment.NewLine, ex.StackTrace, Environment.NewLine, error));
                }
            }
        }
Ejemplo n.º 11
0
 public IHttpActionResult GetInvoicesHasItems()
 {
     return(Ok(InvoiceHandler.GetAllInvoicesHasItems(db)));
 }
Ejemplo n.º 12
0
 public IHttpActionResult GetInvoicesFromStore()
 {
     return(Ok(InvoiceHandler.GetAllInvoiceIDsFromStores(db)));
 }
Ejemplo n.º 13
0
        /// <summary>
        /// Executes the plug-in.
        /// </summary>
        /// <param name="localContext">The <see cref="LocalPluginContext"/> which contains the
        /// <see cref="IPluginExecutionContext"/>,
        /// <see cref="IOrganizationService"/>
        /// and <see cref="ITracingService"/>
        /// </param>
        /// <remarks>
        /// For improved performance, Microsoft Dynamics CRM caches plug-in instances.
        /// The plug-in's Execute method should be written to be stateless as the constructor
        /// is not called for every invocation of the plug-in. Also, multiple system threads
        /// could execute the plug-in at the same time. All per invocation state information
        /// is stored in the context. This means that you should not use global variables in plug-ins.
        /// </remarks>
        protected void ExecutePostInvoiceUpdate(LocalPluginContext localContext)
        {
            if (localContext == null)
            {
                throw new ArgumentNullException("localContext");
            }

            IPluginExecutionContext context = localContext.PluginExecutionContext;

            Entity preImageEntity  = (context.PreEntityImages != null && context.PreEntityImages.Contains(this.preImageAlias)) ? context.PreEntityImages[this.preImageAlias] : null;
            Entity postImageEntity = (context.PostEntityImages != null && context.PostEntityImages.Contains(this.postImageAlias)) ? context.PostEntityImages[this.postImageAlias] : null;

            IOrganizationService service = localContext.OrganizationService;
            ITracingService      trace   = localContext.TracingService;
            Entity invoice = (Entity)context.InputParameters["Target"];

            if (!(context.InputParameters.Contains("Target") && context.InputParameters["Target"] is Entity))
            {
                return;
            }

            if (invoice.LogicalName != "invoice")
            {
                return;
            }

            if (context.Mode == 0) //Synchronous Plug-in
            {
                string message = context.MessageName;

                try
                {
                    #region Pre-images

                    var preImageCancelSO = preImageEntity.Contains("gsc_cancelorder")
                        ? preImageEntity.GetAttributeValue <String>("gsc_cancelorder")
                        : String.Empty;

                    var preImageSalesInvoiceStatus = preImageEntity.Contains("gsc_salesinvoicestatus") ?
                                                     preImageEntity.GetAttributeValue <OptionSetValue>("gsc_salesinvoicestatus").Value
                        : 0;

                    var preImageSalesInvoiceCopy = preImageEntity.Contains("gsc_invoicestatuscopy")
                        ? preImageEntity.GetAttributeValue <OptionSetValue>("gsc_invoicestatuscopy").Value
                        : 0;

                    var preImageInvoiceId = preImageEntity.Contains("name")
                        ? preImageEntity.GetAttributeValue <String>("name")
                        : String.Empty;

                    var preImageisDeliveryReceiptandGatePass = preImageEntity.GetAttributeValue <Boolean>("gsc_isdeliveryreceiptandgatepass");

                    #endregion

                    #region Post-images

                    var postImageCancelSO = postImageEntity.Contains("gsc_cancelorder")
                        ? postImageEntity.GetAttributeValue <String>("gsc_cancelorder")
                        : String.Empty;

                    var postImageSalesInvoiceStatus = postImageEntity.Contains("gsc_salesinvoicestatus")
                        ? postImageEntity.GetAttributeValue <OptionSetValue>("gsc_salesinvoicestatus").Value
                        : 0;

                    var postImageSalesInvoiceCopy = postImageEntity.Contains("gsc_invoicestatuscopy")
                        ? postImageEntity.GetAttributeValue <OptionSetValue>("gsc_invoicestatuscopy").Value
                        : 0;

                    var postImageInvoiceId = postImageEntity.Contains("name")
                        ? postImageEntity.GetAttributeValue <String>("name")
                        : String.Empty;

                    var postImageisDeliveryReceiptandGatePass = postImageEntity.GetAttributeValue <Boolean>("gsc_isdeliveryreceiptandgatepass");

                    var postCancelled = postImageEntity.GetAttributeValue <Boolean>("gsc_cancelled");

                    #endregion

                    InvoiceHandler invoiceHandler = new InvoiceHandler(service, trace);

                    if (preImageCancelSO != postImageCancelSO)
                    {
                        invoiceHandler.SetOrderCancelledStatus(postImageEntity);
                    }

                    if (preImageSalesInvoiceCopy != postImageSalesInvoiceCopy)
                    {
                        invoiceHandler.UpdateStatus(postImageEntity);
                    }

                    if (preImageSalesInvoiceStatus != postImageSalesInvoiceStatus)
                    {
                        if (postCancelled != true)
                        {
                            invoiceHandler.SetInvoiceCancelledStatus(postImageEntity);
                        }

                        invoiceHandler.DeleteInvoicedVehicle(postImageEntity);
                        invoiceHandler.CreateVehicleClaimAndDiscounts(postImageEntity);
                        invoiceHandler.UpdateInvoicedStatus(postImageEntity);
                        invoiceHandler.UpdatedPrintedStatus(postImageEntity);
                        invoiceHandler.PostInvoice(postImageEntity);
                        invoiceHandler.AdjustProductQuantity(postImageEntity);

                        if (postImageSalesInvoiceStatus == 100000003) //If from DR and GatePass, status = Printed
                        {
                            //if (!invoiceHandler.ValidateSubmitDRandGatePass(postImageEntity))
                            //{
                            //    throw new InvalidPluginExecutionException("Record cannot be printed because PDI has not yet been completed.");
                            //}
                        }

                        // Create Transacted Vehicle When Invoice Status Is Released
                        if (postImageSalesInvoiceStatus == 100000004)
                        {
                            invoiceHandler.CreateTransactedVehicle(postImageEntity);
                            invoiceHandler.CreateSoldInventoryHistory(postImageEntity);
                        }
                    }

                    if (preImageInvoiceId != postImageInvoiceId)
                    {
                        invoiceHandler.CheckInvoiceIdIfDuplicate(postImageEntity);
                    }

                    if (preImageisDeliveryReceiptandGatePass != postImageisDeliveryReceiptandGatePass)
                    {
                        invoiceHandler.DeliveryReceiptandGatePassIdSequenceGen(postImageEntity);
                        //throw new InvalidPluginExecutionException("TEST");
                    }
                }

                catch (Exception ex)
                {
                    throw new InvalidPluginExecutionException(ex.Message);
                    // throw new InvalidPluginExecutionException(String.Concat("(Exception)\n", ex.Message, Environment.NewLine, ex.StackTrace));
                }
            }
        }
Ejemplo n.º 14
0
        protected DataDict DictCreate_ZYAndPT(params object[] args)
        {
            Fpxx dyfp = base.dyfp;

            dyfp         = new InvoiceHandler().ConvertInvoiceToZH(dyfp);
            base._isZYPT = true;
            if (dyfp == null)
            {
                base._isPrint = "0006";
                return(null);
            }
            Dictionary <string, object> dict = new Dictionary <string, object>();

            if (dyfp.fplx == FPLX.PTFP)
            {
                base.ZYFPLX = "c";
            }
            else
            {
                base.ZYFPLX = "s";
            }
            dict.Add("lbdm", dyfp.fpdm);
            dict.Add("fphm", dyfp.fphm);
            string str3 = ToolUtil.FormatDateTimeEx(dyfp.kprq);

            dyfp.kprq = Aisino.Fwkp.Print.Common.ObjectToDateTime(str3).Date.ToString("yyyy年MM月dd日");
            dict.Add("kprq", dyfp.kprq);
            DateTime time3 = new DateTime(0x7dd, 9, 10, 8, 0x22, 30);
            TimeSpan span  = (TimeSpan)(DateTime.Now - time3);

            byte[] buffer = AES_Crypt.Encrypt(ToolUtil.GetBytes(span.TotalSeconds.ToString("F1")), new byte[] {
                0xff, 0x42, 0xae, 0x95, 11, 0x51, 0xca, 0x15, 0x21, 140, 0x4f, 170, 220, 0x92, 170, 0xed,
                0xfd, 0xeb, 0x4e, 13, 0xac, 0x80, 0x52, 0xff, 0x45, 0x90, 0x85, 0xca, 0xcb, 0x9f, 0xaf, 0xbd
            }, new byte[] { 0xf2, 0x1f, 0xac, 0x5b, 0x2c, 0xc0, 0xa9, 0xd0, 0xbc, 0xaf, 0x86, 0x99, 0xad, 170, 0xfb, 0x60 });
            if (!base.IsFirstCreate)
            {
                dyfp.Get_Print_Dj(null, 0, buffer);
                base.IsFirstCreate = true;
            }
            if (dyfp.hzfw)
            {
                dict.Add("hxm", dyfp.hxm);
                base._IsHZFW = true;
            }
            else
            {
                dict.Add("mw", dyfp.mw);
                base._IsHZFW = false;
            }
            dict.Add("bz", dyfp.bz);
            dict.Add("hjje", dyfp.je);
            Aisino.Fwkp.Print.Common.GetYYSBZ(ref dyfp);
            if (dyfp.sLv == "0")
            {
                dict.Add("hjse", "***");
            }
            else
            {
                string str2 = ((char)0xffe5) + dyfp.se;
                dict.Add("hjse", str2);
            }
            decimal num2 = Convert.ToDecimal(dyfp.je) + Convert.ToDecimal(dyfp.se);

            dict.Add("jshjxx", num2);
            dict.Add("jshjdx", ToolUtil.RMBToDaXie(num2));
            dict.Add("kpr", dyfp.kpr);
            dict.Add("fhr", dyfp.fhr);
            dict.Add("skr", dyfp.skr);
            dict.Add("jmbb", "加密版本:");
            dict.Add("jmbbh", dyfp.jmbbh);
            dict.Add("list", this.method_7(dyfp));
            dict.Add("gfmc", dyfp.gfmc);
            dict.Add("gfsh", dyfp.gfsh);
            dict.Add("gfdzdh", dyfp.gfdzdh);
            dict.Add("gfyhzh", dyfp.gfyhzh);
            dict.Add("xfmc", dyfp.xfmc);
            dict.Add("xfsh", dyfp.xfsh);
            dict.Add("xfdzdh", dyfp.xfdzdh);
            dict.Add("xfyhzh", dyfp.xfyhzh);
            if (dyfp.isRed)
            {
                dict.Add("xxfs", "销项负数");
            }
            if (dyfp.zfbz)
            {
                dict.Add("zfbz", "作废");
            }
            string yysbz = dyfp.yysbz;
            bool   flag  = false;

            if (yysbz.Length > 2)
            {
                switch (yysbz[2])
                {
                case '1':
                case '2':
                    flag = true;
                    break;
                }
            }
            if (flag)
            {
                dict.Add("xtbz", "XT");
            }
            if (dyfp.fplx == FPLX.PTFP)
            {
                dict.Add("jym", dyfp.jym);
            }
            switch (dyfp.fplx)
            {
            case FPLX.ZYFP:
                if (!dyfp.hzfw)
                {
                    if (Aisino.Fwkp.Print.Common.IsShuiWuDKSQ(""))
                    {
                        dict.Add("xtbz", "代  开");
                    }
                    if (dyfp.mw.Length < 0x5b)
                    {
                        base.Id = this.string_3;
                    }
                    else
                    {
                        base.Id = this.string_4;
                    }
                }
                else
                {
                    base.Id = this.string_5;
                }
                goto Label_04AA;

            case FPLX.PTFP:
                if (dyfp.Zyfplx != ZYFP_LX.NCP_SG)
                {
                    if (dyfp.Zyfplx == ZYFP_LX.NCP_XS)
                    {
                        dict.Add("ncpfp", "农产品销售");
                    }
                    else if (Aisino.Fwkp.Print.Common.IsShuiWuDKSQ(""))
                    {
                        dict.Add("dkbz", "代  开");
                    }
                    break;
                }
                dict.Add("ncpfp", "收  购");
                break;

            default:
                goto Label_04AA;
            }
            if (dyfp.hzfw)
            {
                base.Id = this.string_2;
            }
            else if (dyfp.mw.Length < 0x5b)
            {
                base.Id = this.string_0;
            }
            else
            {
                base.Id = this.string_1;
            }
Label_04AA:
            return(new DataDict(dict));
        }
Ejemplo n.º 15
0
        protected DataDict DictCreate_JP(params object[] args)
        {
            Fpxx dyfp = base.dyfp;

            dyfp         = new InvoiceHandler().ConvertInvoiceToZH(dyfp);
            base._isZYPT = true;
            if (dyfp != null)
            {
                Dictionary <string, object> dict = new Dictionary <string, object>();
                dict.Add("fpdm", dyfp.fpdm);
                dict.Add("fphm", dyfp.fphm);
                dict.Add("xfmc", dyfp.xfmc);
                dict.Add("xfsh", dyfp.xfsh);
                dict.Add("jqbh", dyfp.jqbh);
                string str3 = ToolUtil.FormatDateTimeEx(dyfp.kprq);
                dyfp.kprq = Aisino.Fwkp.Print.Common.ObjectToDateTime(str3).Date.ToString("yyyy-MM-dd");
                dict.Add("kprq", dyfp.kprq);
                dict.Add("skr", dyfp.skr);
                dict.Add("gfmc", dyfp.gfmc);
                dict.Add("gfsh", dyfp.gfsh);
                dict.Add("hjje", ((char)0xffe5) + dyfp.je);
                dict.Add("hjse", ((char)0xffe5) + dyfp.se);
                decimal num2 = Convert.ToDecimal(dyfp.je) + Convert.ToDecimal(dyfp.se);
                dict.Add("jshjxx", ((char)0xffe5) + num2.ToString());
                dict.Add("jshjdx", ToolUtil.RMBToDaXie(num2));
                dict.Add("jym", dyfp.jym);
                base.Id = "";
                int    num  = Convert.ToInt32(dyfp.yysbz.Substring(6, 2), 0x10) - 1;
                string str2 = "NEW76mmX177mm";
                Dictionary <string, int> jsPrintTemplate = ToolUtil.GetJsPrintTemplate();
                if (jsPrintTemplate.Count > 0)
                {
                    foreach (string str in jsPrintTemplate.Keys)
                    {
                        if (jsPrintTemplate[str] == num)
                        {
                            str2 = str;
                        }
                    }
                    if ((num >= 0) && (num <= 10))
                    {
                        string    str5   = this.method_9(dyfp);
                        DataTable table3 = this.method_8(dyfp, 0);
                        if (str5 == "H")
                        {
                            dict.Add("list", table3);
                            base.Id = str2 + "H";
                        }
                        else
                        {
                            dict.Add("hwmc", table3.Rows[0]["hwmc"]);
                            dict.Add("dj", table3.Rows[0]["dj"]);
                            dict.Add("sl", table3.Rows[0]["sl"]);
                            dict.Add("je", table3.Rows[0]["je"]);
                            base.Id = str2 + "V";
                        }
                    }
                    else
                    {
                        DataTable table2 = this.method_8(dyfp, 0);
                        dict.Add("list", table2);
                        base.Id = str2;
                    }
                }
                else
                {
                    string    str6  = this.method_9(dyfp);
                    DataTable table = this.method_8(dyfp, 0);
                    if (str6 == "H")
                    {
                        dict.Add("list", table);
                        base.Id = PrintTemplate.NEW76mmX177mm.ToString() + "H";
                    }
                    else
                    {
                        dict.Add("hwmc", table.Rows[0]["hwmc"]);
                        dict.Add("dj", table.Rows[0]["dj"]);
                        dict.Add("sl", table.Rows[0]["sl"]);
                        dict.Add("je", table.Rows[0]["je"]);
                        base.Id = PrintTemplate.NEW76mmX177mm.ToString() + "V";
                    }
                }
                return(new DataDict(dict));
            }
            base._isPrint = "0006";
            return(null);
        }
Ejemplo n.º 16
0
        protected DataDict DictCreate_JDCFP(params object[] args)
        {
            Fpxx dyfp = base.dyfp;

            dyfp         = new InvoiceHandler().ConvertInvoiceToZH(dyfp);
            base._isZYPT = false;
            Dictionary <string, object> dict = new Dictionary <string, object>();

            if (dyfp != null)
            {
                dict.Add("lbdm", dyfp.fpdm);
                dict.Add("fphm", dyfp.fphm);
                dict.Add("jqbh", dyfp.jqbh);
                string str5 = ToolUtil.FormatDateTimeEx(dyfp.kprq);
                dyfp.kprq = Aisino.Fwkp.Print.Common.ObjectToDateTime(str5).Date.ToString("yyyy-MM-dd");
                dict.Add("kprq", dyfp.kprq);
                DateTime time3  = new DateTime(0x7dd, 9, 10, 8, 0x22, 30);
                TimeSpan span   = (TimeSpan)(DateTime.Now - time3);
                byte[]   buffer = AES_Crypt.Encrypt(ToolUtil.GetBytes(span.TotalSeconds.ToString("F1")), new byte[] {
                    0xff, 0x42, 0xae, 0x95, 11, 0x51, 0xca, 0x15, 0x21, 140, 0x4f, 170, 220, 0x92, 170, 0xed,
                    0xfd, 0xeb, 0x4e, 13, 0xac, 0x80, 0x52, 0xff, 0x45, 0x90, 0x85, 0xca, 0xcb, 0x9f, 0xaf, 0xbd
                }, new byte[] { 0xf2, 0x1f, 0xac, 0x5b, 0x2c, 0xc0, 0xa9, 0xd0, 0xbc, 0xaf, 0x86, 0x99, 0xad, 170, 0xfb, 0x60 });
                if (!base.IsFirstCreate)
                {
                    dyfp.Get_Print_Dj(null, 0, buffer);
                    base.IsFirstCreate = true;
                }
                dict.Add("mw", dyfp.mw);
                dict.Add("gfmc", dyfp.gfmc);
                dict.Add("gfsh", dyfp.gfsh);
                dict.Add("sccjmc", dyfp.sccjmc);
                dict.Add("sfzhm", dyfp.sfzhm);
                dict.Add("cllx", dyfp.cllx);
                dict.Add("cpxh", dyfp.cpxh);
                dict.Add("cd", dyfp.cd);
                dict.Add("hgzh", dyfp.hgzh);
                dict.Add("jkzmsh", dyfp.jkzmsh);
                dict.Add("sjdh", dyfp.sjdh);
                dict.Add("fdjhm", dyfp.fdjhm);
                dict.Add("clsbdh", dyfp.clsbdh);
                decimal num = Convert.ToDecimal(dyfp.je) + Convert.ToDecimal(dyfp.se);
                dict.Add("jshjdx", ToolUtil.RMBToDaXie(num));
                string str = "¥" + num.ToString();
                dict.Add("jshjxx", str);
                dict.Add("xfmc", dyfp.xfmc);
                dict.Add("xfdh", dyfp.xfdh);
                dict.Add("xfsh", dyfp.xfsh);
                dict.Add("xfzh", dyfp.xfzh);
                dict.Add("xfdz", dyfp.xfdz);
                dict.Add("xfyh", dyfp.xfyh);
                float result = 0f;
                float.TryParse(dyfp.sLv, out result);
                string str2 = string.Format("{0}%", result * 100f);
                if (result != 0f)
                {
                    dict.Add("sLv", str2);
                    string str3 = "¥" + dyfp.se;
                    dict.Add("hjse", str3);
                }
                else
                {
                    dict.Add("sLv", "***");
                    dict.Add("hjse", "***");
                }
                dict.Add("zgswjgmc", dyfp.zgswjgmc);
                dict.Add("zgswjgdm", dyfp.zgswjgdm);
                dict.Add("je", "¥" + dyfp.je);
                dict.Add("dw", dyfp.dw);
                dict.Add("xcrs", dyfp.xcrs);
                dict.Add("kpr", dyfp.kpr);
                if (dyfp.zfbz)
                {
                    dict.Add("zfbz", "作废");
                }
                switch (dyfp.yysbz.Substring(4, 1))
                {
                case "1":
                    base.Id     = this.string_10;
                    base.ZYFPLX = "JO";
                    break;

                case "2":
                    base.Id     = this.string_9;
                    base.ZYFPLX = "JN";
                    break;
                }
                return(new DataDict(dict));
            }
            base._isPrint = "0006";
            return(new DataDict(dict));
        }
Ejemplo n.º 17
0
        protected DataDict DictCreate_HWYSYFP(params object[] args)
        {
            Fpxx dyfp = base.dyfp;

            dyfp         = new InvoiceHandler().ConvertInvoiceToZH(dyfp);
            base._isZYPT = false;
            base.ZYFPLX  = "f";
            if (dyfp != null)
            {
                Dictionary <string, object> dict = new Dictionary <string, object>();
                dict.Add("lbdm", dyfp.fpdm);
                dict.Add("fphm", dyfp.fphm);
                DateTime time = Aisino.Fwkp.Print.Common.ObjectToDateTime(dyfp.kprq);
                dict.Add("year", time.Year);
                dict.Add("month", time.Month.ToString("00"));
                dict.Add("day", time.Day.ToString("00"));
                DateTime time2  = new DateTime(0x7dd, 9, 10, 8, 0x22, 30);
                TimeSpan span   = (TimeSpan)(DateTime.Now - time2);
                byte[]   buffer = AES_Crypt.Encrypt(ToolUtil.GetBytes(span.TotalSeconds.ToString("F1")), new byte[] {
                    0xff, 0x42, 0xae, 0x95, 11, 0x51, 0xca, 0x15, 0x21, 140, 0x4f, 170, 220, 0x92, 170, 0xed,
                    0xfd, 0xeb, 0x4e, 13, 0xac, 0x80, 0x52, 0xff, 0x45, 0x90, 0x85, 0xca, 0xcb, 0x9f, 0xaf, 0xbd
                }, new byte[] { 0xf2, 0x1f, 0xac, 0x5b, 0x2c, 0xc0, 0xa9, 0xd0, 0xbc, 0xaf, 0x86, 0x99, 0xad, 170, 0xfb, 0x60 });
                if (!base.IsFirstCreate)
                {
                    dyfp.Get_Print_Dj(null, 0, buffer);
                    base.IsFirstCreate = true;
                }
                dict.Add("mw", dyfp.mw);
                dict.Add("cyrmc", dyfp.cyrmc);
                dict.Add("cyrnsrsbh", dyfp.cyrnsrsbh);
                dict.Add("spfmc", dyfp.spfmc);
                dict.Add("spfnsrsbh", dyfp.spfnsrsbh);
                dict.Add("shrmc", dyfp.shrmc);
                dict.Add("shrnsrsbh", dyfp.shrnsrsbh);
                dict.Add("fhrmc", dyfp.fhrmc);
                dict.Add("fhrnsrsbh", dyfp.fhrnsrsbh);
                dict.Add("qyd", dyfp.qyd);
                dict.Add("yshwxx", dyfp.yshwxx);
                DataTable table = this.method_6(dyfp);
                dict.Add("list", table);
                dict.Add("hjje", "¥" + dyfp.je);
                float result = 0f;
                float.TryParse(dyfp.sLv, out result);
                if (result == 0f)
                {
                    dict.Add("sLv", "***");
                    dict.Add("hjse", "***");
                }
                else
                {
                    float num6 = 0f;
                    float.TryParse(dyfp.sLv, out num6);
                    string str2 = string.Format("{0}%", num6 * 100f);
                    dict.Add("sLv", str2);
                    string str3 = "¥" + dyfp.se;
                    dict.Add("hjse", str3);
                }
                dict.Add("jqbh", dyfp.jqbh);
                decimal num5 = Convert.ToDecimal(dyfp.je) + Convert.ToDecimal(dyfp.se);
                dict.Add("jshjdx", ToolUtil.RMBToDaXie(num5));
                string str = "¥" + num5.ToString();
                dict.Add("jshjxx", str);
                dict.Add("czch", dyfp.czch);
                dict.Add("ccdw", dyfp.ccdw);
                dict.Add("zgswjgmc", dyfp.zgswjgmc);
                dict.Add("zgswjgdm", dyfp.zgswjgdm);
                dict.Add("bz", dyfp.bz);
                dict.Add("kpr", dyfp.kpr);
                dict.Add("fhr", dyfp.fhr);
                dict.Add("skr", dyfp.skr);
                if (dyfp.zfbz)
                {
                    dict.Add("zfbz", "作废");
                }
                base.Id = this.string_8;
                return(new DataDict(dict));
            }
            base._isPrint = "0006";
            return(null);
        }
Ejemplo n.º 18
0
        public void ReplicateOrderToInvoice()
        {
            #region 1. Setup / Arrange
            var orgServiceMock = new Mock <IOrganizationService>();
            var orgService     = orgServiceMock.Object;
            var orgTracingMock = new Mock <ITracingService>();
            var orgTracing     = orgTracingMock.Object;

            #region Sales Order entity
            var SalesOrderCollection = new EntityCollection()
            {
                EntityName = "salesorder",
                Entities   =
                {
                    new Entity
                    {
                        Id          = Guid.NewGuid(),
                        LogicalName = "salesorder",
                        Attributes  =
                        {
                            { "gsc_dealerid",                    new EntityReference("account",                            Guid.NewGuid())                 },
                            { "gsc_branchsiteid",                new EntityReference("account",                            Guid.NewGuid())                 },
                            { "gsc_salesexecutiveid",            new EntityReference("contact",                            Guid.NewGuid())                 },
                            { "gsc_leadsourceid",                new EntityReference("gsc_sls_leadsource",                 Guid.NewGuid())                 },
                            { "gsc_paymentmode",                 new OptionSetValue(1000000) },
                            { "gsc_customertype",                new OptionSetValue(1000001) },
                            { "gsc_customerid",                  new EntityReference("contact",                            Guid.NewGuid())                 },
                            { "gsc_address",                     "Calle Industria cor. Economia" },
                            { "gsc_tin",                         "000809208002" },
                            { "gsc_productid",                   new EntityReference("product",                            Guid.NewGuid())                 },
                            { "gsc_vehicleunitprice",            new Money((Decimal)1800000) },
                            { "gsc_vehiclecolorid1",             new EntityReference("gsc_cmn_vehiclecolor",               Guid.NewGuid())                 },
                            { "gsc_vehiclecolorid2",             new EntityReference("gsc_cmn_vehiclecolor",               Guid.NewGuid())                 },
                            { "gsc_vehiclecolorid3",             new EntityReference("gsc_cmn_vehiclecolor",               Guid.NewGuid())                 },
                            { "gsc_vehicledetails",              "Car is made purely from carbon fiber" },
                            { "gsc_remarks",                     "Uneasy hearts weigh the most" },
                            { "gsc_unitprice",                   new Money((Decimal)1800000) },
                            { "gsc_colorprice",                  new Money((Decimal)30000) },
                            { "gsc_discount",                    new Money((Decimal)40000) },
                            //{"gsc_downpaymentdiscount", new Money((Decimal)20000)},
                            { "gsc_netprice",                    new Money((Decimal)1700000) },
                            { "gsc_downpayment",                 new Money((Decimal)50000) },
                            { "gsc_accessories",                 new Money((Decimal)80000) },
                            { "gsc_insurance",                   new Money((Decimal)3000) },
                            { "gsc_chattelfee",                  new Money((Decimal)54000) },
                            { "gsc_othercharges",                new Money((Decimal)25000) },
                            { "gsc_reservation",                 new Money((Decimal)5000) },
                            { "gsc_totalcashoutlay",             new Money((Decimal)35000) },
                            { "gsc_totalamountfinanced",         new Money((Decimal)8000) },
                            { "gsc_netmonthlyamortization",      new Money((Decimal)30000) },
                            { "gsc_downpaymentamount",           new Money((Decimal)50000) },
                            { "gsc_downpaymentpercentage",       (Double)25.00 },
                            { "gsc_downpaymentdiscount",         new Money((Decimal)50000) },
                            { "gsc_netdownpayment",              new Money((Decimal)60000) },
                            { "gsc_amountfinanced",              new Money((Decimal)180000) },
                            { "gsc_discountamountfinanced",      new Money((Decimal)180000) },
                            { "gsc_netamountfinanced",           new Money((Decimal)180000) },
                            { "gsc_bankid",                      new EntityReference("gsc_sls_bank",                       Guid.NewGuid())                 },
                            { "gsc_financingschemeid",           new EntityReference("gsc_cmn_financingscheme",            Guid.NewGuid())                 },
                            { "gsc_freechattelfee",              false },
                            { "gsc_totaldiscountamount",         new Money((Decimal)60000) },
                            { "gsc_applytodppercentage",         (Double)25.00 },
                            { "gsc_applytoafpercentage",         (Double)25.00 },
                            { "gsc_applytouppercentage",         (Double)50.00 },
                            { "gsc_applytodpamount",             new Money((Decimal)25000) },
                            { "gsc_applytoafamount",             new Money((Decimal)25000) },
                            { "gsc_applytoupamount",             new Money((Decimal)50000) },
                            { "gsc_insuranceid",                 new EntityReference("gsc_cmn_insurance",                  Guid.NewGuid())                 },
                            { "gsc_vehicletype",                 new EntityReference("gsc_iv_vehicletype",                 Guid.NewGuid())                 },
                            { "gsc_free",                        false },
                            { "gsc_rate",                        (Double)2.00 },
                            { "gsc_cost",                        new Money((Decimal)40000) },
                            { "gsc_totalpremium",                new Money((Decimal)9000) },
                            { "gsc_originaltotalpremium",        new Money((Decimal)7000) },
                            { "gsc_totalchargesamount",          new Money((Decimal)5000) },
                            { "gsc_modeldescription",            "Montero" },
                            { "gsc_modelyear",                   "2016" },
                            { "gsc_siteid",                      new EntityReference("account",                            Guid.NewGuid())                 },
                            { "gsc_colorid",                     new EntityReference("gsc_iv_color",                       Guid.NewGuid())                 },
                            { "gsc_csnocriteria",                new OptionSetValue(10000001) },
                            { "gsc_enginenocriteria",            new OptionSetValue(100000001) },
                            { "gsc_vincriteria",                 new OptionSetValue(10000001) },
                            { "gsc_productionnocriteria",        new OptionSetValue(10000001) },
                            { "gsc_modelcode",                   "MNT" },
                            { "gsc_color1",                      "Hot Pink" },
                            { "gsc_color2",                      "Baby Blue" },
                            { "gsc_color3",                      "" },
                            { "gsc_csno",                        "59483726" },
                            { "gsc_engineno",                    "GAT-X105" },
                            { "gsc_vin",                         "GAT-X201" },
                            { "gsc_productionno",                "X101" },
                            { "gsc_expecteddateofrelease",       DateTime.UtcNow.AddHours(256) },
                            { "gsc_placeofrelease",              "Eastwood" },
                            { "gsc_quotedate",                   DateTime.UtcNow },
                            { "gsc_orderdate",                   DateTime.UtcNow },
                            { "gsc_requestallocationdate",       DateTime.UtcNow },
                            { "gsc_vehicleallocationdate",       DateTime.UtcNow.AddYears(1) },
                            { "gsc_transferreddateforinvoicing", DateTime.UtcNow },
                            { "gsc_ordercancelleddate",          DateTime.UtcNow },
                            { "gsc_invoicedate",                 DateTime.UtcNow },
                            { "gsc_drdate",                      DateTime.UtcNow },
                            { "gsc_posteddate",                  DateTime.UtcNow },
                            { "gsc_recordownerid",               new EntityReference("contact",                            Guid.NewGuid())                 },
                            { "gsc_salesinvoicestatus",          new OptionSetValue(10000001) }
                        }
                    }
                }
            };
            #endregion

            #region Invoice entity
            var invoiceEntity = new Entity()
            {
                Id          = Guid.NewGuid(),
                LogicalName = "salesorder",
                Attributes  =
                {
                    { "salesorderid", new EntityReference("salesorder", SalesOrderCollection.Entities[0].Id) }
                }
            };
            #endregion

            orgServiceMock.Setup((service => service.RetrieveMultiple(
                                      It.Is <QueryExpression>(expression => expression.EntityName == SalesOrderCollection.EntityName)
                                      ))).Returns(SalesOrderCollection);

            #endregion

            #region 2. Call / Action
            var    invoiceHandler = new InvoiceHandler(orgService, orgTracing);
            Entity invoice        = invoiceHandler.ReplicateOrderInfo(invoiceEntity);
            #endregion

            #region 3. Verify
            Assert.AreEqual(SalesOrderCollection.Entities[0].GetAttributeValue <EntityReference>("gsc_dealerid").Id, invoice.GetAttributeValue <EntityReference>("gsc_dealerid").Id);
            Assert.AreEqual(SalesOrderCollection.Entities[0].GetAttributeValue <EntityReference>("gsc_branchsiteid").Id, invoice.GetAttributeValue <EntityReference>("gsc_branchsiteid").Id);
            Assert.AreEqual(SalesOrderCollection.Entities[0].GetAttributeValue <EntityReference>("gsc_salesexecutiveid").Id, invoice.GetAttributeValue <EntityReference>("gsc_salesexecutiveid").Id);
            Assert.AreEqual(SalesOrderCollection.Entities[0].GetAttributeValue <EntityReference>("gsc_leadsourceid").Id, invoice.GetAttributeValue <EntityReference>("gsc_leadsourceid").Id);
            Assert.AreEqual(SalesOrderCollection.Entities[0].GetAttributeValue <OptionSetValue>("gsc_paymentmode").Value, invoice.GetAttributeValue <OptionSetValue>("gsc_paymentmode").Value);
            Assert.AreEqual(SalesOrderCollection.Entities[0].GetAttributeValue <OptionSetValue>("gsc_customertype").Value, invoice.GetAttributeValue <OptionSetValue>("gsc_customertype").Value);
            //Assert.AreEqual(SalesOrderCollection.Entities[0].GetAttributeValue<EntityReference>("gsc_customerid").Id, invoice.GetAttributeValue<EntityReference>("gsc_customerid").Id);
            Assert.AreEqual(SalesOrderCollection.Entities[0].GetAttributeValue <String>("gsc_address"), invoice.GetAttributeValue <String>("shipto_composite"));
            Assert.AreEqual(SalesOrderCollection.Entities[0].GetAttributeValue <String>("gsc_tin"), invoice.GetAttributeValue <String>("gsc_tin"));
            Assert.AreEqual(SalesOrderCollection.Entities[0].GetAttributeValue <EntityReference>("gsc_productid").Id, invoice.GetAttributeValue <EntityReference>("gsc_productid").Id);
            Assert.AreEqual(SalesOrderCollection.Entities[0].GetAttributeValue <Money>("gsc_vehicleunitprice").Value, invoice.GetAttributeValue <Money>("gsc_vehicleunitprice").Value);
            Assert.AreEqual(SalesOrderCollection.Entities[0].GetAttributeValue <EntityReference>("gsc_vehiclecolorid1").Id, invoice.GetAttributeValue <EntityReference>("gsc_vehiclecolorid1").Id);
            Assert.AreEqual(SalesOrderCollection.Entities[0].GetAttributeValue <EntityReference>("gsc_vehiclecolorid2").Id, invoice.GetAttributeValue <EntityReference>("gsc_vehiclecolorid2").Id);
            Assert.AreEqual(SalesOrderCollection.Entities[0].GetAttributeValue <EntityReference>("gsc_vehiclecolorid3").Id, invoice.GetAttributeValue <EntityReference>("gsc_vehiclecolorid3").Id);
            Assert.AreEqual(SalesOrderCollection.Entities[0].GetAttributeValue <String>("gsc_vehicledetails"), invoice.GetAttributeValue <String>("gsc_vehicledetails"));
            Assert.AreEqual(SalesOrderCollection.Entities[0].GetAttributeValue <String>("gsc_remarks"), invoice.GetAttributeValue <String>("gsc_remarks"));
            Assert.AreEqual(SalesOrderCollection.Entities[0].GetAttributeValue <Money>("gsc_unitprice").Value, invoice.GetAttributeValue <Money>("gsc_unitprice").Value);
            Assert.AreEqual(SalesOrderCollection.Entities[0].GetAttributeValue <Money>("gsc_colorprice").Value, invoice.GetAttributeValue <Money>("gsc_colorprice").Value);
            Assert.AreEqual(SalesOrderCollection.Entities[0].GetAttributeValue <Money>("gsc_discount").Value, invoice.GetAttributeValue <Money>("gsc_discount").Value);
            Assert.AreEqual(SalesOrderCollection.Entities[0].GetAttributeValue <Money>("gsc_netprice").Value, invoice.GetAttributeValue <Money>("gsc_netprice").Value);
            Assert.AreEqual(SalesOrderCollection.Entities[0].GetAttributeValue <Money>("gsc_downpayment").Value, invoice.GetAttributeValue <Money>("gsc_downpayment").Value);
            Assert.AreEqual(SalesOrderCollection.Entities[0].GetAttributeValue <Money>("gsc_accessories").Value, invoice.GetAttributeValue <Money>("gsc_accessories").Value);
            Assert.AreEqual(SalesOrderCollection.Entities[0].GetAttributeValue <Money>("gsc_insurance").Value, invoice.GetAttributeValue <Money>("gsc_insurance").Value);
            Assert.AreEqual(SalesOrderCollection.Entities[0].GetAttributeValue <Money>("gsc_chattelfee").Value, invoice.GetAttributeValue <Money>("gsc_chattelfee").Value);
            Assert.AreEqual(SalesOrderCollection.Entities[0].GetAttributeValue <Money>("gsc_othercharges").Value, invoice.GetAttributeValue <Money>("gsc_othercharges").Value);
            Assert.AreEqual(SalesOrderCollection.Entities[0].GetAttributeValue <Money>("gsc_reservation").Value, invoice.GetAttributeValue <Money>("gsc_reservation").Value);
            Assert.AreEqual(SalesOrderCollection.Entities[0].GetAttributeValue <Money>("gsc_totalcashoutlay").Value, invoice.GetAttributeValue <Money>("gsc_totalcashoutlay").Value);
            Assert.AreEqual(SalesOrderCollection.Entities[0].GetAttributeValue <Money>("gsc_totalamountfinanced").Value, invoice.GetAttributeValue <Money>("gsc_totalamountfinanced").Value);
            Assert.AreEqual(SalesOrderCollection.Entities[0].GetAttributeValue <Money>("gsc_netmonthlyamortization").Value, invoice.GetAttributeValue <Money>("gsc_netmonthlyamortization").Value);
            Assert.AreEqual(SalesOrderCollection.Entities[0].GetAttributeValue <Money>("gsc_downpaymentamount").Value, invoice.GetAttributeValue <Money>("gsc_downpaymentamount").Value);
            Assert.AreEqual(SalesOrderCollection.Entities[0].GetAttributeValue <Double>("gsc_downpaymentpercentage"), invoice.GetAttributeValue <Double>("gsc_downpaymentpercentage"));
            Assert.AreEqual(SalesOrderCollection.Entities[0].GetAttributeValue <Money>("gsc_downpaymentdiscount").Value, invoice.GetAttributeValue <Money>("gsc_downpaymentdiscount").Value);
            Assert.AreEqual(SalesOrderCollection.Entities[0].GetAttributeValue <Money>("gsc_netdownpayment").Value, invoice.GetAttributeValue <Money>("gsc_netdownpayment").Value);
            Assert.AreEqual(SalesOrderCollection.Entities[0].GetAttributeValue <Money>("gsc_amountfinanced").Value, invoice.GetAttributeValue <Money>("gsc_amountfinanced").Value);
            Assert.AreEqual(SalesOrderCollection.Entities[0].GetAttributeValue <Money>("gsc_discountamountfinanced").Value, invoice.GetAttributeValue <Money>("gsc_discountamountfinanced").Value);
            Assert.AreEqual(SalesOrderCollection.Entities[0].GetAttributeValue <Money>("gsc_netamountfinanced").Value, invoice.GetAttributeValue <Money>("gsc_netamountfinanced").Value);
            Assert.AreEqual(SalesOrderCollection.Entities[0].GetAttributeValue <Money>("gsc_discountamountfinanced").Value, invoice.GetAttributeValue <Money>("gsc_discountamountfinanced").Value);
            Assert.AreEqual(SalesOrderCollection.Entities[0].GetAttributeValue <Money>("gsc_netamountfinanced").Value, invoice.GetAttributeValue <Money>("gsc_netamountfinanced").Value);
            Assert.AreEqual(SalesOrderCollection.Entities[0].GetAttributeValue <EntityReference>("gsc_bankid").Id, invoice.GetAttributeValue <EntityReference>("gsc_bankid").Id);
            Assert.AreEqual(SalesOrderCollection.Entities[0].GetAttributeValue <EntityReference>("gsc_financingschemeid").Id, invoice.GetAttributeValue <EntityReference>("gsc_financingschemeid").Id);
            Assert.AreEqual(SalesOrderCollection.Entities[0].GetAttributeValue <Boolean>("gsc_freechattelfee"), invoice.GetAttributeValue <Boolean>("gsc_freechattelfee"));
            Assert.AreEqual(SalesOrderCollection.Entities[0].GetAttributeValue <Money>("gsc_totaldiscountamount").Value, invoice.GetAttributeValue <Money>("gsc_totaldiscountamount").Value);
            Assert.AreEqual(SalesOrderCollection.Entities[0].GetAttributeValue <Double>("gsc_applytodppercentage"), invoice.GetAttributeValue <Double>("gsc_applytoddppercentage"));
            Assert.AreEqual(SalesOrderCollection.Entities[0].GetAttributeValue <Double>("gsc_applytoafpercentage"), invoice.GetAttributeValue <Double>("gsc_applytoafpercentage"));
            Assert.AreEqual(SalesOrderCollection.Entities[0].GetAttributeValue <Double>("gsc_applytouppercentage"), invoice.GetAttributeValue <Double>("gsc_applytouppercentage"));
            Assert.AreEqual(SalesOrderCollection.Entities[0].GetAttributeValue <Money>("gsc_applytodpamount").Value, invoice.GetAttributeValue <Money>("gsc_applytodpamount").Value);
            Assert.AreEqual(SalesOrderCollection.Entities[0].GetAttributeValue <Money>("gsc_applytoafamount").Value, invoice.GetAttributeValue <Money>("gsc_applytoafamount").Value);
            Assert.AreEqual(SalesOrderCollection.Entities[0].GetAttributeValue <Money>("gsc_applytoupamount").Value, invoice.GetAttributeValue <Money>("gsc_applytoupamount").Value);
            Assert.AreEqual(SalesOrderCollection.Entities[0].GetAttributeValue <EntityReference>("gsc_insuranceid").Id, invoice.GetAttributeValue <EntityReference>("gsc_insuranceid").Id);
            Assert.AreEqual(SalesOrderCollection.Entities[0].GetAttributeValue <EntityReference>("gsc_vehicletypeid").Id, invoice.GetAttributeValue <EntityReference>("gsc_vehicletypeid").Id);
            Assert.AreEqual(SalesOrderCollection.Entities[0].GetAttributeValue <OptionSetValue>("gsc_vehicleuse").Value, invoice.GetAttributeValue <OptionSetValue>("gsc_vehicleuse").Value);
            Assert.AreEqual(SalesOrderCollection.Entities[0].GetAttributeValue <Boolean>("gsc_free"), invoice.GetAttributeValue <Boolean>("gsc_free"));
            Assert.AreEqual(SalesOrderCollection.Entities[0].GetAttributeValue <Double>("gsc_rate"), invoice.GetAttributeValue <Double>("gsc_rage"));
            Assert.AreEqual(SalesOrderCollection.Entities[0].GetAttributeValue <Money>("gsc_cost").Value, invoice.GetAttributeValue <Money>("gsc_cost").Value);
            Assert.AreEqual(SalesOrderCollection.Entities[0].GetAttributeValue <Money>("gsc_totalpremium").Value, invoice.GetAttributeValue <Money>("gsc_totalpremium").Value);
            Assert.AreEqual(SalesOrderCollection.Entities[0].GetAttributeValue <Money>("gsc_originaltotalpremium").Value, invoice.GetAttributeValue <Money>("gsc_originaltotalpremium").Value);
            Assert.AreEqual(SalesOrderCollection.Entities[0].GetAttributeValue <Money>("gsc_totalchargesamount").Value, invoice.GetAttributeValue <Money>("gsc_totalchargesamount").Value);
            Assert.AreEqual(SalesOrderCollection.Entities[0].GetAttributeValue <EntityReference>("gsc_modeldescription").Id, invoice.GetAttributeValue <EntityReference>("gsc_modeldescription").Id);
            Assert.AreEqual(SalesOrderCollection.Entities[0].GetAttributeValue <String>("gsc_modelyear"), invoice.GetAttributeValue <String>("gsc_modelyear"));
            Assert.AreEqual(SalesOrderCollection.Entities[0].GetAttributeValue <EntityReference>("gsc_siteid").Id, invoice.GetAttributeValue <EntityReference>("gsc_siteid").Id);
            Assert.AreEqual(SalesOrderCollection.Entities[0].GetAttributeValue <EntityReference>("gsc_colorid").Id, invoice.GetAttributeValue <EntityReference>("gsc_colorid").Id);
            Assert.AreEqual(SalesOrderCollection.Entities[0].GetAttributeValue <OptionSetValue>("gsc_csnocriteria").Value, invoice.GetAttributeValue <OptionSetValue>("gsc_csnocriteria").Value);
            Assert.AreEqual(SalesOrderCollection.Entities[0].GetAttributeValue <OptionSetValue>("gsc_enginenocriteria").Value, invoice.GetAttributeValue <OptionSetValue>("gsc_enginenocriteria").Value);
            Assert.AreEqual(SalesOrderCollection.Entities[0].GetAttributeValue <OptionSetValue>("gsc_vincriteria").Value, invoice.GetAttributeValue <OptionSetValue>("gsc_vincriteria").Value);
            Assert.AreEqual(SalesOrderCollection.Entities[0].GetAttributeValue <OptionSetValue>("gsc_productionnocriteria").Value, invoice.GetAttributeValue <OptionSetValue>("gsc_productioncriteria").Value);
            Assert.AreEqual(SalesOrderCollection.Entities[0].GetAttributeValue <String>("gsc_modelcode"), invoice.GetAttributeValue <String>("gsc_modelcode"));
            Assert.AreEqual(SalesOrderCollection.Entities[0].GetAttributeValue <String>("gsc_color1"), invoice.GetAttributeValue <String>("gsc_color1"));
            Assert.AreEqual(SalesOrderCollection.Entities[0].GetAttributeValue <String>("gsc_color2"), invoice.GetAttributeValue <String>("gsc_color2"));
            Assert.AreEqual(SalesOrderCollection.Entities[0].GetAttributeValue <String>("gsc_color3"), invoice.GetAttributeValue <String>("gsc_color3"));
            Assert.AreEqual(SalesOrderCollection.Entities[0].GetAttributeValue <String>("gsc_csno"), invoice.GetAttributeValue <String>("gsc_csno"));
            Assert.AreEqual(SalesOrderCollection.Entities[0].GetAttributeValue <String>("gsc_engineno"), invoice.GetAttributeValue <String>("gsc_engineno"));
            Assert.AreEqual(SalesOrderCollection.Entities[0].GetAttributeValue <String>("gsc_vin"), invoice.GetAttributeValue <String>("gsc_vin"));
            Assert.AreEqual(SalesOrderCollection.Entities[0].GetAttributeValue <String>("gsc_productionno"), invoice.GetAttributeValue <String>("gsc_productionno"));
            Assert.AreEqual(SalesOrderCollection.Entities[0].GetAttributeValue <DateTime>("gsc_expecteddateofrelease"), invoice.GetAttributeValue <DateTime>("gsc_expecteddateofrelease"));
            Assert.AreEqual(SalesOrderCollection.Entities[0].GetAttributeValue <String>("gsc_placeofrelease"), invoice.GetAttributeValue <String>("gsc_placeofrelease"));
            Assert.AreEqual(SalesOrderCollection.Entities[0].GetAttributeValue <DateTime>("gsc_quotedate"), invoice.GetAttributeValue <DateTime>("gsc_quotedate"));
            Assert.AreEqual(SalesOrderCollection.Entities[0].GetAttributeValue <DateTime>("gsc_orderdate"), invoice.GetAttributeValue <DateTime>("gsc_orderdate"));
            Assert.AreEqual(SalesOrderCollection.Entities[0].GetAttributeValue <DateTime>("gsc_requestallocationdate"), invoice.GetAttributeValue <DateTime>("gsc_requestallocationdate"));
            Assert.AreEqual(SalesOrderCollection.Entities[0].GetAttributeValue <DateTime>("gsc_vehicleallocationdate"), invoice.GetAttributeValue <DateTime>("gsc_vehicleallocationdate"));
            Assert.AreEqual(SalesOrderCollection.Entities[0].GetAttributeValue <DateTime>("gsc_transferreddateforinvoicing"), invoice.GetAttributeValue <DateTime>("gsc_transferreddateforinvoicing"));
            Assert.AreEqual(SalesOrderCollection.Entities[0].GetAttributeValue <DateTime>("gsc_ordercancelleddate"), invoice.GetAttributeValue <DateTime>("gsc_ordercancelleddate"));
            Assert.AreEqual(SalesOrderCollection.Entities[0].GetAttributeValue <DateTime>("gsc_invoicedate"), invoice.GetAttributeValue <DateTime>("gsc_invoicedate"));
            Assert.AreEqual(SalesOrderCollection.Entities[0].GetAttributeValue <DateTime>("gsc_drdate"), invoice.GetAttributeValue <DateTime>("gsc_drdate"));
            Assert.AreEqual(SalesOrderCollection.Entities[0].GetAttributeValue <DateTime>("gsc_posteddate"), invoice.GetAttributeValue <DateTime>("gsc_posteddate"));
            Assert.AreEqual(SalesOrderCollection.Entities[0].GetAttributeValue <EntityReference>("gsc_recordownerid").Id, invoice.GetAttributeValue <EntityReference>("gsc_recordownerid").Id);
            #endregion
        }