public List <CInvStatData> CreateMonthlyStat(int nYear, int nMonth, int nPeriod) { List <CInvStatData> list = new List <CInvStatData>(); try { TaxStatisData data = this.taxCard.GetMonthStatistics(nYear, nMonth, nPeriod); if (data == null) { return(null); } if (this.taxCard.get_RetCode() != 0) { MessageBoxHelper.Show(MessageManager.GetMessageInfo(this.taxCard.get_ErrCode())); return(null); } List <string> list2 = new List <string> { "销项正废金额", "销项正数金额", "销项负废金额", "销项负数金额", "实际销售金额", "销项正废税额", "销项正数税额", "销项负废税额", "销项负数税额", "实际销项税额" }; for (int i = 0; i < data.get_Count(); i++) { InvAmountTaxStati stati = data.get_Item(i); if (stati != null) { List <List <string> > list3 = new List <List <string> >(); if (stati.get_InvTypeStr().Length > 0) { List <string> list5; List <string> list4 = new List <string> { stati.PeriodEarlyStockNum.ToString(), stati.BuyNum.ToString(), stati.ReturnInvNum.ToString(), stati.PlusInvoiceNum.ToString(), stati.PlusInvWasteNum.ToString(), stati.PeriodEndStockNum.ToString(), stati.NegativeInvoiceNum.ToString(), stati.NegativeInvWasteNum.ToString() }; if (this.bIsMainMachine && this.bHasChild) { list4.Add(stati.AllotInvNum.ToString()); list4.Add(stati.ReclaimStockNum.ToString()); } list5 = new List <string> { stati.get_Total().XXZFJE.ToString("0.00"), stati.get_TaxClass17().XXZFJE.ToString("0.00"), stati.get_TaxClass13().XXZFJE.ToString("0.00"), stati.get_TaxClass6().XXZFJE.ToString("0.00"), stati.get_TaxClass4().XXZFJE.ToString("0.00"), stati.get_TaxClassOther().XXZFJE.ToString("0.00"), list5 }; list5 = new List <string> { stati.get_Total().XXZSJE.ToString("0.00"), stati.get_TaxClass17().XXZSJE.ToString("0.00"), stati.get_TaxClass13().XXZSJE.ToString("0.00"), stati.get_TaxClass6().XXZSJE.ToString("0.00"), stati.get_TaxClass4().XXZSJE.ToString("0.00"), stati.get_TaxClassOther().XXZSJE.ToString("0.00"), list5 }; list5 = new List <string> { stati.get_Total().XXFFJE.ToString("0.00"), stati.get_TaxClass17().XXFFJE.ToString("0.00"), stati.get_TaxClass13().XXFFJE.ToString("0.00"), stati.get_TaxClass6().XXFFJE.ToString("0.00"), stati.get_TaxClass4().XXFFJE.ToString("0.00"), stati.get_TaxClassOther().XXFFJE.ToString("0.00"), list5 }; list5 = new List <string> { stati.get_Total().XXFSJE.ToString("0.00"), stati.get_TaxClass17().XXFSJE.ToString("0.00"), stati.get_TaxClass13().XXFSJE.ToString("0.00"), stati.get_TaxClass6().XXFSJE.ToString("0.00"), stati.get_TaxClass4().XXFSJE.ToString("0.00"), stati.get_TaxClassOther().XXFSJE.ToString("0.00"), list5 }; list5 = new List <string> { stati.get_Total().SJXSJE.ToString("0.00"), stati.get_TaxClass17().SJXSJE.ToString("0.00"), stati.get_TaxClass13().SJXSJE.ToString("0.00"), stati.get_TaxClass6().SJXSJE.ToString("0.00"), stati.get_TaxClass4().SJXSJE.ToString("0.00"), stati.get_TaxClassOther().SJXSJE.ToString("0.00"), list5 }; list5 = new List <string> { stati.get_Total().XXZFSE.ToString("0.00"), stati.get_TaxClass17().XXZFSE.ToString("0.00"), stati.get_TaxClass13().XXZFSE.ToString("0.00"), stati.get_TaxClass6().XXZFSE.ToString("0.00"), stati.get_TaxClass4().XXZFSE.ToString("0.00"), stati.get_TaxClassOther().XXZFSE.ToString("0.00"), list5 }; list5 = new List <string> { stati.get_Total().XXZSSE.ToString("0.00"), stati.get_TaxClass17().XXZSSE.ToString("0.00"), stati.get_TaxClass13().XXZSSE.ToString("0.00"), stati.get_TaxClass6().XXZSSE.ToString("0.00"), stati.get_TaxClass4().XXZSSE.ToString("0.00"), stati.get_TaxClassOther().XXZSSE.ToString("0.00"), list5 }; list5 = new List <string> { stati.get_Total().XXFFSE.ToString("0.00"), stati.get_TaxClass17().XXFFSE.ToString("0.00"), stati.get_TaxClass13().XXFFSE.ToString("0.00"), stati.get_TaxClass6().XXFFSE.ToString("0.00"), stati.get_TaxClass4().XXFFSE.ToString("0.00"), stati.get_TaxClassOther().XXFFSE.ToString("0.00"), list5 }; list5 = new List <string> { stati.get_Total().XXFSSE.ToString("0.00"), stati.get_TaxClass17().XXFSSE.ToString("0.00"), stati.get_TaxClass13().XXFSSE.ToString("0.00"), stati.get_TaxClass6().XXFSSE.ToString("0.00"), stati.get_TaxClass4().XXFSSE.ToString("0.00"), stati.get_TaxClassOther().XXFSSE.ToString("0.00"), list5 }; list5 = new List <string> { stati.get_Total().SJXXSE.ToString("0.00"), stati.get_TaxClass17().SJXXSE.ToString("0.00"), stati.get_TaxClass13().SJXXSE.ToString("0.00"), stati.get_TaxClass6().SJXXSE.ToString("0.00"), stati.get_TaxClass4().SJXXSE.ToString("0.00"), stati.get_TaxClassOther().SJXXSE.ToString("0.00"), list5 }; if (list3.Count == list2.Count) { DataTable table = new DataTable(); table.Columns.Add("项目名称"); table.Columns.Add("合计"); table.Columns.Add("17%"); table.Columns.Add("13%"); table.Columns.Add("6%"); table.Columns.Add("4%"); table.Columns.Add("其他"); for (int j = 0; j < list2.Count; j++) { List <object> list6 = new List <object> { list2[j] }; object[] objArray = list3[j].ToArray(); for (int k = 1; k < table.Columns.Count; k++) { list6.Add(objArray[k - 1]); } object[] values = list6.ToArray(); table.Rows.Add(values); } CInvStatData item = new CInvStatData { m_strInvTypeName = stati.get_InvTypeStr(), m_strHeadValue = list4.ToArray(), m_DataTableGrid = table }; list.Add(item); } } } } } catch (Exception exception) { this.loger.Info(exception.Message); ExceptionHandler.HandleError(exception); } return(list); }
public void CreateMonthlyDataGrid(ref CustomStyleDataGrid dataGridView, int nYear, int nMonth, int nPeriod, INV_TYPE InvType) { try { dataGridView.ReadOnly = true; dataGridView.AllowUserToAddRows = false; DataTable table = new DataTable(); table.Columns.Add("项目名称"); table.Columns.Add("合计"); table.Columns.Add("17%"); table.Columns.Add("13%"); table.Columns.Add("6%"); table.Columns.Add("4%"); table.Columns.Add("其他"); TaxStatisData data = this.taxCard.GetMonthStatistics(nYear, nMonth, nPeriod); if (data != null) { List <string> item = new List <string>(); List <List <string> > list2 = new List <List <string> >(); List <string> list3 = new List <string> { "销项正废金额", "销项正数金额", "销项负废金额", "销项负数金额", "实际销售金额", "销项正废税额", "销项正数税额", "销项负废税额", "销项负数税额", "实际销项税额" }; for (int i = 0; i < data.get_Count(); i++) { InvAmountTaxStati stati = data.get_Item(i); if (stati == null) { return; } if ((stati.get_InvTypeStr().Length > 0) && (stati.get_InvTypeStr().Trim() == InvTypeEntity.GetInvName(InvType))) { item.Add(stati.get_Total().XXZFJE.ToString("0.00")); item.Add(stati.get_TaxClass17().XXZFJE.ToString("0.00")); item.Add(stati.get_TaxClass13().XXZFJE.ToString("0.00")); item.Add(stati.get_TaxClass6().XXZFJE.ToString("0.00")); item.Add(stati.get_TaxClass4().XXZFJE.ToString("0.00")); item.Add(stati.get_TaxClassOther().XXZFJE.ToString("0.00")); list2.Add(item); item = new List <string> { stati.get_Total().XXZSJE.ToString("0.00"), stati.get_TaxClass17().XXZSJE.ToString("0.00"), stati.get_TaxClass13().XXZSJE.ToString("0.00"), stati.get_TaxClass6().XXZSJE.ToString("0.00"), stati.get_TaxClass4().XXZSJE.ToString("0.00"), stati.get_TaxClassOther().XXZSJE.ToString("0.00"), item }; item = new List <string> { stati.get_Total().XXFFJE.ToString("0.00"), stati.get_TaxClass17().XXFFJE.ToString("0.00"), stati.get_TaxClass13().XXFFJE.ToString("0.00"), stati.get_TaxClass6().XXFFJE.ToString("0.00"), stati.get_TaxClass4().XXFFJE.ToString("0.00"), stati.get_TaxClassOther().XXFFJE.ToString("0.00"), item }; item = new List <string> { stati.get_Total().XXFSJE.ToString("0.00"), stati.get_TaxClass17().XXFSJE.ToString("0.00"), stati.get_TaxClass13().XXFSJE.ToString("0.00"), stati.get_TaxClass6().XXFSJE.ToString("0.00"), stati.get_TaxClass4().XXFSJE.ToString("0.00"), stati.get_TaxClassOther().XXFSJE.ToString("0.00"), item }; item = new List <string> { stati.get_Total().SJXSJE.ToString("0.00"), stati.get_TaxClass17().SJXSJE.ToString("0.00"), stati.get_TaxClass13().SJXSJE.ToString("0.00"), stati.get_TaxClass6().SJXSJE.ToString("0.00"), stati.get_TaxClass4().SJXSJE.ToString("0.00"), stati.get_TaxClassOther().SJXSJE.ToString("0.00"), item }; item = new List <string> { stati.get_Total().XXZFSE.ToString("0.00"), stati.get_TaxClass17().XXZFSE.ToString("0.00"), stati.get_TaxClass13().XXZFSE.ToString("0.00"), stati.get_TaxClass6().XXZFSE.ToString("0.00"), stati.get_TaxClass4().XXZFSE.ToString("0.00"), stati.get_TaxClassOther().XXZFSE.ToString("0.00"), item }; item = new List <string> { stati.get_Total().XXZSSE.ToString("0.00"), stati.get_TaxClass17().XXZSSE.ToString("0.00"), stati.get_TaxClass13().XXZSSE.ToString("0.00"), stati.get_TaxClass6().XXZSSE.ToString("0.00"), stati.get_TaxClass4().XXZSSE.ToString("0.00"), stati.get_TaxClassOther().XXZSSE.ToString("0.00"), item }; item = new List <string> { stati.get_Total().XXFFSE.ToString("0.00"), stati.get_TaxClass17().XXFFSE.ToString("0.00"), stati.get_TaxClass13().XXFFSE.ToString("0.00"), stati.get_TaxClass6().XXFFSE.ToString("0.00"), stati.get_TaxClass4().XXFFSE.ToString("0.00"), stati.get_TaxClassOther().XXFFSE.ToString("0.00"), item }; item = new List <string> { stati.get_Total().XXFSSE.ToString("0.00"), stati.get_TaxClass17().XXFSSE.ToString("0.00"), stati.get_TaxClass13().XXFSSE.ToString("0.00"), stati.get_TaxClass6().XXFSSE.ToString("0.00"), stati.get_TaxClass4().XXFSSE.ToString("0.00"), stati.get_TaxClassOther().XXFSSE.ToString("0.00"), item }; item = new List <string> { stati.get_Total().SJXXSE.ToString("0.00"), stati.get_TaxClass17().SJXXSE.ToString("0.00"), stati.get_TaxClass13().SJXXSE.ToString("0.00"), stati.get_TaxClass6().SJXXSE.ToString("0.00"), stati.get_TaxClass4().SJXXSE.ToString("0.00"), stati.get_TaxClassOther().SJXXSE.ToString("0.00"), item }; } } if (dataGridView.Rows.Count > 0) { int count = dataGridView.Rows.Count; while (count-- > 0) { dataGridView.Rows.RemoveAt(0); } } if (list2.Count != list3.Count) { MessageManager.ShowMsgBox("INP-253107", new string[] { "资料统计出错" }); } else { for (int j = 0; j < list3.Count; j++) { List <object> list4 = new List <object> { list3[j] }; object[] objArray = list2[j].ToArray(); for (int m = 1; m < table.Columns.Count; m++) { list4.Add(objArray[m - 1]); } object[] values = list4.ToArray(); table.Rows.Add(values); } dataGridView.DataSource = table; for (int k = 0; k < dataGridView.Columns.Count; k++) { dataGridView.Columns[k].SortMode = DataGridViewColumnSortMode.NotSortable; } } } } catch (Exception exception) { this.loger.Info(exception.Message); ExceptionHandler.HandleError(exception); } }