public ReportClass GetWorkDeliveryList(OutputDeliveryList list, ExpedienteList expedients) { if (list.Count == 0) { return(null); } OutputDeliveryListRpt doc = new OutputDeliveryListRpt(); List <OutputDeliveryPrint> pList = new List <OutputDeliveryPrint>(); foreach (OutputDeliveryInfo item in list) { pList.Add(OutputDeliveryPrint.New(item, expedients.GetItem(item.OidHolder))); } doc.SetDataSource(pList); FormatHeader(doc); ((TextObject)doc.Section2.ReportObjects["IDHolder_LB"]).Text = Library.Store.Resources.Labels.WORK_ID; ((TextObject)doc.Section2.ReportObjects["Holder_LB"]).Text = Library.Store.Resources.Labels.WORK; doc.Section2.ReportObjects["NFactura_LB"].ObjectFormat.EnableSuppress = true; return(doc); }
public ReportClass GetListReport(OutputDeliveryList list, ClienteList clientes) { if (list.Count == 0) { return(null); } OutputDeliveryListRpt doc = new OutputDeliveryListRpt(); List <OutputDeliveryPrint> pList = new List <OutputDeliveryPrint>(); foreach (OutputDeliveryInfo item in list) { pList.Add(OutputDeliveryPrint.New(item, clientes.GetItem(item.OidHolder), null)); } doc.SetDataSource(pList); FormatHeader(doc); return(doc); }
public ReportClass GetDetailListReport(OutputDeliveryList list, ClienteList clientes, ETipoAlbaranes tipo, DateTime fini, DateTime ffin) { if (list.Count == 0) { return(null); } AlbaranDetailListRpt doc = new AlbaranDetailListRpt(); List <OutputDeliveryPrint> pList = new List <OutputDeliveryPrint>(); List <OutputDeliveryLinePrint> conceptos = new List <OutputDeliveryLinePrint>(); foreach (OutputDeliveryInfo item in list) { pList.Add(OutputDeliveryPrint.New(item, clientes.GetItem(item.OidHolder), null)); foreach (OutputDeliveryLineInfo cp in item.Conceptos) { conceptos.Add(OutputDeliveryLinePrint.New(cp)); } } doc.SetDataSource(pList); doc.Subreports["Conceptos"].SetDataSource(conceptos); doc.SetParameterValue("Empresa", Schema.Name); doc.SetParameterValue("Tipo", tipo.ToString()); doc.SetParameterValue("FIni", fini); doc.SetParameterValue("FFin", ffin); return(doc); }
/// <summary> /// Crea los conceptos de factura asociados a un albarán /// </summary> /// <param name="source"></param> public virtual void Compact(OutputInvoice invoice) { if (this.Count == 0) { return; } OutputDelivery main_albaran = null; Cash caja = null; try { List <long> oid_list = new List <long>(); foreach (AlbaranFactura item in this) { oid_list.Add(item.OidAlbaran); } OutputDeliveryList albaranes = OutputDeliveryList.GetList(oid_list, true); main_albaran = OutputDelivery.Get(oid_list[0], true, invoice.SessionCode); foreach (AlbaranFactura af in this) { if (af.OidAlbaran == main_albaran.Oid) { continue; } OutputDeliveryInfo source = albaranes.GetItem(af.OidAlbaran); main_albaran.Merge(source); } main_albaran.Compact(); SortedBindingList <AlbaranFactura> sorted_list = this.GetSortedList("CodigoAlbaran", ListSortDirection.Ascending); OutputDeliveryInfo first_albaran = OutputDeliveryInfo.Get(sorted_list[0].OidAlbaran, ETipoEntidad.Cliente, false); main_albaran.CopyFrom(invoice); main_albaran.Codigo = first_albaran.Codigo; main_albaran.Serial = first_albaran.Serial; main_albaran.Save(); ToDelete = new List <OutputDeliveryInfo>(); for (int i = 1; i < oid_list.Count; i++) { Remove(GetItemByAlbaran(oid_list[i]).Oid); ToDelete.Add(albaranes.GetItem(oid_list[i])); } CashLine.DeleteByAlbaranList(albaranes.GetListInfo(), ModulePrincipal.GetCajaTicketsSetting()); Ticket.DeleteFromList(albaranes.GetListInfo()); //Actualizamos la caja de Tickets caja = Cash.Get(ModulePrincipal.GetCajaTicketsSetting(), true, invoice.SessionCode); caja.UpdateSaldo(); caja.SaveAsChild(); AlbaranFactura ab = GetItemByAlbaran(main_albaran.Oid); ab.CodigoAlbaran = main_albaran.Codigo; } catch (Exception ex) { throw ex; } finally { Cache.Instance.Remove(typeof(ClienteList)); Cache.Instance.Remove(typeof(ProductList)); } }
private void ExportToInputDelivery() { InputDeliveries in_deliveries = null; ISchemaInfo current_schema = AppContext.ActiveSchema; try { List <OutputDeliveryInfo> list = _config.SourceEntityList as List <OutputDeliveryInfo>; List <long> oids = new List <long> ( from item in list select(item as OutputDeliveryInfo).Oid ); OutputDeliveryList out_deliveries = OutputDeliveryList.GetList(oids, true); ProductList source_products = ProductList.GetList(false); string fromCurrencyIso = (AppContext.ActiveSchema as CompanyInfo).CurrencyIso; string fromCurrency = (AppContext.ActiveSchema as CompanyInfo).Currency; //Move to new schema to create destination entities AppContext.Principal.ChangeUserSchema(_config.DestinationCompany); string toCurrencyIso = (AppContext.ActiveSchema as CompanyInfo).CurrencyIso; string toCurrency = (AppContext.ActiveSchema as CompanyInfo).Currency; decimal currencyRate = 1; if (fromCurrencyIso != toCurrencyIso) { currencyRate = CurrencyExchange.GetCurrencyRate(fromCurrencyIso, toCurrencyIso); } if (currencyRate == 0) { throw new iQException(string.Format(Resources.Messages.NO_CURRENCY_EXCHANGE_RATE, fromCurrency, toCurrency), new object[2] { ETipoEntidad.CurrencyExchange, 0 }); } in_deliveries = InputDeliveries.NewList(); ProductList dest_products = ProductList.GetList(false); foreach (OutputDeliveryInfo item in out_deliveries) { InputDelivery delivery = in_deliveries.NewItem(); delivery.CopyFrom(item, _config.DestinationHolder as IAcreedorInfo); foreach (OutputDeliveryLineInfo line in item.Conceptos) { ProductInfo source_product = source_products.GetItem(line.OidProducto); if (string.IsNullOrEmpty(source_product.ExternalCode)) { throw new iQException(string.Format(Resources.Messages.NO_PRODUCT_EXTERNAL_CODE, source_product.Codigo, source_product.Nombre), new object[2] { ETipoEntidad.Producto, source_product.Oid }); } List <ProductInfo> dest_product = new List <ProductInfo> ( from p in dest_products where p.ExternalCode == source_product.ExternalCode select p ); if (dest_product.Count() == 0) { throw new iQException(string.Format(Resources.Messages.PRODUCT_EXTERNAL_CODE_MISSMATCH, source_product.Codigo, source_product.Nombre), new object[2] { ETipoEntidad.Producto, source_product.Oid }); } delivery.Conceptos.NewItem(delivery, line, dest_product[0], currencyRate); } delivery.CalculateTotal(); } in_deliveries.Save(); } catch (Exception ex) { if (in_deliveries != null) { in_deliveries.CloseSession(); } throw ex; } finally { //Move back to active schema AppContext.Principal.ChangeUserSchema(current_schema); } }