private void SaveManifestReferenceNumber(xcuda_ASYCUDA da, ASYCUDA a) { if (da.xcuda_Identification.Manifest_reference_number != null) { a.Identification.Manifest_reference_number.Text.Add(da.xcuda_Identification.Manifest_reference_number); } }
private void SaveContainer(xcuda_ASYCUDA da, ASYCUDA a) { if (da.xcuda_Container.Count > 0) { a.Transport.Container_flagSpecified = true; a.Transport.Container_flag = true; foreach (var cnt in da.xcuda_Container) { ASYCUDAContainer ac = null; a.Container = new ObservableCollection <ASYCUDAContainer>(); ac = new ASYCUDAContainer(); a.Container.Add(ac); ac.Item_Number = cnt.Item_Number; ac.Container_identity = cnt.Container_identity; ac.Container_type = cnt.Container_type; ac.Empty_full_indicator = cnt.Empty_full_indicator; if (ac.Gross_weight == null) { ac.Gross_weight = new ASYCUDAContainerGross_weight(); } ac.Gross_weight.Text.Add(cnt.Gross_weight.ToString()); ac.Goods_description = cnt.Goods_description; ac.Packages_number = cnt.Packages_number; ac.Packages_type = cnt.Packages_type; ac.Packages_weight = cnt.Packages_weight.ToString(); } } }
private void SavePreviousItem(xcuda_ASYCUDA da, ASYCUDA a) { if (da.xcuda_PreviousItem != null) { var lncounter = 0; foreach (var item in da.xcuda_PreviousItem.OrderBy(x => Convert.ToInt32(x.Current_item_number))) { lncounter += 1; var pi = new ASYCUDAPrev_decl();//ASYCUDAPreviousItem pi.Prev_decl_office_code = item.Prev_reg_cuo; pi.Prev_decl_reg_year = item.Prev_reg_dat; pi.Prev_decl_reg_serial = item.Prev_reg_ser; pi.Prev_decl_reg_number = item.Prev_reg_nbr; pi.Prev_decl_item_number = item.Previous_item_number; pi.Prev_decl_HS_code = item.Hs_code; pi.Prev_decl_HS_prec = item.Commodity_code; pi.Prev_decl_country_origin = item.Goods_origin; pi.Prev_decl_number_packages = item.Packages_number; pi.Prev_decl_weight = item.Net_weight.ToString(); pi.Prev_decl_supp_quantity = item.Suplementary_Quantity.ToString(); pi.Prev_decl_ref_value = Math.Round(item.Current_value, 4).ToString(); pi.Prev_decl_current_item = lncounter.ToString();//item.Current_item_number; pi.Prev_decl_number_packages_written_off = item.Previous_Packages_number; pi.Prev_decl_weight_written_off = item.Prev_net_weight.ToString(); pi.Prev_decl_supp_quantity_written_off = item.Preveious_suplementary_quantity.ToString(); pi.Prev_decl_ref_value_written_off = Math.Round(item.Previous_value, 4).ToString(); a.Prev_decl.Add(pi); } if (a.Prev_decl.Any() == true) { a.Prev_decl[0].Prev_decl_number_packages = a.Item[0].Packages.Number_of_packages; } } }
private void SavePreviousItem(xcuda_ASYCUDA da, ASYCUDA a) { if (da.xcuda_PreviousItem != null) { foreach (var item in da.xcuda_PreviousItem.OrderBy(x => Convert.ToInt32(x.Current_item_number))) { var pi = new ASYCUDAPreviousItem(); pi.Commodity_code = item.Commodity_code; pi.Current_item_number = item.Current_item_number; pi.Current_value = Math.Round(item.Current_value, 2).ToString(); pi.Goods_origin = item.Goods_origin; pi.Hs_code = item.Hs_code; pi.Net_weight = item.Net_weight.ToString(); pi.Packages_number = item.Packages_number; pi.Prev_net_weight = item.Prev_net_weight.ToString(); pi.Prev_reg_cuo = item.Prev_reg_cuo; pi.Prev_reg_dat = item.Prev_reg_dat; pi.Prev_reg_nbr = item.Prev_reg_nbr; pi.Prev_reg_ser = item.Prev_reg_ser; pi.Preveious_suplementary_quantity = item.Preveious_suplementary_quantity.ToString(); pi.Previous_item_number = item.Previous_item_number; pi.Previous_Packages_number = item.Previous_Packages_number; pi.Previous_value = Math.Round(item.Previous_value, 2).ToString(); pi.Suplementary_Quantity = item.Suplementary_Quantity.ToString(); a.PreviousItem.Add(pi); } if (a.PreviousItem.Any() == true) { a.PreviousItem[0].Packages_number = a.Item[0].Packages.Number_of_packages; } } }
public void LoadFromDataBase(xcuda_ASYCUDA da, ASYCUDA a) { try { SetupProperties(a, da); SaveGeneralInformation(a, da); SaveTraders(a, da); SaveProperty(a, da); SaveDeclarant(da, a); SaveContainer(da, a); SaveIdentification(da, a); SaveItem(da, a); SavePreviousItem(da, a); SaveValuationItem(da, a); if (a.Valuation.Gs_Invoice.Amount_foreign_currency == null) { a.Valuation.Gs_Invoice.Amount_foreign_currency = Math.Round(da.xcuda_Item.Where(i => i.xcuda_Valuation_item.xcuda_Item_Invoice != null).Sum(i => i.xcuda_Valuation_item.xcuda_Item_Invoice.Amount_foreign_currency), 2).ToString(); } } catch (Exception Ex) { throw; } }
public async Task SaveAsycudaDocument(xcuda_ASYCUDA doc, DocInfo docInfo) { if (doc != null && doc.xcuda_ASYCUDA_ExtendedProperties.AutoUpdate == false) { UpdateDocument(doc, docInfo); } }
private void SaveIdentification(xcuda_ASYCUDA da, ASYCUDA a) { if (da.xcuda_Identification != null) { SaveOfficeSegment(da, a); SaveManifestReferenceNumber(da, a); SaveRegistration(da, a); SaveType(da, a); } }
public async Task Savexcuda_ASYCUDA(xcuda_ASYCUDA i) { if (i == null) { return; } using (var ctx = new xcuda_ASYCUDAService()) { await ctx.Updatexcuda_ASYCUDA(i).ConfigureAwait(false); } }
private void SaveGeneralInformation(ASYCUDA a, xcuda_ASYCUDA da) { if (da.xcuda_General_information != null && da.xcuda_General_information.xcuda_Country != null) { var gi = new ASYCUDAGeneral_information(); SaveCountry(gi, da.xcuda_General_information); gi.Value_details = da.xcuda_General_information.Value_details; gi.Comments_free_text.Text.Add(da.xcuda_General_information.Comments_free_text); a.General_information = gi; } }
private ASYCUDAItem SetupItemProperties(xcuda_ASYCUDA da) { var ai = new ASYCUDAItem(); ai.Suppliers_link.Suppliers_link_code = "1"; ai.Tarification.HScode.Precision_1 = "00"; ai.Packages.Number_of_packages = "0"; ai.Packages.Kind_of_packages_code = "PK"; ai.Packages.Kind_of_packages_name = "Package"; ai.Packages.Marks1_of_packages.Text.Add("Marks"); ai.Packages.Marks2_of_packages.Text.Add("SAME"); ai.Valuation_item.Weight_itm.Gross_weight_itm = "1"; //(Decimal)ops.Quantity; ai.Valuation_item.Weight_itm.Net_weight_itm = "1"; //(Decimal)ops.Quantity; if (da.xcuda_ASYCUDA_ExtendedProperties.Customs_Procedure != null) { if (da.xcuda_ASYCUDA_ExtendedProperties.Customs_Procedure.Extended_customs_procedure != null) { ai.Tarification.Extended_customs_procedure = da.xcuda_ASYCUDA_ExtendedProperties.Customs_Procedure.Extended_customs_procedure; } if (da.xcuda_ASYCUDA_ExtendedProperties.Customs_Procedure.Extended_customs_procedure != null) { ai.Tarification.National_customs_procedure = da.xcuda_ASYCUDA_ExtendedProperties.Customs_Procedure.National_customs_procedure; } } ai.Tarification.Supplementary_unit.Add(new ASYCUDAItemTarificationSupplementary_unit()); ai.Tarification.Supplementary_unit.Add(new ASYCUDAItemTarificationSupplementary_unit()); ai.Attached_documents.Add(new ASYCUDAItemAttached_documents()); ai.Attached_documents.Add(new ASYCUDAItemAttached_documents()); ai.Attached_documents.Add(new ASYCUDAItemAttached_documents()); ai.Attached_documents.Add(new ASYCUDAItemAttached_documents()); ai.Taxation = new ASYCUDAItemTaxation(); ai.Taxation.Taxation_line.Add(new ASYCUDAItemTaxationTaxation_line()); ai.Taxation.Taxation_line.Add(new ASYCUDAItemTaxationTaxation_line()); ai.Taxation.Taxation_line.Add(new ASYCUDAItemTaxationTaxation_line()); ai.Taxation.Taxation_line.Add(new ASYCUDAItemTaxationTaxation_line()); ai.Taxation.Taxation_line.Add(new ASYCUDAItemTaxationTaxation_line()); ai.Taxation.Taxation_line.Add(new ASYCUDAItemTaxationTaxation_line()); ai.Taxation.Taxation_line.Add(new ASYCUDAItemTaxationTaxation_line()); ai.Taxation.Taxation_line.Add(new ASYCUDAItemTaxationTaxation_line()); ai.Valuation_item.Market_valuer = new ASYCUDAItemValuation_itemMarket_valuer(); return(ai); }
private void SaveGeneralInformation(ASYCUDA a, xcuda_ASYCUDA da) { if (da.xcuda_General_information != null && da.xcuda_General_information.xcuda_Country != null && da.xcuda_General_information.xcuda_Country.Country_first_destination != null && da.xcuda_General_information.xcuda_Country.Trading_country != null) { var gi = new ASYCUDAGeneral_information(); SaveCountry(gi, da.xcuda_General_information); a.General_information.Value_details = gi.Value_details; a.General_information = gi; } }
private void SaveType(xcuda_ASYCUDA da, ASYCUDA a) { if (da.xcuda_Identification.xcuda_Type != null) { if (da.xcuda_Identification.xcuda_Type.Type_of_declaration != null) { a.Identification.Type.Type_of_declaration = da.xcuda_Identification.xcuda_Type.Type_of_declaration; } if (da.xcuda_Identification.xcuda_Type.Declaration_gen_procedure_code != null) { a.Identification.Type.Declaration_gen_procedure_code = da.xcuda_Identification.xcuda_Type.Declaration_gen_procedure_code; } } }
//private readonly DocumentDSContext dbContext; public async Task <xcuda_ASYCUDA> CleanAndUpdateXcuda_ASYCUDA(xcuda_ASYCUDA doc) { var res = doc.ModifiedProperties == null? doc: doc.ChangeTracker.GetChanges().FirstOrDefault(); if (res != null) { res.xcuda_ASYCUDA_ExtendedProperties.AsycudaDocumentSet = null; //its a shared resource in multi threading res.xcuda_ASYCUDA_ExtendedProperties.Customs_Procedure = null; res.xcuda_ASYCUDA_ExtendedProperties.Document_Type = null; res.xcuda_ASYCUDA_ExtendedProperties.ExportTemplate = null; return(await Updatexcuda_ASYCUDA(res).ConfigureAwait(false)); } return(doc); }
private void SaveOfficeSegment(xcuda_ASYCUDA da, ASYCUDA a) { if (da.xcuda_Identification.xcuda_Office_segment != null) { if (da.xcuda_Identification.xcuda_Office_segment.Customs_clearance_office_code != null) { a.Identification.Office_segment.Customs_clearance_office_code.Text.Add(da.xcuda_Identification.xcuda_Office_segment.Customs_clearance_office_code); } if (da.xcuda_Identification.xcuda_Office_segment.Customs_Clearance_office_name != null) { a.Identification.Office_segment.Customs_Clearance_office_name.Text.Add(da.xcuda_Identification.xcuda_Office_segment.Customs_Clearance_office_name); } } }
private void SaveRegistration(xcuda_ASYCUDA da, ASYCUDA a) { if (da.xcuda_Identification.xcuda_Registration != null) { if (da.xcuda_Identification.xcuda_Registration.Date != null) { a.Identification.Registration.Date = da.xcuda_Identification.xcuda_Registration.Date; } if (da.xcuda_Identification.xcuda_Registration.Number != null) { a.Identification.Registration.Number = da.xcuda_Identification.xcuda_Registration.Number; } } }
private void SaveItem(xcuda_ASYCUDA da, ASYCUDA a) { if (da.xcuda_Item != null) { var lnCounter = 0; foreach (var item in da.xcuda_Item.OrderBy(x => x.LineNumber)) { lnCounter += 1; item.LineNumber = lnCounter; var ai = SetupItemProperties(da); if (item.Licence_number != null) { ai.Licence_number.Text.Add(item.Licence_number); } if (item.Quantity_deducted_from_licence != null) { ai.Quantity_deducted_from_licence = item.Quantity_deducted_from_licence; } if (item.Free_text_1 != null) { ai.Free_text_1.Text.Add(item.Free_text_1); } if (item.Free_text_2 != null) { ai.Free_text_2.Text.Add(item.Free_text_2); } // SaveAttachedDocuments(item, ai); if (item.xcuda_Tarification == null) { throw new Exception("Null Tarification, for item number: " + item.ItemNumber); } SaveTarification(item, ai); SaveGoodsDescription(item, ai); SavePreviousDoc(item, ai); SaveValuationItem(item, ai); a.Item.Add(ai); } if (a.Item.Count != 0) { a.Item[0].Packages.Number_of_packages = "1"; } } }
private void SaveValuationItem(xcuda_ASYCUDA da, ASYCUDA a) { if (da.xcuda_Valuation != null)//&& da.xcuda_Valuation.xcuda_Gs_Invoice.Amount_foreign_currency != 0 { var v = new ASYCUDAValuation(); if (da.xcuda_Valuation.Calculation_working_mode != null) { v.Calculation_working_mode = da.xcuda_Valuation.Calculation_working_mode; } SaveGSInvoice(v, da.xcuda_Valuation.xcuda_Gs_Invoice); SaveGSExternalFreight(v, da.xcuda_Valuation.xcuda_Gs_external_freight); SaveWeight(v, da.xcuda_Valuation.xcuda_Weight); a.Valuation = v; } }
private void SaveTraders(ASYCUDA a, xcuda_ASYCUDA da) { if (da.xcuda_Traders != null) { var t = new ASYCUDATraders(); var c = new ASYCUDATradersConsignee(); if (da.xcuda_Traders.xcuda_Consignee != null) { t.Consignee = new ASYCUDATradersConsignee(); if (da.xcuda_Traders.xcuda_Consignee.Consignee_code != null) { t.Consignee.Consignee_code.Text.Add(da.xcuda_Traders.xcuda_Consignee.Consignee_code); } if (da.xcuda_Traders.xcuda_Consignee.Consignee_name != null) { t.Consignee.Consignee_name.Text.Add(da.xcuda_Traders.xcuda_Consignee.Consignee_name); } } if (da.xcuda_Traders.xcuda_Exporter != null) { if (da.xcuda_Traders.xcuda_Exporter.Exporter_code != null) { t.Exporter.Exporter_code.Text.Add(da.xcuda_Traders.xcuda_Exporter.Exporter_code); } if (da.xcuda_Traders.xcuda_Exporter.Exporter_name != null) { t.Exporter.Exporter_name.Text.Add(da.xcuda_Traders.xcuda_Exporter.Exporter_name); } } if (da.xcuda_Traders.xcuda_Traders_Financial != null && da.xcuda_Traders.xcuda_Traders_Financial.Financial_code != null) { if (da.xcuda_Traders.xcuda_Traders_Financial.Financial_code != null) { t.Financial.Financial_code.Text.Add(da.xcuda_Traders.xcuda_Traders_Financial.Financial_code); } if (da.xcuda_Traders.xcuda_Traders_Financial.Financial_name != null) { t.Financial.Financial_name.Text.Add(da.xcuda_Traders.xcuda_Traders_Financial.Financial_name); } } a.Traders = t; } }
private void SaveProperty(ASYCUDA a, xcuda_ASYCUDA da) { if (da.xcuda_Property != null) { if (da.xcuda_Property.Date_of_declaration != null) { a.Property.Date_of_declaration = da.xcuda_Property.Date_of_declaration; } // a.Property.Place_of_declaration. = da.xcuda_Property.Place_of_declaration; if (da.xcuda_Property.Sad_flow != null) { a.Property.Sad_flow = da.xcuda_Property.Sad_flow; } if (da.xcuda_Property.Selected_page != null) { a.Property.Selected_page = da.xcuda_Property.Selected_page; } if (da.xcuda_Property.xcuda_Forms != null) { if (da.xcuda_Property.xcuda_Forms.Number_of_the_form != null) { a.Property.Forms.Number_of_the_form = da.xcuda_Property.xcuda_Forms.Number_of_the_form.ToString(); } if (da.xcuda_Property.xcuda_Forms.Total_number_of_forms != null) { a.Property.Forms.Total_number_of_forms = da.xcuda_Property.xcuda_Forms.Total_number_of_forms.ToString(); } } if (da.xcuda_Property.xcuda_Nbers != null) { if (da.xcuda_Property.xcuda_Nbers.Number_of_loading_lists != null) { a.Property.Nbers.Number_of_loading_lists = da.xcuda_Property.xcuda_Nbers.Number_of_loading_lists; } if (da.xcuda_Property.xcuda_Nbers.Total_number_of_items != null) { a.Property.Nbers.Total_number_of_items = da.xcuda_Property.xcuda_Nbers.Total_number_of_items; } // if(da.xcuda_Property.xcuda_Nbers.Total_number_of_packages != 0) a.Property.Nbers.Total_number_of_packages = da.xcuda_Property.xcuda_Nbers.Total_number_of_packages.ToString(); } } }
private void SaveDeclarant(xcuda_ASYCUDA da, ASYCUDA a) { if (da.xcuda_Declarant != null) { if (da.xcuda_Declarant.Declarant_code != null) { a.Declarant.Declarant_code = da.xcuda_Declarant.Declarant_code; } if (da.xcuda_Declarant.Declarant_name != null) { a.Declarant.Declarant_name = da.xcuda_Declarant.Declarant_name; } if (da.xcuda_Declarant.Declarant_representative != null) { a.Declarant.Declarant_representative = da.xcuda_Declarant.Declarant_representative; } if (da.xcuda_Declarant.Number != null) { a.Declarant.Reference.Number = da.xcuda_Declarant.Number; } } }
private void UpdateDocument(xcuda_ASYCUDA doc, DocInfo docInfo) { if (doc != null || doc.xcuda_ASYCUDA_ExtendedProperties.AutoUpdate == false) { doc.SetupProperties(); doc.xcuda_Declarant.Number = docInfo.DeclarantReferenceNumber; if (docInfo.Description != null) { doc.xcuda_ASYCUDA_ExtendedProperties.Description = docInfo.Description; } if (docInfo.Currency_Code != null) { doc.xcuda_Valuation.xcuda_Gs_Invoice.Currency_code = docInfo.Currency_Code; } doc.xcuda_ASYCUDA_ExtendedProperties.Document_TypeId = docInfo.Document_TypeId; var dt = BaseDataModel.Instance.Document_Types.FirstOrDefault(x => x.Document_TypeId == docInfo.Document_TypeId); if (dt != null) { doc.xcuda_Identification.xcuda_Type.Declaration_gen_procedure_code = dt.Declaration_gen_procedure_code; doc.xcuda_Identification.xcuda_Type.Type_of_declaration = dt.Type_of_declaration; } doc.xcuda_Valuation.xcuda_Gs_Invoice.Currency_rate = (float)docInfo.Exchange_Rate; if (docInfo.Country_of_origin_code != null) { doc.xcuda_General_information.xcuda_Country.Country_first_destination = docInfo.Country_of_origin_code; } if (docInfo.ManifestNumber != null) { doc.xcuda_Identification.Manifest_reference_number = docInfo.ManifestNumber; } if (docInfo.BlNumber != null) { doc.xcuda_ASYCUDA_ExtendedProperties.BLNumber = docInfo.BlNumber; } //if (doc.xcuda_ASYCUDA_ExtendedProperties.Customs_Procedure == null || doc.xcuda_ASYCUDA_ExtendedProperties.Customs_Procedure.Customs_ProcedureId != CustomsProcedureId) //{ var c = new Customs_Procedure(); c = BaseDataModel.Instance.Customs_Procedures.FirstOrDefault(x => x != null && x.Customs_ProcedureId == docInfo.Customs_ProcedureId); if (c == null && docInfo.Document_TypeId != null) { c = BaseDataModel.Instance.Document_Types.FirstOrDefault(x => x.Document_TypeId == docInfo.Document_TypeId).DefaultCustoms_Procedure; } if (c != null) { //TODO: implement this //foreach (var item in doc.PreviousDocumentItem // .Where(x => x.xcuda_Tarification.Extended_customs_procedure != c.Extended_customs_procedure // || x.xcuda_Tarification.National_customs_procedure != c.National_customs_procedure).ToList()) //{ // item.xcuda_Tarification.Extended_customs_procedure = c.Extended_customs_procedure; // item.xcuda_Tarification.National_customs_procedure = c.National_customs_procedure; //} } doc.xcuda_ASYCUDA_ExtendedProperties.Customs_Procedure = c; doc.xcuda_ASYCUDA_ExtendedProperties.Customs_ProcedureId = docInfo.Customs_ProcedureId; var b = docInfo.BlNumber; //TODO: Implement this //foreach (var item in doc.PreviousDocumentItem.Where(x => x.xcuda_Previous_doc.Summary_declaration != b).ToList()) //{ // item.xcuda_Previous_doc.Summary_declaration = BlNumber; //} doc.xcuda_ASYCUDA_ExtendedProperties.BLNumber = docInfo.BlNumber; } }
public async Task ReLinkPi2Item() { StatusModel.Timer("Getting Previous Items"); List <xcuda_PreviousItem> piLst = null; using (var ctx = new xcuda_PreviousItemService()) { piLst = (await ctx.Getxcuda_PreviousItem(new List <string>() { "xcuda_Item.AsycudaDocument", "xcuda_Item.EX" }).ConfigureAwait(false)).ToList(); } StatusModel.StartStatusUpdate("Re Linking PI to Items", piLst.Count()); // foreach (var pi in piLst piLst.AsParallel(new ParallelLinqOptions() { MaxDegreeOfParallelism = Environment.ProcessorCount * 2 }) .ForAll(pi => // .Where(x => x.Prev_reg_nbr == "39560" && x.Previous_item_number == "25" { var bl = String.Format("{0} {1} C {2} art. {3}", pi.Prev_reg_cuo, pi.Prev_reg_dat, pi.Prev_reg_nbr, pi.Previous_item_number); // find original row if (pi.PreviousItem_Id != 0) { var pLineNo = Convert.ToInt32(pi.Previous_item_number); // get document xcuda_ASYCUDA pdoc = null; pdoc = BaseDataModel._documentCache.Data.Where( x => x.xcuda_Identification.xcuda_Registration.Number == pi.Prev_reg_nbr) .AsEnumerable() .FirstOrDefault( x => DateTime.Parse(x.xcuda_Identification.xcuda_Registration.Date).Year.ToString() == pi.Prev_reg_dat); if (pdoc == null) { //MessageBox.Show( // string.Format("You need to import Previous Document '{0}' before importing this Ex9 '{1}'", // pi.Prev_reg_nbr, pi.xcuda_Item.AsycudaDocument.CNumber)); return; // continue; } AsycudaDocumentItem Originalitm = null; Originalitm = BaseDataModel._documentItemCache.Data.FirstOrDefault( x => pi.xcuda_Item != null && pi.xcuda_Item.ItemCost != null && pi.xcuda_Item.ItemNumber != null && (x.ItemNumber != null && x.ItemNumber.Contains( pi.xcuda_Item.ItemNumber) && x.LineNumber == pLineNo && x.AsycudaDocumentId == pdoc.ASYCUDA_Id)); if (Originalitm != null) { if (pi.xcuda_Items.Any(x => x.Item_Id == Originalitm.Item_Id) == false && Originalitm.PreviousItems.Any(x => x.PreviousItem_Id == pi.PreviousItem_Id) == false) { var epi = new EntryPreviousItems() { PreviousItem_Id = pi.PreviousItem_Id, Item_Id = Originalitm.Item_Id, TrackingState = TrackingState.Added }; // await DocumentItemDS.ViewModels.BaseDataModel.Instance.SaveEntryPreviousItems(epi).ConfigureAwait(false); DocumentItemDS.DataModels.BaseDataModel.Instance.SaveEntryPreviousItems(epi).Wait(); } } else { //MessageBox.Show( // string.Format("Item Not found {0} line: {1} PrevCNumber: {2} CNumber: {3}", // pi.xcuda_Item.EX.Precision_4, pLineNo, pdoc.xcuda_Identification.xcuda_Registration.Number, // pi.xcuda_Item.AsycudaDocument.CNumber)); } } else { throw new ApplicationException(string.Format("Item Not found {0}, LineNo:-{1}", bl, pi.Current_item_number)); } StatusModel.StatusUpdate(); } ); }
public DocumentCT() { DocumentItems = new List <xcuda_Item>(); Document = new xcuda_ASYCUDA(true); }
private void SetupProperties(ASYCUDA a, xcuda_ASYCUDA da) { ExportTemplate Exp; Exp = db.ExportTemplate.AsEnumerable().Where(x => da.xcuda_ASYCUDA_ExtendedProperties.Document_Type != null && x.Description == da.xcuda_ASYCUDA_ExtendedProperties.Document_Type.DisplayName).FirstOrDefault(); if (Exp == null && da.xcuda_ASYCUDA_ExtendedProperties.AsycudaDocumentSet != null && da.xcuda_ASYCUDA_ExtendedProperties.AsycudaDocumentSet.ExportTemplate != null) { Exp = da.xcuda_ASYCUDA_ExtendedProperties.AsycudaDocumentSet.ExportTemplate; } if (Exp == null) { Exp = db.ExportTemplate.FirstOrDefault(); } a.Financial = new ASYCUDAFinancial(); if (Exp.Deffered_payment_reference != null) { a.Financial.Deffered_payment_reference.Text.Add(Exp.Deffered_payment_reference); } a.Export_release = new ASYCUDAExport_release(); a.Identification.Office_segment.Customs_clearance_office_code.Text.Add(Exp.Customs_clearance_office_code); a.General_information = new ASYCUDAGeneral_information(); //a.Property = new ASYCUDAProperty(); //a.Property.Forms = new ASYCUDAPropertyForms(); a.Transport.Single_waybill_flag = true; a.Transport.Container_flag = false; a.Container = null; a.Property.Forms.Number_of_the_form = "1"; a.Property.Nbers.Number_of_loading_lists = "1"; a.Property.Nbers.Total_number_of_packages = "1"; a.Property.Forms.Total_number_of_forms = "1"; a.Property.Selected_page = "1"; a.Traders = new ASYCUDATraders(); if (Exp.Exporter_code != null) { a.Traders.Exporter.Exporter_code.Text.Add(Exp.Exporter_code); } if (Exp.Exporter_name != null) { a.Traders.Exporter.Exporter_name.Text.Add(Exp.Exporter_name); } if (Exp.Financial_code != null) { a.Traders.Financial.Financial_code.Text.Add(Exp.Financial_code); } if (Exp.Consignee_code != null) { a.Traders.Consignee.Consignee_code.Text.Add(Exp.Consignee_code); } if (Exp.Consignee_name != null) { a.Traders.Consignee.Consignee_name.Text.Add(Exp.Consignee_name); } a.Transit = new ASYCUDATransit(); if (Exp.Country_first_destination != null) { a.General_information.Country.Country_first_destination.Text.Add(Exp.Country_first_destination); } if (Exp.Trading_country != null) { a.General_information.Country.Trading_country.Text.Add(Exp.Trading_country); } if (Exp.Export_country_code != null) { a.General_information.Country.Export.Export_country_code = Exp.Export_country_code; } if (Exp.Destination_country_code != null) { a.General_information.Country.Destination.Destination_country_code = Exp.Destination_country_code; } if (Exp.TransportName != null) { a.Transport.Means_of_transport.Departure_arrival_information.Identity.Text.Add(Exp.TransportName); } if (Exp.TransportNationality != null) { a.Transport.Means_of_transport.Departure_arrival_information.Nationality.Text.Add(Exp.TransportNationality); } if (Exp.Location_of_goods != null) { a.Transport.Location_of_goods.Text.Add(Exp.Location_of_goods); } if (Exp.Border_information_Mode != null) { a.Transport.Means_of_transport.Border_information.Mode.Text.Add(Exp.Border_information_Mode); } if (Exp.Delivery_terms_Code != null) { a.Transport.Delivery_terms.Code.Text.Add(Exp.Delivery_terms_Code); } a.Warehouse = new ASYCUDAWarehouse(); if (Exp.Warehouse_Delay != null) { a.Warehouse.Delay = Exp.Warehouse_Delay; } if (Exp.Warehouse_Identification != null) { a.Warehouse.Identification.Text.Add(Exp.Warehouse_Identification); } a.Valuation = new ASYCUDAValuation(); if (Exp.Gs_Invoice_Currency_code != null) { a.Valuation.Gs_Invoice.Currency_code.Text.Add(Exp.Gs_Invoice_Currency_code); } a.Valuation.Gs_Invoice.Amount_foreign_currency = Math.Round(da.xcuda_Item.Where(i => i.xcuda_Valuation_item.xcuda_Item_Invoice != null).Sum(i => i.xcuda_Valuation_item.xcuda_Item_Invoice.Amount_foreign_currency), 2).ToString(); a.Suppliers_documents.Add(new ASYCUDASuppliers_documents() { Suppliers_document_invoice_amt = new ASYCUDASuppliers_documentsSuppliers_document_invoice_amt() { @null = new object() }, Suppliers_document_city = new ASYCUDASuppliers_documentsSuppliers_document_city() { @null = new object() }, Suppliers_document_code = new ASYCUDASuppliers_documentsSuppliers_document_code() { @null = new object() }, Suppliers_document_country = new ASYCUDASuppliers_documentsSuppliers_document_country() { @null = new object() }, Suppliers_document_invoice_nbr = new ASYCUDASuppliers_documentsSuppliers_document_invoice_nbr() { @null = new object() }, Suppliers_document_fax = new ASYCUDASuppliers_documentsSuppliers_document_fax() { @null = new object() }, Suppliers_document_itmlink = new ASYCUDASuppliers_documentsSuppliers_document_itmlink() { @null = new object() }, Suppliers_document_name = new ASYCUDASuppliers_documentsSuppliers_document_name() { @null = new object() }, Suppliers_document_street = new ASYCUDASuppliers_documentsSuppliers_document_street() { @null = new object() }, Suppliers_document_telephone = new ASYCUDASuppliers_documentsSuppliers_document_telephone() { @null = new object() }, Suppliers_document_type_code = new ASYCUDASuppliers_documentsSuppliers_document_type_code() { @null = new object() }, Suppliers_document_zip_code = new ASYCUDASuppliers_documentsSuppliers_document_zip_code() { @null = new object() }, Suppliers_document_date = DateTime.Now.ToString("dd/MM/yyyy") }); }