public List <CInvStatData> CreateYearlyStat(int nYear, int nStartMonth, int nEndMonth) { List <CInvStatData> list = new List <CInvStatData>(); try { TaxStatisData data = this.taxCard.GetYearStatistics(nYear, nStartMonth, nEndMonth); 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) && (stati.get_InvTypeStr().Length > 0)) { List <string> list3 = 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) { list3.Add(stati.AllotInvNum.ToString()); list3.Add(stati.ReclaimStockNum.ToString()); } List <string> list4 = new List <string> { stati.get_Total().XXZSJE.ToString("0.00"), stati.get_Total().XXFSJE.ToString("0.00"), stati.get_Total().SJXSJE.ToString("0.00"), stati.get_Total().XXZSSE.ToString("0.00"), stati.get_Total().XXFSSE.ToString("0.00"), stati.get_Total().SJXXSE.ToString("0.00") }; if (list2.Count == list4.Count) { DataTable table = new DataTable(); table.Columns.Add("项目名称"); table.Columns.Add("合计"); int count = list2.Count; for (int j = 0; j < count; j++) { List <object> list5 = new List <object> { list2[j], list4[j] }; for (int k = 2; k < table.Columns.Count; k++) { list5.Add(""); } object[] values = list5.ToArray(); table.Rows.Add(values); } CInvStatData item = new CInvStatData { m_strInvTypeName = stati.get_InvTypeStr(), m_strHeadValue = list3.ToArray(), m_DataTableGrid = table }; list.Add(item); } } } } catch (Exception exception) { this.loger.Info(exception.Message); ExceptionHandler.HandleError(exception); } return(list); }
public bool CheckIntegrity(int nMonth) { try { DateTime dtStart = Convert.ToDateTime(string.Concat(new object[] { this.taxCard.GetCardClock().Year.ToString(), "-", nMonth, "-01" })); DateTime dtEnd = dtStart; if (nMonth == 12) { dtEnd = Convert.ToDateTime(((this.taxCard.GetCardClock().Year + 1)).ToString() + "-01-01"); } else { dtEnd = Convert.ToDateTime(this.taxCard.GetCardClock().Year.ToString() + "-" + ((nMonth + 1)).ToString() + "-01"); } ArrayList taxStatData = this.m_invoiceReportDAL.GetTaxStatData(dtStart, dtEnd); if (taxStatData.Count <= 0) { return(false); } Dictionary <string, object> dictionary = new Dictionary <string, object>(); dictionary = taxStatData[0] as Dictionary <string, object>; int num = 0; double num2 = 0.0; double num3 = 0.0; if (!dictionary.ContainsKey("TotalCount")) { return(false); } if (dictionary["TotalCount"].ToString() != "") { num = Convert.ToInt32(dictionary["TotalCount"].ToString()); } if (!dictionary.ContainsKey("TotalCash")) { return(false); } if (dictionary["TotalCash"].ToString() != "") { num2 = Convert.ToDouble(dictionary["TotalCash"].ToString()); } if (!dictionary.ContainsKey("TotalTax")) { return(false); } if (dictionary["TotalTax"].ToString() != "") { num3 = Convert.ToDouble(dictionary["TotalTax"].ToString()); } int num4 = Convert.ToInt32(this.taxCard.GetInvCount(nMonth)); double num5 = 0.0; double num6 = 0.0; TaxStatisData data = this.taxCard.GetMonthStatistics(this.taxCard.GetCardClock().Year, nMonth, 0); InvAmountTaxStati stati = data.InvTypeStatData(0); num5 += (stati.get_Total().SJXSJE + stati.get_Total().XXZFJE) - stati.get_Total().XXFFJE; num6 += (stati.get_Total().SJXXSE + stati.get_Total().XXZFSE) - stati.get_Total().XXFFSE; stati = data.InvTypeStatData(2); num5 += (stati.get_Total().SJXSJE + stati.get_Total().XXZFJE) - stati.get_Total().XXFFJE; num6 += (stati.get_Total().SJXXSE + stati.get_Total().XXZFSE) - stati.get_Total().XXFFSE; stati = data.InvTypeStatData(11); num5 += (stati.get_Total().SJXSJE + stati.get_Total().XXZFJE) - stati.get_Total().XXFFJE; num6 += (stati.get_Total().SJXXSE + stati.get_Total().XXZFSE) - stati.get_Total().XXFFSE; stati = data.InvTypeStatData(12); num5 += (stati.get_Total().SJXSJE + stati.get_Total().XXZFJE) - stati.get_Total().XXFFJE; num6 += (stati.get_Total().SJXXSE + stati.get_Total().XXZFSE) - stati.get_Total().XXFFSE; num5 = Math.Round(num5, 2); num2 = Math.Round(num2, 2); num6 = Math.Round(num6, 2); num3 = Math.Round(num3, 2); if (num != num4) { return(false); } if (num2 != num5) { return(false); } if (num3 != num6) { return(false); } } catch (Exception exception) { ExceptionHandler.HandleError(exception); return(false); } return(true); }
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); } }