protected void ModifyFilterExpression(string FieldName, object value, ASPxGridView targetGrid) { var criterias = CriteriaColumnAffinityResolver.SplitByColumnNames(CriteriaOperator.Parse(targetGrid.FilterExpression)).Item2; CriteriaOperator co = null; if (FieldName == "ProductName") { value += "%"; co = new FunctionOperator("Like", new OperandProperty(FieldName), new OperandValue(value)); } else { co = new BinaryOperator(FieldName, value, BinaryOperatorType.Equal); } if (!criterias.Keys.Contains(FieldName)) { criterias.Add(FieldName, co); } else { criterias[FieldName] = co; } targetGrid.FilterExpression = CriteriaOperator.ToString(GroupOperator.And(criterias.Values)); }
protected void ModifyFilterExpression(string FieldName, object value, ASPxCardView victim) { var criterias = CriteriaColumnAffinityResolver.SplitByColumnNames(CriteriaOperator.Parse(victim.FilterExpression)).Item2; BinaryOperatorType operatorType; if (FieldName == "ProductName") { operatorType = BinaryOperatorType.Like; value += "%"; } else { operatorType = BinaryOperatorType.Equal; } if (!criterias.Keys.Contains(FieldName)) { criterias.Add(FieldName, new BinaryOperator(FieldName, value, operatorType)); } else { criterias[FieldName] = new BinaryOperator(FieldName, value, operatorType); } victim.FilterExpression = CriteriaOperator.ToString(GroupOperator.And(criterias.Values)); }
public static IQueryable ApplyFilter(this IQueryable query, IList <GridViewGroupInfo> groupInfoList) { var criteria = GroupOperator.And( groupInfoList.Select(i => new BinaryOperator(i.FieldName, i.KeyValue, BinaryOperatorType.Equal)) ); return(query.ApplyFilter(CriteriaOperator.ToString(criteria))); }
public string GetExpression(bool useSearch) { var search = useSearch ? SearchCriteria : null; var filterControl = CriteriaOperator.Parse(FilterControlExpression); var criteria = GroupOperator.And(filterControl, search); return(!object.ReferenceEquals(criteria, null) ? criteria.ToString() : string.Empty); }
private void Changed(int i = 0) { iflag = i; this.tileView1.ClearColumnsFilter(); criteriaOperator.Clear(); Txt_FoodNameEditValueChanged(); // radioGroup1SelectedIndexChanged(radioGroup1.SelectedIndex); radioGroup1SelectedIndexChanged(i); this.tileView1.ActiveFilterCriteria = GroupOperator.And(criteriaOperator); }
public IList <BankStmt> GetSourceObjects(IEnumerable <Activity> activitiesToMap, IEnumerable <Account> accountsToMap) { var paramObj = this.paramObj; var session = paramObj.Session; var cop = CriteriaOperator.Parse("TranDate Between(?, ?)", paramObj.FromDate, paramObj.ToDate); cop = GroupOperator.And(cop, new InOperator("Activity", activitiesToMap)); cop = GroupOperator.And(cop, new InOperator("Account", accountsToMap)); return(new XPCollection <BankStmt>(session, cop)); }
protected string UpdateGridFilterExpression(ASPxGridView grid, ASPxGridViewAutoFilterEventArgs e) { var gridCriteria = CriteriaOperator.Parse(grid.FilterExpression); gridCriteria = CriteriaVisitor.RemoveCustomFunction(gridCriteria, e.Column.FieldName); var customCriteria = new FunctionOperator(FunctionOperatorType.Custom, MyCustomFunctionOperator.Name, e.Value, new OperandProperty(e.Column.FieldName), new OperandProperty(OtherFilterColumnFieldName)); if (ReferenceEquals(gridCriteria, null) && ReferenceEquals(customCriteria, null)) { return(string.Empty); } return(GroupOperator.And(gridCriteria, customCriteria).ToString()); }
private void Exporting(SelectExportBookingParameters selectedExportParameters) { if (selectedExportParameters == null) { return; } if (selectedExportParameters.Employee == null) { MessageBox.Show(CaptionHelper.GetLocalizedText("Texts", "NO_EMPLOYEE_SELECTED"), CaptionHelper.GetLocalizedText("Texts", "Error"), MessageBoxButtons.OK, MessageBoxIcon.Information); return; } var firstDayOfMonth = selectedExportParameters.ExportStart.ToShortDateString(); var lastDayOfMonth = selectedExportParameters.ExportEnd.ToShortDateString(); var bookingCriteria = GroupOperator.And( new BinaryOperator("Employee", selectedExportParameters.Employee), new BinaryOperator("Date", firstDayOfMonth, BinaryOperatorType.GreaterOrEqual), new BinaryOperator("Date", lastDayOfMonth, BinaryOperatorType.LessOrEqual)); var bookings = new List <IBooking>(); if (selectedExportParameters.WithVacation) { bookings = _objectSpace.GetObjects <IBooking>(bookingCriteria) .ToList(); } else { bookings = _objectSpace.GetObjects <IBooking>(bookingCriteria) .Where(b => !b.IsVacation && !b.IsPublicHoliday) .ToList(); } if (!bookings.Any()) { return; } var saveFolder = SelectFolderToSaveBookingExport(); if (saveFolder != null) { BookingExporter.ExportJdcBookings(_objectSpace, saveFolder, bookings); } }
public IList <CashFlow> GetSourceObjects(IEnumerable <Activity> activitiesToMap, IEnumerable <Account> accountsToMap) { var paramObj = this.paramObj; var session = paramObj.Session; var excludeSource = SetOfBooks.GetInstance(objSpace).BankStmtCashFlowSource; var currentSnapshot = SetOfBooks.GetInstance(objSpace).CurrentCashFlowSnapshot; var cop = CriteriaOperator.Parse( string.Format("{0} Between(?, ?) And {1} <> ? And {2} = ?", CashFlow.Fields.TranDate.PropertyName, CashFlow.Fields.Source.PropertyName, CashFlow.Fields.Snapshot.PropertyName), paramObj.FromDate, paramObj.ToDate, excludeSource, currentSnapshot); cop = GroupOperator.And(cop, new InOperator("Activity", activitiesToMap)); cop = GroupOperator.And(cop, new InOperator("Account", accountsToMap)); return(new XPCollection <CashFlow>(session, cop)); }
protected CriteriaOperator MergeCriterias(CriteriaOperator co, FunctionOperator fo) { if (ReferenceEquals(fo, null)) { return(co); } if (ReferenceEquals(co, null)) { return(fo); } var go = co as GroupOperator; if (ReferenceEquals(go, null) || go.OperatorType != GroupOperatorType.And) { return(GroupOperator.And(co, fo)); } go.Operands.Add(fo); return(go); }
void dialog_Accepting(object sender, DevExpress.ExpressApp.SystemModule.DialogControllerAcceptingEventArgs e) { var session = _ParamObj.Session; var jnlGroupKeysInParams = _ParamObj.JournalGroupParams.Select(p => p.JournalGroup.Oid); var sortProps = new SortingCollection(null); sortProps.Add(new SortProperty("SrcDate", DevExpress.Xpo.DB.SortingDirection.Ascending)); var cop = CriteriaOperator.Parse("SrcDate Between(?,?)", _ParamObj.FromDate, _ParamObj.ToDate); var copGenLedgerInJnlGroups = new InOperator("JournalGroup.Oid", jnlGroupKeysInParams); cop = GroupOperator.And(cop, copGenLedgerInJnlGroups); var genLedgers = session.GetObjects(session.GetClassInfo(typeof(GenLedger)), cop, sortProps, 0, false, true); ExcelWorksheet ws = Package.Workbook.Worksheets["Data"]; ExcelReportHelper.CopyObjectsToWorksheet(session, genLedgers, ws); session.CommitTransaction(); }
public Form1() { InitializeComponent(); dashboardDesigner1.CreateRibbon(); Dashboard dashboard = new Dashboard(); dashboard.LoadFromXml(@"..\..\Data\Dashboard.xml"); PivotDashboardItem pivot1 = (PivotDashboardItem)dashboard.Items[0]; DashboardOlapDataSource olapDataSource = (DashboardOlapDataSource)dashboard.DataSources[0]; string fieldYearName = "[Date].[Calendar].[Calendar Year]"; string year2001 = "[Date].[Calendar].[Calendar Year].&[2001]"; string year2002 = "[Date].[Calendar].[Calendar Year].&[2002]"; string fieldCountryName = "[Customer].[Country].[Country]"; string countryCanada = "[Customer].[Country].&[Canada]"; DynamicListLookUpSettings settings = new DynamicListLookUpSettings(); settings.DataSource = olapDataSource; settings.ValueMember = fieldCountryName; DashboardParameter parameter1 = new DashboardParameter("Parameter1", typeof(string), countryCanada, "Category", true, settings); dashboard.Parameters.Add(parameter1); CriteriaOperator filterCriteria = GroupOperator.And( new BinaryOperator(new OperandProperty(fieldCountryName), new OperandParameter(parameter1.Name), BinaryOperatorType.Equal), new NotOperator(new InOperator(new OperandProperty(fieldYearName), new ConstantValue[] { new ConstantValue(year2001), new ConstantValue(year2002) }))); pivot1.FilterString = filterCriteria.ToString(); dashboardDesigner1.Dashboard = dashboard; }
protected void Page_Load(object sender, EventArgs e) { Dashboard dashboard = new Dashboard(); dashboard.LoadFromXml(HostingEnvironment.MapPath(@"~/App_Data/Dashboard.xml")); PivotDashboardItem pivot1 = (PivotDashboardItem)dashboard.Items[0]; DashboardOlapDataSource olapDataSource = (DashboardOlapDataSource)dashboard.DataSources[0]; string fieldYearName = "[Date].[Calendar].[Calendar Year]"; string year2001 = "[Date].[Calendar].[Calendar Year].&[2001]"; string year2002 = "[Date].[Calendar].[Calendar Year].&[2002]"; string fieldCountryName = "[Customer].[Country].[Country]"; string countryCanada = "[Customer].[Country].&[Canada]"; DynamicListLookUpSettings settings = new DynamicListLookUpSettings(); settings.DataSource = olapDataSource; settings.ValueMember = fieldCountryName; DashboardParameter parameter1 = new DashboardParameter("Parameter1", typeof(string), countryCanada, "Category", true, settings); dashboard.Parameters.Add(parameter1); CriteriaOperator filterCriteria = GroupOperator.And( new BinaryOperator(new OperandProperty(fieldCountryName), new OperandParameter(parameter1.Name), BinaryOperatorType.Equal), new NotOperator(new InOperator(new OperandProperty(fieldYearName), new ConstantValue[] { new ConstantValue(year2001), new ConstantValue(year2002) }))); pivot1.FilterString = filterCriteria.ToString(); ASPxDashboard1.OpenDashboard(dashboard.SaveToXDocument()); }
/// <summary> /// Recursive function for pagination /// </summary> /// <param name="pEntry"></param> /// <param name="dialog"></param> /// <returns></returns> public int PopuDialogMore(Entry pEntry, PosSelectRecordDialog <XPCollection, XPGuidObject, T2> dialog) { DialogResponseType response = (DialogResponseType)dialog.Run(); // Recapture RowActivated : DoubleClick and trigger dialog.Respond dialog.GenericTreeView.TreeView.RowActivated += delegate { SelectRecord(pEntry, dialog); }; if (DialogResponseType.Ok.Equals(response)) { SelectRecord(pEntry, dialog); } //Pagination response if (DialogResponseType.LoadMore.Equals(response)) { dialog.GenericTreeView.DataSource.TopReturnedObjects = (SettingsApp.PaginationRowsPerPage * dialog.GenericTreeView.CurrentPageNumber); dialog.GenericTreeView.Refresh(); PopuDialogMore(pEntry, dialog); } //Filter response else if (DialogResponseType.Filter.Equals(response)) { //Reset current page to 1 ( Pagination go to defined initialy ) // Filter SellDocuments string filterField = string.Empty; string statusField = string.Empty; string extraFilter = string.Empty; List <string> result = new List <string>(); PosReportsQueryDialog dialogFilter = new PosReportsQueryDialog(dialog, DialogFlags.DestroyWithParent, ReportsQueryDialogMode.FILTER_DOCUMENTS_PAGINATION, "fin_documentfinancemaster"); DialogResponseType responseFilter = (DialogResponseType)dialogFilter.Run(); //If button Clean Filter Clicked if (DialogResponseType.CleanFilter.Equals(responseFilter)) { dialog.GenericTreeView.CurrentPageNumber = 1; dialog.GenericTreeView.DataSource.Criteria = CriteriaOperatorLastFilter; dialog.GenericTreeView.DataSource.TopReturnedObjects = SettingsApp.PaginationRowsPerPage * dialog.GenericTreeView.CurrentPageNumber; dialog.GenericTreeView.Refresh(); dialogFilter.Destroy(); PopuDialogMore(pEntry, dialog); } //If OK filter clicked else if (DialogResponseType.Ok.Equals(responseFilter)) { dialog.GenericTreeView.CurrentPageNumber = 1; filterField = "DocumentType"; statusField = "DocumentStatusStatus"; /* IN009066 - FS and NC added to reports */ //extraFilter = $@" AND ({statusField} <> 'A') AND ( // {filterField} = '{SettingsApp.XpoOidDocumentFinanceTypeInvoice}' OR // {filterField} = '{SettingsApp.XpoOidDocumentFinanceTypeSimplifiedInvoice}' OR // {filterField} = '{SettingsApp.XpoOidDocumentFinanceTypeInvoiceAndPayment}' OR // {filterField} = '{SettingsApp.XpoOidDocumentFinanceTypeConsignationInvoice}' OR // {filterField} = '{SettingsApp.XpoOidDocumentFinanceTypeDebitNote}' OR // {filterField} = '{SettingsApp.XpoOidDocumentFinanceTypeCreditNote}' OR // {filterField} = '{SettingsApp.XpoOidDocumentFinanceTypePayment}' // OR // {filterField} = '{SettingsApp.XpoOidDocumentFinanceTypeCurrentAccountInput}' // )".Replace(Environment.NewLine, string.Empty); /* IN009089 - # TO DO: above, we need to check with business this condition: {filterField} = '{SettingsApp.XpoOidDocumentFinanceTypeCurrentAccountInput}' */ //Assign Dialog FilterValue to Method Result Value result.Add($"{dialogFilter.FilterValue}"); result.Add(dialogFilter.FilterValueHumanReadble); //string addFilter = FilterValue; CriteriaOperator criteriaOperatorLast = dialog.GenericTreeView.DataSource.Criteria; CriteriaOperator criteriaOperator = GroupOperator.And(CriteriaOperatorLastFilter, CriteriaOperator.Parse(result[0])); //lastData = dialog.GenericTreeView.DataSource; dialog.GenericTreeView.DataSource.Criteria = criteriaOperator; dialog.GenericTreeView.DataSource.TopReturnedObjects = SettingsApp.PaginationRowsPerPage * dialog.GenericTreeView.CurrentPageNumber; dialog.GenericTreeView.Refresh(); //se retornar zero resultados apresenta dados anteriores ao filtro if (dialog.GenericTreeView.DataSource.Count == 0) { dialog.GenericTreeView.DataSource.Criteria = criteriaOperatorLast; dialog.GenericTreeView.DataSource.TopReturnedObjects = SettingsApp.PaginationRowsPerPage * dialog.GenericTreeView.CurrentPageNumber; dialog.GenericTreeView.Refresh(); } dialogFilter.Destroy(); PopuDialogMore(pEntry, dialog); } //If Cancel Filter Clicked else { dialogFilter.Destroy(); PopuDialogMore(pEntry, dialog); } } //Button Close clicked else { dialog.Destroy(); } return((int)response); }
/// <summary> /// Método responsável por buscar as cores a partir de uma lista de usernames (Logins) passada. /// </summary> /// <param name="session">Sessão Corrente</param> /// <param name="logins">Lista com logins dos usuários</param> /// <returns>Lista de objetos ProjetoColaboradorCondfig</returns> public static List <ProjetoColaboradorConfig> GetConfigColaboradores(Session session, List <string> logins, Guid oidProjeto) { if (session == null || logins == null) { throw new ArgumentException("Os parâmetros session e login usuários não podem ser nulos."); } List <ProjetoColaboradorConfig> configs = new List <ProjetoColaboradorConfig>(); using (XPCollection <ProjetoColaboradorConfig> colecaoConfigs = new XPCollection <ProjetoColaboradorConfig>(session, GroupOperator.And(new InOperator("Colaborador.Usuario.UserName", logins), CriteriaOperator.Parse("OidProjeto = ?", oidProjeto)))) { configs = colecaoConfigs.ToList(); } return(configs); }
public ActionResult Index() { #region --- Criteria Operator (parse), Group Operator, Binary Operator, Between Operator --- //1. binary with condition BinaryOperator filter = new BinaryOperator("Age", "23"); XPCollection <Customer> dataCustomer = new XPCollection <Customer>(session, filter); BinaryOperator filter1 = new BinaryOperator(); XPCollection <Customer> dataCustomer1 = new XPCollection <Customer>(session, filter1); //2. Criteria Operator, Group Operator CriteriaOperator filter2 = CriteriaOperator.Parse("Age < 20"); CriteriaOperator filter3 = CriteriaOperator.Parse("Age > 30"); XPCollection <Customer> dataCustomer2 = new XPCollection <Customer>(session, GroupOperator.Or(filter2, filter3)); CriteriaOperator filter4 = CriteriaOperator.Parse("Age > 20"); CriteriaOperator filter5 = CriteriaOperator.Parse("Age < 30"); XPCollection <Customer> dataCustomer3 = new XPCollection <Customer>(session, GroupOperator.And(filter4, filter5)); //3. Between Operator CriteriaOperator filter6 = new BetweenOperator("Age", 20, 30); XPCollection <Customer> dataCustomer4 = new XPCollection <Customer>(session, filter6); //4. Contain Operator ??? //ContainsOperator filter7 = new ContainsOperator("Name","on"); //XPCollection<Customer> dataCustomer5 = new XPCollection<Customer>(session, filter7); //5. In Operator //xpCollection1.Filter = new InOperator("Name", new string[] {"John", "Mike", "Nick"}); #endregion return(View()); }
private void singleChoiceActionPolz_Execute(object sender, DevExpress.ExpressApp.Actions.SingleChoiceActionExecuteEventArgs e) { XPObjectSpace objectSpace = (XPObjectSpace)View.ObjectSpace; int mes = Convert.ToInt32((e.SelectedChoiceActionItem.Data)); int ano = mes == 12 && DateTime.Today.Month == 1 ? DateTime.Today.Year - 1 : DateTime.Today.Year; DateTime mFechaIni = apl.Log.Fecha.FechaInicial(mes, ano); DateTime mFechaFin = apl.Log.Fecha.FechaFinal(mes, ano); CriteriaOperator[] operands = new CriteriaOperator[2]; XmlDocument docXml = new XmlDocument(); Ventas vta = objectSpace.FindObject <Ventas>(null); operands[0] = GroupOperator.And(new BinaryOperator("FechaDoc", mFechaIni, BinaryOperatorType.GreaterOrEqual), new BinaryOperator("FechaDoc", mFechaFin, BinaryOperatorType.LessOrEqual)); operands[1] = new BinaryOperator("Status", DocumentoStatus.Cancelado, BinaryOperatorType.NotEqual); SortProperty [] sortCollection = new SortProperty[1]; sortCollection[0] = new SortProperty("FechaDoc", SortingDirection.Ascending); IList arr = objectSpace.CreateCollection(typeof(DocumentoSalida), new GroupOperator(operands), sortCollection); if (arr.Count > 0) { string filename = string.Format("{0}.POL", mFechaIni.Month); using (new apl.Log.CWaitCursor()) { XmlDeclaration declaracion = docXml.CreateXmlDeclaration("1.0", null, "yes"); docXml.InsertBefore(declaracion, docXml.DocumentElement); // docXml.LoadXml("<?xml version=\"1.0\" standalone=\"yes\"?>"); XmlElement data = docXml.CreateElement("DATAPACKET"); data.SetAttribute("Version", "2.0"); docXml.AppendChild(data); XmlElement meta = docXml.CreateElement("METADATA"); data.AppendChild(meta); XmlElement fields = docXml.CreateElement("FIELDS"); meta.AppendChild(fields); XmlElement field = docXml.CreateElement("FIELD"); field.SetAttribute("attrname", "VersionCOI"); field.SetAttribute("fieldtype", "i2"); fields.AppendChild(field); field = docXml.CreateElement("FIELD"); field.SetAttribute("attrname", "TipoPoliz"); field.SetAttribute("fieldtype", "string"); field.SetAttribute("WIDTH", "2"); fields.AppendChild(field); field = docXml.CreateElement("FIELD"); field.SetAttribute("attrname", "DiaPoliz"); field.SetAttribute("fieldtype", "string"); field.SetAttribute("WIDTH", "2"); fields.AppendChild(field); field = docXml.CreateElement("FIELD"); field.SetAttribute("attrname", "ConcepPoliz"); field.SetAttribute("fieldtype", "string"); field.SetAttribute("WIDTH", "120"); fields.AppendChild(field); XmlElement fieldP = docXml.CreateElement("FIELD"); fieldP.SetAttribute("attrname", "Partidas"); fieldP.SetAttribute("fieldtype", "nested"); fields.AppendChild(fieldP); XmlElement fields2 = docXml.CreateElement("FIELDS"); fieldP.AppendChild(fields2); field = docXml.CreateElement("FIELD"); field.SetAttribute("attrname", "Cuenta"); field.SetAttribute("fieldtype", "string"); field.SetAttribute("WIDTH", "21"); fields2.AppendChild(field); field = docXml.CreateElement("FIELD"); field.SetAttribute("attrname", "Depto"); field.SetAttribute("fieldtype", "i4"); fields2.AppendChild(field); field = docXml.CreateElement("FIELD"); field.SetAttribute("attrname", "ConceptoPol"); field.SetAttribute("fieldtype", "string"); field.SetAttribute("WIDTH", "120"); fields2.AppendChild(field); field = docXml.CreateElement("FIELD"); field.SetAttribute("attrname", "Monto"); field.SetAttribute("fieldtype", "r8"); fields2.AppendChild(field); field = docXml.CreateElement("FIELD"); field.SetAttribute("attrname", "TipoCambio"); field.SetAttribute("fieldtype", "r8"); fields2.AppendChild(field); field = docXml.CreateElement("FIELD"); field.SetAttribute("attrname", "DebeHaber"); field.SetAttribute("fieldtype", "string"); field.SetAttribute("WIDTH", "1"); fields2.AppendChild(field); XmlElement parm = docXml.CreateElement("PARAMS"); fieldP.AppendChild(parm); XmlElement parm1 = docXml.CreateElement("PARAMS"); meta.AppendChild(parm1); XmlElement rowd = docXml.CreateElement("ROWDATA"); data.AppendChild(rowd); XmlElement row = docXml.CreateElement("ROW"); row.SetAttribute("VersionCOI", "50"); row.SetAttribute("TipoPoliz", "Dr"); row.SetAttribute("DiaPoliz", string.Format("{0}", arr.Count + 1)); row.SetAttribute("ConcepPoliz", string.Format("RELACION DE FACTURAS DE {0} {1}", mFechaIni.ToString("MMMM").ToUpper(), mFechaIni.ToString("yyyy"))); rowd.AppendChild(row); XmlElement par = docXml.CreateElement("Partidas"); row.AppendChild(par); decimal tot = 0; string[] nivs; string aux = string.Empty; foreach (DocumentoSalida doc in arr) { XmlElement part = docXml.CreateElement("ROWPartidas"); nivs = string.IsNullOrEmpty(doc.Cliente.Cuenta) ? null : doc.Cliente.Cuenta.Split('-'); if (nivs != null) { aux = string.Concat(nivs); } part.SetAttribute("Cuenta", string.Format("{0}2", aux.PadRight(20, '0'))); part.SetAttribute("Depto", "0"); aux = string.Format("F-{0} {1}", doc.Clave.Trim(), ((PartidaSalida)(doc.VentaItems[0])).Descripcion); part.SetAttribute("ConceptoPol", aux.Length > 120 ? aux.Substring(0, 119) : aux); part.SetAttribute("Monto", doc.Total.ToString("F2")); part.SetAttribute("TipoCambio", "1"); part.SetAttribute("DebeHaber", "D"); par.AppendChild(part); tot += doc.Total; } XmlElement parth = docXml.CreateElement("ROWPartidas"); nivs = string.IsNullOrEmpty(vta.Cuenta) ? null : vta.Cuenta.Split('-'); if (nivs != null) { aux = string.Concat(nivs); } parth.SetAttribute("Cuenta", string.Format("{0}2", aux.PadRight(20, '0'))); parth.SetAttribute("Depto", "0"); parth.SetAttribute("ConceptoPol", string.Format("RELACION DE FACTURAS DE {0} {1}", mFechaIni.ToString("MMMM").ToUpper(), mFechaIni.ToString("yyyy"))); parth.SetAttribute("Monto", tot.ToString("F2")); parth.SetAttribute("TipoCambio", "1"); parth.SetAttribute("DebeHaber", "H"); par.AppendChild(parth); docXml.Save(filename); } } }
private void simpleActionRprtCntbl_Execute(object sender, DevExpress.ExpressApp.Actions.SimpleActionExecuteEventArgs e) { if (View != null) { int i = 5; Empresa emp = View.ObjectSpace.FindObject <Empresa>(null); // Servicios Profesionales Workbook book = new Workbook(); var sheet = book.Worksheets.ActiveWorksheet; sheet.Cells[0, 0].Value = emp.Compania.Nombre; sheet.Cells[0, 3].Value = emp.Compania.Rfc; sheet.Cells[1, 0].Value = (emp.Regimenes != null && emp.Regimenes.Count > 0) ? (emp.Regimenes[0] as RegimenEmpresa).Rgmn.Dscrpcn : string.Empty; // emp.Regimen; TIT Sep 2018 int ano = DateTime.Today.Month == 1 ? DateTime.Today.Year - 1 : DateTime.Today.Year; sheet.Cells["A4"].Value = string.Format("Ejercicio {0}.", ano); sheet.Cells[i++, 0].Value = "ENERO"; sheet.Cells[i++, 0].Value = "FEBRERO"; sheet.Cells[i++, 0].Value = "Acumulado"; sheet.Cells[i++, 0].Value = "MARZO"; sheet.Cells[i++, 0].Value = "Acumulado"; sheet.Cells[i++, 0].Value = "ABRIL"; sheet.Cells[i++, 0].Value = "Acumulado"; sheet.Cells[i++, 0].Value = "MAYO"; sheet.Cells[i++, 0].Value = "Acumulado"; sheet.Cells[i++, 0].Value = "JUNIO"; sheet.Cells[i++, 0].Value = "Acumulado"; sheet.Cells[i++, 0].Value = "JULIO"; sheet.Cells[i++, 0].Value = "Acumulado"; sheet.Cells[i++, 0].Value = "AGOSTO"; sheet.Cells[i++, 0].Value = "Acumulado"; sheet.Cells[i++, 0].Value = "SEPTIEMBRE"; sheet.Cells[i++, 0].Value = "Acumulado"; sheet.Cells[i++, 0].Value = "OCTUBRE"; sheet.Cells[i++, 0].Value = "Acumulado"; sheet.Cells[i++, 0].Value = "NOVIEMBRE"; sheet.Cells[i++, 0].Value = "Acumulado"; sheet.Cells[i++, 0].Value = "DICIEMBRE"; sheet.Cells[i++, 0].Value = "Tota Acumulado"; sheet.Cells["c3"].Value = "ISR"; sheet.Cells["c3"].Font.FontStyle = SpreadsheetFontStyle.Bold; // Access the range of cells to be formatted. CellRange range = sheet.Range["C4:G4"]; // Begin updating of the range formatting. DevExpress.Spreadsheet.Formatting rangeFormatting = range.BeginUpdateFormatting(); // Specify font settings (font name, color, size and style). rangeFormatting.Font.Name = "Arial"; // rangeFormatting.Font.Color = Color.Blue; rangeFormatting.Font.Size = 8; // rangeFormatting.Font.FontStyle = SpreadsheetFontStyle.Bold; // Specify cell background color. rangeFormatting.Fill.BackgroundColor = Color.LightGray; // Specify text alignment in cells. rangeFormatting.Alignment.Vertical = SpreadsheetVerticalAlignment.Center; rangeFormatting.Alignment.Horizontal = SpreadsheetHorizontalAlignment.Center; rangeFormatting.Alignment.WrapText = true; // End updating of the range formatting. range.EndUpdateFormatting(rangeFormatting); range = sheet.Range["G3:K3"]; // Begin updating of the range formatting. rangeFormatting = range.BeginUpdateFormatting(); // Specify font settings (font name, color, size and style). rangeFormatting.Font.Name = "Arial"; // rangeFormatting.Font.Color = Color.Blue; rangeFormatting.Font.Size = 8; // rangeFormatting.Font.FontStyle = SpreadsheetFontStyle.Bold; // Specify cell background color. rangeFormatting.Fill.BackgroundColor = Color.LightGray; // Specify text alignment in cells. rangeFormatting.Alignment.Vertical = SpreadsheetVerticalAlignment.Center; rangeFormatting.Alignment.Horizontal = SpreadsheetHorizontalAlignment.Center; rangeFormatting.Alignment.WrapText = true; // End updating of the range formatting. range.EndUpdateFormatting(rangeFormatting); sheet.Cells["c4"].Value = string.Format("INGRESOS{0}(Cobrados por sus{0}ventas o servicios){0}Sin incluir IVA", Environment.NewLine); /* * sheet.Cells["c4"].Alignment.Vertical = SpreadsheetVerticalAlignment.Justify; * sheet.Cells["c4"].Alignment.Horizontal = SpreadsheetHorizontalAlignment.Center; * sheet.Cells["c4"].Alignment.ShrinkToFit = true; * sheet.Cells["c4"].Alignment.WrapText = true;*/ sheet.Columns[2].Width = 350; sheet.Columns[3].Width = 340; sheet.Columns[4].Width = 340; sheet.Columns[6].Width = 330; sheet.Columns[7].Width = 330; sheet.Columns[8].Width = 330; sheet.Columns[9].Width = 330; sheet.Columns[10].Width = 330; sheet.Cells["d4"].Value = string.Format("DEDUCCIONES{0}(Compras y/o{0}gastos, sin incluir{0}IVA", Environment.NewLine); sheet.Cells["e4"].Value = string.Format("INGRESOS ACUMULABLES -{0}DEDUCCIONES ACUMULABLES ={0}BASE", Environment.NewLine); sheet.Cells["f4"].Value = "ISR RETENIDO"; sheet.Cells["g3"].Value = "PAGOS (Provisionales)"; sheet.Cells["g4"].Value = "ISR"; sheet.Rows[3].Height = 260; sheet.Cells["h3"].Value = string.Format("IVA{0}(Causado por{0}sus ventas o{0}servicios)", Environment.NewLine); sheet.Cells["i3"].Value = string.Format("IVA{0}(Acreditable por{0}sus compras y/o{0}gastos)", Environment.NewLine); sheet.Cells["j3"].Value = string.Format("IVA{0}RETENIDO", Environment.NewLine); sheet.Cells["k3"].Value = string.Format("IVA PAGADO (+){0}O{0}A FAVOR (-)", Environment.NewLine); sheet.Cells["l3"].Value = "DIOT"; sheet.Rows[2].Height = 240; decimal[] total = new decimal[12]; decimal[] reten = new decimal[12]; decimal[] ivaTras = new decimal[12]; decimal[] ivaRet = new decimal[12]; decimal[] ivaAcr = new decimal[12]; decimal[] totAcm = new decimal[12]; decimal[] retAcm = new decimal[12]; decimal[] totalDdc = new decimal[12]; decimal[] totAcmDdc = new decimal[12]; CriteriaOperator[] operands = new CriteriaOperator[2]; i = 5; operands[1] = new BinaryOperator("Status", DocumentoStatus.Sellada, BinaryOperatorType.Equal); for (int mesini = 1; mesini < 13; mesini++) { DateTime mFechaIni = apl.Log.Fecha.FechaInicial(mesini, ano); DateTime mFechaFin = apl.Log.Fecha.FechaFinal(mesini, ano); operands[0] = GroupOperator.And( new BinaryOperator("FechaDoc", mFechaIni, BinaryOperatorType.GreaterOrEqual), new BinaryOperator("FechaDoc", mFechaFin, BinaryOperatorType.LessOrEqual)); operands[1] = new BinaryOperator("Status", DocumentoStatus.Sellada, BinaryOperatorType.Equal); IList arr = ((XPObjectSpace)View.ObjectSpace).CreateCollection(typeof(DocumentoSalida), new GroupOperator(operands), null); total[mesini - 1] = 0; totAcm[mesini - 1] = 0; reten[mesini - 1] = 0; retAcm[mesini - 1] = 0; ivaTras[mesini - 1] = 0; ivaRet[mesini - 1] = 0; ivaAcr[mesini - 1] = 0; totalDdc[mesini - 1] = 0; totAcmDdc[mesini - 1] = 0; if (arr.Count > 0) { foreach (DocumentoSalida doc in arr) { total[mesini - 1] += doc.SubTotal; reten[mesini - 1] += doc.RetenISR; ivaTras[mesini - 1] += doc.Impuesto04; ivaRet[mesini - 1] += doc.RetenIVA; } } operands[0] = GroupOperator.And( new BinaryOperator("FechaDoc", mFechaIni, BinaryOperatorType.GreaterOrEqual), new BinaryOperator("FechaDoc", mFechaFin, BinaryOperatorType.LessOrEqual)); operands[1] = null; arr = ((XPObjectSpace)View.ObjectSpace).CreateCollection(typeof(Recepcion), new GroupOperator(operands), null); if (arr.Count > 0) { foreach (Recepcion doc in arr) { totalDdc[mesini - 1] += doc.SubTotal; ivaAcr[mesini - 1] += doc.Impuesto04; } } if ((mesini - 1) > 0) { // 1, 2, ...,11 0, 1, ...,10 1, 2, ...,11 totAcm[mesini - 1] += totAcm[mesini - 2] + total[mesini - 1]; retAcm[mesini - 1] += retAcm[mesini - 2] + reten[mesini - 1]; totAcmDdc[mesini - 1] += totAcmDdc[mesini - 2] + totalDdc[mesini - 1]; } else { // 0 0 totAcm[mesini - 1] = total[mesini - 1]; retAcm[mesini - 1] = reten[mesini - 1]; totAcmDdc[mesini - 1] = totalDdc[mesini - 1]; } if (total[mesini - 1] != 0) { sheet.Cells[i, 2].SetValue(total[mesini - 1]); sheet.Cells[i, 2].NumberFormat = "$#,##0.00;[Red]$#,##0.00"; } if (totalDdc[mesini - 1] != 0) { sheet.Cells[i, 3].SetValue(totalDdc[mesini - 1]); sheet.Cells[i, 3].NumberFormat = "$#,##0.00;[Red]$#,##0.00"; } if (reten[mesini - 1] != 0) { sheet.Cells[i, 5].SetValue(reten[mesini - 1]); sheet.Cells[i, 5].NumberFormat = "$#,##0.00;[Red]$#,##0.00"; } if (ivaTras[mesini - 1] != 0) { sheet.Cells[i, 7].SetValue(ivaTras[mesini - 1]); sheet.Cells[i, 7].NumberFormat = "$#,##0.00;[Red]$#,##0.00"; } if (ivaAcr[mesini - 1] != 0) { sheet.Cells[i, 8].SetValue(ivaAcr[mesini - 1]); sheet.Cells[i, 8].NumberFormat = "$#,##0.00;[Red]$#,##0.00"; } if (ivaRet[mesini - 1] != 0) { sheet.Cells[i, 9].SetValue(ivaRet[mesini - 1]); sheet.Cells[i, 9].NumberFormat = "$#,##0.00;[Red]$#,##0.00"; } sheet.Cells[i, 10].Formula = string.Format("=h{0}-i{0}-j{0}", i + 1); sheet.Cells[i++, 10].NumberFormat = "$#,##0.00;[Red]$#,##0.00"; if (mesini > 1) { sheet.Rows[i].FillColor = Color.FromName("BurlyWood"); //Beige"); // AntiqueWhite"); Bisque BlanchedAlmond if (totAcm[mesini - 1] != 0) { sheet.Cells[i, 2].SetValue(totAcm[mesini - 1]); sheet.Cells[i, 2].NumberFormat = "$#,##0.00;[Red]$#,##0.00"; } if (totAcmDdc[mesini - 1] != 0) { sheet.Cells[i, 3].SetValue(totAcmDdc[mesini - 1]); sheet.Cells[i, 3].NumberFormat = "$#,##0.00;[Red]$#,##0.00"; } sheet.Cells[i, 4].Formula = string.Format("=c{0}-d{0}", i + 1); sheet.Cells[i, 4].NumberFormat = "$#,##0.00;[Red]$#,##0.00"; if (retAcm[mesini - 1] != 0) { sheet.Cells[i, 5].SetValue(retAcm[mesini - 1]); sheet.Cells[i++, 5].NumberFormat = "$#,##0.00;[Red]$#,##0.00"; } else { i++; } } } book.SaveDocument(string.Format("Contable.xls")); } /* * Workbook book = new Workbook(); * var sheet = book.Worksheets.ActiveWorksheet; * sheet.Cells[0, 0].Value = "Carlos Javier Lopez Cruz"; * sheet.Cells[1, 0].Value = "LOCC670416JI8"; * // sheet.Cells[1, 1].Value = "litros67"; * int ano = DateTime.Today.Month == 1 ? DateTime.Today.Year-1 : DateTime.Today.Year; * // DateTime.Today.Year; * * sheet.Cells["A4"].Value = string.Format("Determinación del ISR provisional del Ejercicio {0}.", * ano); * * sheet.Cells[5, 1].Value = "ENERO"; * sheet.Cells[5, 4].Value = "FEBRERO"; * sheet.Cells[5, 7].Value = "MARZO"; * sheet.Cells[5, 10].Value = "ABRIL"; * sheet.Cells[5, 13].Value = "MAYO"; * sheet.Cells[5, 16].Value = "JUNIO"; * sheet.Cells[5, 19].Value = "JULIO"; * sheet.Cells[5, 22].Value = "AGOSTO"; * sheet.Cells[5, 25].Value = "SEPTIEMBRE"; * sheet.Cells[5, 28].Value = "OCTUBRE"; * sheet.Cells[5, 31].Value = "NOVIEMBRE"; * sheet.Cells[5, 34].Value = "DICIEMBRE"; * * * XPObjectSpace objectSpace = (XPObjectSpace)View.ObjectSpace; * Empresa emp = objectSpace.FindObject<Empresa>(null); * * CriteriaOperator[] operands = new CriteriaOperator[2]; * decimal[] total = new decimal[12]; * decimal[] totAcm = new decimal[12]; * decimal[] compr = new decimal[12]; * decimal[] reten = new decimal[12]; * decimal[] retAcm = new decimal[12]; * decimal[] ivaTras = new decimal[12]; * decimal[] ivaRet = new decimal[12]; * decimal[] ivaAcr = new decimal[12]; * * operands[1] = new BinaryOperator("Status", DocumentoStatus.Cancelado, BinaryOperatorType.NotEqual); * * sheet.Cells["A1"].Value = emp.Compania.Nombre; * sheet.Cells["B1"].Value = emp.Compania.Rfc; * * for (int mesini = 1; mesini < 13; mesini++) * { * DateTime mFechaIni = Fecha.FechaInicial(mesini, ano); * DateTime mFechaFin = Fecha.FechaFinal(mesini, ano); * * operands[0] = GroupOperator.And(new BinaryOperator("FechaDoc", mFechaIni, BinaryOperatorType.GreaterOrEqual), * new BinaryOperator("FechaDoc", mFechaFin, BinaryOperatorType.LessOrEqual)); * * IList arr = objectSpace.CreateCollection(typeof(DocumentoSalida), new GroupOperator(operands), null); * * total[mesini - 1] = 0; * totAcm[mesini - 1] = 0; * reten[mesini - 1] = 0; * retAcm[mesini - 1] = 0; * ivaTras[mesini - 1] = 0; * ivaRet[mesini - 1] = 0; * ivaAcr[mesini - 1] = 0; * if (arr.Count > 0) * { * foreach (DocumentoSalida doc in arr) * { * total[mesini - 1] += doc.SubTotal; * reten[mesini - 1] += doc.RetenISR; * ivaTras[mesini - 1] += doc.Impuesto04; * ivaRet[mesini - 1] += doc.RetenIVA; * } * * if ((mesini - 1) > 0) * { * totAcm[mesini - 1] += totAcm[mesini - 2] + total[mesini - 2]; * retAcm[mesini - 1] += retAcm[mesini - 2] + reten[mesini - 2]; * } * } * } * * sheet.Cells[6, 0].ColumnWidth = 470; * sheet.Cells["A7"].Value = "Ingresos Acumulados:"; * sheet.Cells[6, 1].Value = 0; * sheet.Cells[6, 4].Value = total[0].ToString("n2"); * sheet.Cells[6, 7].Value = (total[0] + total[1]).ToString("n2"); * sheet.Cells[6, 10].Value = (total[0] + total[1] + total[2]).ToString("n2"); * sheet.Cells[6, 13].Value = (total[0] + total[1] + total[2] + total[3]).ToString("n2"); + sheet.Cells[6, 16].Value = (total[0] + total[1] + total[2] + total[3] + total[4]).ToString("n2"); + sheet.Cells[6, 19].Value = (total[0] + total[1] + total[2] + total[3] + total[4] + total[5]).ToString("n2"); + sheet.Cells[6, 22].Value = (total[0] + total[1] + total[2] + total[3] + total[4] + total[5] + total[6]).ToString("n2"); + sheet.Cells[6, 25].Value = (total[0] + total[1] + total[2] + total[3] + total[4] + total[5] + total[6] + total[7]).ToString("n2"); + sheet.Cells[6, 28].Value = (total[0] + total[1] + total[2] + total[3] + total[4] + total[5] + total[6] + total[7] + total[8]).ToString("n2"); + sheet.Cells[6, 31].Value = (total[0] + total[1] + total[2] + total[3] + total[4] + total[5] + total[6] + total[7] + total[8] + total[9]).ToString("n2"); + sheet.Cells[6, 34].Value = (total[0] + total[1] + total[2] + total[3] + total[4] + total[5] + total[6] + total[7] + total[8] + total[9] + total[10]).ToString("n2"); + + sheet.Cells["A8"].Value = "Ingresos:"; + sheet.Cells[7, 1].Value = total[0].ToString("n2"); + sheet.Cells[7, 4].Value = total[1].ToString("n2"); + sheet.Cells[7, 7].Value = total[2].ToString("n2"); + sheet.Cells[7, 10].Value = total[3].ToString("n2"); + sheet.Cells[7, 13].Value = total[4].ToString("n2"); + sheet.Cells[7, 16].Value = total[5].ToString("n2"); + sheet.Cells[7, 19].Value = total[6].ToString("n2"); + sheet.Cells[7, 22].Value = total[7].ToString("n2"); + sheet.Cells[7, 25].Value = total[8].ToString("n2"); + sheet.Cells[7, 28].Value = total[9].ToString("n2"); + sheet.Cells[7, 31].Value = total[10].ToString("n2"); + sheet.Cells[7, 34].Value = total[11].ToString("n2"); + + sheet.Cells["A9"].Value = "Total de Ingresos:"; + sheet.Cells[8, 2].Value = (total[0] + totAcm[0]).ToString("n2"); + sheet.Cells[8, 5].Value = (total[1] + totAcm[1]).ToString("n2"); + sheet.Cells[8, 8].Value = (total[2] + totAcm[2]).ToString("n2"); + sheet.Cells[8, 11].Value = (total[3] + totAcm[3]).ToString("n2"); + sheet.Cells[8, 14].Value = (total[4] + totAcm[4]).ToString("n2"); + sheet.Cells[8, 17].Value = (total[5] + totAcm[5]).ToString("n2"); + sheet.Cells[8, 20].Value = (total[6] + totAcm[6]).ToString("n2"); + sheet.Cells[8, 23].Value = (total[7] + totAcm[7]).ToString("n2"); + sheet.Cells[8, 26].Value = (total[8] + totAcm[8]).ToString("n2"); + sheet.Cells[8, 29].Value = (total[9] + totAcm[9]).ToString("n2"); + sheet.Cells[8, 32].Value = (total[10] + totAcm[10]).ToString("n2"); + sheet.Cells[8, 35].Value = (total[11] + totAcm[11]).ToString("n2"); + + + + decimal[] totalDdc = new decimal[12]; + decimal[] totAcmDdc = new decimal[12]; + for (int mesini = 1; mesini < 13; mesini++) + { + DateTime mFechaIni = Fecha.FechaInicial(mesini, ano); + DateTime mFechaFin = Fecha.FechaFinal(mesini, ano); + + operands[0] = GroupOperator.And(new BinaryOperator("FechaDoc", mFechaIni, BinaryOperatorType.GreaterOrEqual), + new BinaryOperator("FechaDoc", mFechaFin, BinaryOperatorType.LessOrEqual)); + + IList arr = objectSpace.CreateCollection(typeof(Recepcion), new GroupOperator(operands), null); + + totalDdc[mesini - 1] = 0; + totAcmDdc[mesini - 1] = 0; + ivaAcr[mesini - 1] = 0; + if (arr.Count > 0) + { + foreach (Recepcion doc in arr) + { + totalDdc[mesini - 1] += doc.SubTotal; + ivaAcr[mesini - 1] += doc.Impuesto04; + } + + if ((mesini - 1) > 0) + totAcmDdc[mesini - 1] += totAcmDdc[mesini - 2] + totalDdc[mesini - 2]; + } + } + + sheet.Cells[9, 0].Value = "Deducciones Acumuladas:"; + sheet.Cells[9, 1].Value = totAcmDdc[0].ToString("n2"); + sheet.Cells[9, 4].Value = totAcmDdc[1].ToString("n2"); + sheet.Cells[9, 7].Value = totAcmDdc[2].ToString("n2"); + sheet.Cells[9, 10].Value = totAcmDdc[3].ToString("n2"); + sheet.Cells[9, 13].Value = totAcmDdc[4].ToString("n2"); + sheet.Cells[9, 16].Value = totAcmDdc[5].ToString("n2"); + sheet.Cells[9, 19].Value = totAcmDdc[6].ToString("n2"); + sheet.Cells[9, 22].Value = totAcmDdc[7].ToString("n2"); + sheet.Cells[9, 25].Value = totAcmDdc[8].ToString("n2"); + sheet.Cells[9, 28].Value = totAcmDdc[9].ToString("n2"); + sheet.Cells[9, 31].Value = totAcmDdc[10].ToString("n2"); + sheet.Cells[9, 34].Value = totAcmDdc[11].ToString("n2"); + + int ren = 10; + sheet.Cells[ren, 0].Value = "Deducciones:"; + for (int i = 0; i < 12; i++) + sheet.Cells[ren, 1+3*i].Value = totalDdc[i].ToString("n2"); + + ren = 11; + sheet.Cells[ren, 0].Value = "Total de Deducciones:"; + for (int i = 0; i < 12; i++) + sheet.Cells[ren, 2+3*i].Value = (totalDdc[i] + totAcmDdc[i]).ToString("n2"); + + ren++; + sheet.Cells[++ren, 0].Value = "Base ISR:"; + for (int i = 0; i < 12; i++) + { + sheet[ren, 2+3*i].Value = (total[i] + totAcm[i]- (totalDdc[i] + totAcmDdc[i])) > 0 + ? (total[i] + totAcm[i] - (totalDdc[i] + totAcmDdc[i])).ToString("n2") : "-"; + } + + sheet.Cells[++ren, 0].Value = "Límite Inferior:"; + sheet.Cells[++ren, 0].Value = "Excedente L.I.:"; + sheet.Cells[++ren, 0].Value = "% Marginal:"; + sheet.Cells[++ren, 0].Value = "Impuesto Marginal:"; + sheet.Cells[++ren, 0].Value = "Cuotra fija:"; + sheet.Cells[++ren, 0].Value = "ISR Causado:"; + + ren++; + ren++; + sheet.Cells[ren, 0].Value = "Retenciones Acumuladas:"; + for (int i = 0; i < 12; i++) + sheet.Cells[ren, 1+3*i].Value = retAcm[i].ToString("n2"); + + ren++; + sheet.Cells[ren, 0].Value = "Retención ISR:"; + for (int i = 0; i < 12; i++) + sheet.Cells[ren, 1 + 3 * i].Value = reten[i].ToString("n2"); + + ren++; + sheet.Cells[ren, 0].Value = "Total de Retenciones:"; + for (int i = 0; i < 12; i++) + sheet.Cells[ren, 2 + 3 * i].Value = (reten[i] + retAcm[i]).ToString("n2"); + + ren++; + sheet.Cells[++ren, 0].Value = "Determinacion del Impuesto al Valor Agregado Mensual del Ejercicio 2014"; + + ren++; + ren++; + sheet.Cells[ren, 0].Value = "IVA trasladado:"; + for (int i = 0; i < 12; i++) + sheet.Cells[ren, 1 + 3 * i].Value = ivaTras[i].ToString("n2"); + + ren++; + sheet.Cells[ren, 0].Value = "Retención IVA:"; + for (int i = 0; i < 12; i++) + sheet.Cells[ren, 1 + 3 * i].Value = ivaRet[i].ToString("n2"); + + ren++; + sheet.Cells[ren, 0].Value = "IVA Acreditable:"; + for (int i = 0; i < 12; i++) + sheet.Cells[ren, 1 + 3 * i].Value = ivaAcr[i].ToString("n2"); + + ren++; + sheet.Cells[ren, 0].Value = "Saldo a favor de IVA:"; + for (int i = 0; i < 12; i++) + sheet.Cells[ren, 1 + 3 * i].Value = ivaTras[i] - ivaRet[i]-ivaAcr[i] > 0 ? "0" : + Math.Round(ivaAcr[i] + ivaRet[i] - ivaTras[i]).ToString("n2"); + + ren++; + sheet.Cells[ren, 0].Value = "Saldo a pagar de IVA:"; + for (int i = 0; i < 12; i++) + sheet.Cells[ren, 1 + 3 * i].Value = ivaTras[i] - ivaRet[i] - ivaAcr[i] > 0 ? + Math.Round(ivaTras[i] - ivaRet[i] - ivaAcr[i]).ToString("n2") : "0"; + + book.SaveDocument(string.Format("Contable.xls"));*/ }
static void Main() { // // XPOには、LINQ to XPOの他にCriteriaOperatorを利用したクエリ方法がある。 // CriteriaOperator系のクラスは、DevExpress.Data.Filterling名前空間に配置されている。 // // CriteriaOperatorで構築した抽出条件は、XPCollectionやXPViewなどのXPOコレクションクラスにて // 絞り込み条件として指定できる。 // // 使用方法としては、以下の2種類のやり方がある。 // ・BinaryOperatorなどの各Operatorクラスをインスタンス化して条件を構築. // ・CriteriaOperator.Parseメソッドに対して、文字列で条件を指定して構築. // // 参考リソース // http://documentation.devexpress.com/#XPO/CustomDocument2258 // http://documentation.devexpress.com/#XPO/CustomDocument2132 // http://documentation.devexpress.com/#XPO/CustomDocument2047 // http://documentation.devexpress.com/#XPO/CustomDocument2129 // var dataStore = new InMemoryDataStore(); var dataLayer = new SimpleDataLayer(dataStore); // // 初期データ設定 // using (var uow = new UnitOfWork(dataLayer)) { for (int i = 0; i < 10; i++) { new Customer(uow) { Name = string.Format("Customer-{0}", i), Age = i + 20 }; } uow.CommitChanges(); } // // Operatorクラスを利用して条件を構築. // var opGreater = new BinaryOperator("Age", 25, BinaryOperatorType.GreaterOrEqual); using (var uow = new UnitOfWork(dataLayer)) { foreach (var item in new XPCollection <Customer>(uow) { Criteria = opGreater }) { Console.WriteLine(item.Name); } } // // CriteriaOperator.Parseメソッドを利用して条件を構築. // var criteria = CriteriaOperator.Parse("Age >= 25"); using (var uow = new UnitOfWork(dataLayer)) { foreach (var item in new XPCollection <Customer>(uow) { Criteria = criteria }) { Console.WriteLine(item.Name); } } // // Operatorクラスのチェイン (複数条件の指定) // 条件同士をand, orするには、GroupOperatorの静的メソッドを利用する. // var opLike = new BinaryOperator("Name", "%7%", BinaryOperatorType.Like); var opAnd = GroupOperator.And(opGreater, opLike); using (var uow = new UnitOfWork(dataLayer)) { foreach (var item in new XPCollection <Customer>(uow) { Criteria = opAnd }) { Console.WriteLine(new { Name = item.Name, Age = item.Age }); } } // // CriteriaOperator.Parseメソッドで複数条件の指定. // 条件同士をand, orするには、そのまま文字列中にand, orと記述すればよい。 // criteria = CriteriaOperator.Parse("Age >= 25 AND Name like '%7%'"); using (var uow = new UnitOfWork(dataLayer)) { foreach (var item in new XPCollection <Customer>(uow) { Criteria = criteria }) { Console.WriteLine(new { Name = item.Name, Age = item.Age }); } } }