public void GetPostAuditReport() { CommonDatabaseContext dataContext = CreateCommonDatabaseContext(); List <AuditReportsObject.PostAuditField> postAuditfields = new List <AuditReportsObject.PostAuditField>(); List <AuditReportsObject.PostAuditInventoryTotalsField> postAuditInventoryTotalsfields = new List <AuditReportsObject.PostAuditInventoryTotalsField>(); AuditReportsObject.PostAuditTempICNReconciliationField postAuditAdjustmentsfields = new AuditReportsObject.PostAuditTempICNReconciliationField(); AuditReportsProcedures.GetPostAuditReportFields(ref postAuditfields, ref postAuditInventoryTotalsfields, ref postAuditAdjustmentsfields, ADS.ActiveAudit.StoreNumber, ADS.ActiveAudit.AuditId, dataContext); AuditReportsObject ro = new AuditReportsObject(); ro.ReportNumber = 22; ro.ReportStore = ADS.ActiveAudit.StoreName; ro.ReportTitle = "Post Audit"; ro.StoreNumber = ADS.ActiveAudit.StoreNumber; ro.InventoryAuditDate = DateTime.Today; ro.ListPostAuditField = postAuditfields; ro.ListPostAuditInventoryTotalsField = postAuditInventoryTotalsfields; ro.PostAuditTempICNReconciliation = postAuditAdjustmentsfields; ADS.ReportActiveAudit.DateCompleted = DateTime.Now; ro.ActiveAudit = ADS.ReportActiveAudit; ro.ReportTempFile = ReportDirectoryPath; PostAuditReport rpt = new PostAuditReport(); rpt.ReportObject = ro; rpt.CreateReport(); PrintAndStoreReport(ro, ro.ReportTitle); }
public static bool GetPostAuditReportFields(ref List <AuditReportsObject.PostAuditField> postAuditFields, ref List <AuditReportsObject.PostAuditInventoryTotalsField> postAuditInventoryTotalsFields, ref AuditReportsObject.PostAuditTempICNReconciliationField postAuditAdjustmentsFields, string storenumber, int auditID, CommonDatabaseContext dataContext) { //CommonDatabaseContext dataContext = CreateCommonDatabaseContext(); if (postAuditFields == null || postAuditInventoryTotalsFields == null) { throw new ArgumentNullException("PostAuditReportFields"); } OracleDataAccessor dA = GlobalDataAccessor.Instance.OracleDA; //Create parameter list List <OracleProcParam> oParams = new List <OracleProcParam>(); oParams.Add(new OracleProcParam("p_storenumber", storenumber)); oParams.Add(new OracleProcParam("p_AuditID", auditID)); //Setup ref cursor array List <PairType <string, string> > refCursors = new List <PairType <string, string> >(); //Add general ref cursors refCursors.Add(new PairType <string, string>("o_stat_ttl", "o_stat_ttl")); refCursors.Add(new PairType <string, string>("o_chgOff", "o_chgOff")); refCursors.Add(new PairType <string, string>("o_reactvt", "o_reactvt")); refCursors.Add(new PairType <string, string>("o_chg_on", "o_chg_on")); refCursors.Add(new PairType <string, string>("o_adjust", "o_adjust")); //Make stored proc call bool retVal; DataSet outputDataSet; try { retVal = GlobalDataAccessor.Instance.OracleDA.issueSqlStoredProcCommand("ccsowner", "AUDIT_REPORTS", "postAuditReport", oParams, refCursors, "o_return_code", "o_return_text", out outputDataSet); dataContext.ErrorCode = dA.ErrorCode; dataContext.ErrorText = dA.ErrorDescription; } catch (OracleException oEx) { BasicExceptionHandler.Instance.AddException("GetPostAuditReportFields Failed", oEx); dataContext.ErrorCode = "GetPostAuditReportFieldsFailed"; dataContext.ErrorText = "OracleException thrown: " + oEx.Message; return(false); } if (retVal == false) { BasicExceptionHandler.Instance.AddException("GetPostAuditReportFields Failed: return value is false", new ApplicationException()); dataContext.ErrorCode = dA.ErrorCode + " --- GetPostAuditReportFields"; dataContext.ErrorText = dA.ErrorDescription + " -- Return value is false"; return(false); } if (outputDataSet == null) { return(false); } if (outputDataSet.Tables.Count > 0) { if (outputDataSet.Tables[TBL_POSTAUDIT_INVTOTALS] != null && outputDataSet.Tables[TBL_POSTAUDIT_INVTOTALS].Rows.Count > 0) { foreach (DataRow dr in outputDataSet.Tables[TBL_POSTAUDIT_INVTOTALS].Rows) { postAuditInventoryTotalsFields.Add(new AuditReportsObject.PostAuditInventoryTotalsField() { InventoryType = Utilities.GetStringValue(dr["STATUS_CD"], string.Empty), Qty = Utilities.GetIntegerValue(dr["QUANTITY"], 0), Cost = Utilities.GetDecimalValue(dr["PFI_AMOUNT"], 0.00M), Category = (int)EnumPostAuditReportCategories.InventoryTotalsCountedByStatus }); } } if (outputDataSet.Tables[TBL_POSTAUDIT_CHARGEOFF] != null && outputDataSet.Tables[TBL_POSTAUDIT_CHARGEOFF].Rows.Count > 0) { int counter = 1; foreach (DataRow dr in outputDataSet.Tables[TBL_POSTAUDIT_CHARGEOFF].Rows) { //if (counter <= 5) //{ //this needs to be the only section within this if statement postAuditFields.Add(new AuditReportsObject.PostAuditField() { ICN = Utilities.GetStringValue(dr["ICN"], string.Empty), MerchandiseDescription = Utilities.GetStringValue(dr["MD_DESC"], string.Empty), Qty = Utilities.GetIntegerValue(dr["QUANTITY"], 0), Cost = Utilities.GetDecimalValue(dr["PFI_AMOUNT"], 0.00M), Reason = Utilities.GetStringValue(dr["STATUS_REASON"], string.Empty), Retail = Utilities.GetDecimalValue(dr["RETAIL_PRICE"], 0.00M), Category = (int)EnumPostAuditReportCategories.ChargeOff }); } } if (outputDataSet.Tables[TBL_POSTAUDIT_REACTIVATION] != null && outputDataSet.Tables[TBL_POSTAUDIT_REACTIVATION].Rows.Count > 0) { foreach (DataRow dr in outputDataSet.Tables[TBL_POSTAUDIT_REACTIVATION].Rows) { postAuditFields.Add(new AuditReportsObject.PostAuditField() { ICN = Utilities.GetStringValue(dr["ICN"], string.Empty), MerchandiseDescription = Utilities.GetStringValue(dr["MD_DESC"], string.Empty), Qty = Utilities.GetIntegerValue(dr["QUANTITY"], 0), Cost = Utilities.GetDecimalValue(dr["PFI_AMOUNT"], 0.00M), Retail = Utilities.GetDecimalValue(dr["RETAIL_PRICE"], 0.00M), Category = (int)EnumPostAuditReportCategories.Reactivation }); } } if (outputDataSet.Tables[TBL_POSTAUDIT_CHARGEON] != null && outputDataSet.Tables[TBL_POSTAUDIT_CHARGEON].Rows.Count > 0) { foreach (DataRow dr in outputDataSet.Tables[TBL_POSTAUDIT_CHARGEON].Rows) { postAuditFields.Add(new AuditReportsObject.PostAuditField() { ICN = Utilities.GetStringValue(dr["ICN"], string.Empty), MerchandiseDescription = Utilities.GetStringValue(dr["MD_DESC"], string.Empty), Qty = Utilities.GetIntegerValue(dr["QUANTITY"], 0), Cost = Utilities.GetDecimalValue(dr["PFI_AMOUNT"], 0.00M), Retail = Utilities.GetDecimalValue(dr["RETAIL_PRICE"], 0.00M), Category = (int)EnumPostAuditReportCategories.ChargeOn }); } } if (outputDataSet.Tables[TBL_POSTAUDIT_TEMPICNRECONCILLIATION] != null && outputDataSet.Tables[TBL_POSTAUDIT_TEMPICNRECONCILLIATION].Rows.Count > 0) { foreach (DataRow dr in outputDataSet.Tables[TBL_POSTAUDIT_TEMPICNRECONCILLIATION].Rows) { postAuditAdjustmentsFields.TotalNewICNsSoldNotReconciledQty = Utilities.GetIntegerValue(dr["TMP_ICN_NOT_REC"], 0); postAuditAdjustmentsFields.TotalNewICNsSoldNotReconciledCost = Utilities.GetDecimalValue(dr["TMP_ICN_NOT_REC_AMT"], 0.00M); postAuditAdjustmentsFields.TotalOldICNsSoldNotReconciledQty = Utilities.GetIntegerValue(dr["TMP_ICN_NOT_REC"], 0); postAuditAdjustmentsFields.TotalOldICNsSoldNotReconciledCost = Utilities.GetDecimalValue(dr["TMP_ICN_NOT_REC_AMT"], 0.00M); postAuditAdjustmentsFields.ChargeOffQty = Utilities.GetIntegerValue(dr["CHARGE_OFF"], 0); postAuditAdjustmentsFields.ChargeOffCost = Utilities.GetDecimalValue(dr["CHARGE_OFF_AMT"], 0.00M); postAuditAdjustmentsFields.ChargeOnQty = Utilities.GetIntegerValue(dr["CHARGE_ON"], 0); postAuditAdjustmentsFields.ChargeOnCost = Utilities.GetDecimalValue(dr["CHARGE_ON_AMT"], 0.00M); postAuditAdjustmentsFields.TotalNewICNsSoldReconciledQty = Utilities.GetIntegerValue(dr["TMP_ICN_REC"], 0); postAuditAdjustmentsFields.TotalNewICNsSoldReconciledCost = Utilities.GetDecimalValue(dr["TMP_ICN_REC_AMT"], 0.00M); postAuditAdjustmentsFields.TotalActualICNsReconciledQty = Utilities.GetIntegerValue(dr["ICNS_REC"], 0); postAuditAdjustmentsFields.TotalActualICNsReconciledCost = Utilities.GetDecimalValue(dr["ICNS_REC_AMT"], 0.00M); } } dataContext.ErrorCode = "0"; dataContext.ErrorText = "Success"; } return(true); }