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); }
private void btnContinue_Click(object sender, EventArgs e) { if (Downloaded) { NavControlBox.Action = NavBox.NavAction.SUBMIT; return; } //ConfirmTrakker confirmTrakker = new ConfirmTrakker(TrakkerId); //if (confirmTrakker.ShowDialog() == DialogResult.Cancel) //{ // return; //} UploadFiles(); SetButtonStates(); if (!Downloaded) { return; } ADS.ActiveAudit.DownloadDate = ShopDateTime.Instance.FullShopDateTime; CommonDatabaseContext dataContext = CreateCommonDatabaseContext(); InventoryAuditProcedures.EditAudit(ADS.ActiveAudit, dataContext); if (!dataContext.Result) { MessageBox.Show(dataContext.ErrorText); return; } }
private void btnNewAudit_Click(object sender, EventArgs e) { List <InventoryAuditVO> audits = new List <InventoryAuditVO>(); CommonDatabaseContext dataContext = CreateCommonDatabaseContext(); if (!InventoryAuditProcedures.GetInventoryAudits(audits, null, "ACTIVE", dataContext)) { MessageBox.Show("Error loading active audits."); return; } if (audits.Any(a => a.StoreNumber == ADS.LoggedInUserSecurityProfile.StoreNumber)) { MessageBox.Show("There is already an active audit for this store. Complete the existing audit and try again."); return; } ADS.ActiveAudit = new InventoryAuditVO(); ADS.ActiveAudit.StoreNumber = ADS.LoggedInUserSecurityProfile.StoreNumber; ADS.ActiveAudit.InitiatedBy = ADS.ActiveUserData.CurrentUserFullName; NavControlBox.IsCustom = true; NavControlBox.CustomDetail = "INITIATEAUDIT"; NavControlBox.Action = NavBox.NavAction.SUBMIT; }
public void GetTrakkerUploadReport(bool store, bool display) { CommonDatabaseContext dataContext = CreateCommonDatabaseContext(); List <AuditReportsObject.TrakkerUploadReportSinceLastInventory> fields = new List <AuditReportsObject.TrakkerUploadReportSinceLastInventory>(); AuditReportsProcedures.GetTrakkerUploadReportFields(ref fields, ADS.ActiveAudit.StoreNumber, ADS.ActiveAudit.AuditId, dataContext); AuditReportsObject ro = new AuditReportsObject(); ro.ReportNumber = 22; ro.ReportStore = ADS.ActiveAudit.StoreName; ro.ReportTitle = "Trakker Upload Report"; ro.StoreNumber = ADS.ActiveAudit.StoreNumber; ro.InventoryAuditDate = DateTime.Today; ro.ListTrakkerUploadReportField = fields; ro.ActiveAudit = ADS.ActiveAudit; ro.ReportTempFile = ReportDirectoryPath; TrakkerUploadReport trpt = new TrakkerUploadReport(); trpt.ReportObject = ro; trpt.CreateReport(); if (store) { PrintAndStoreReport(ro, ro.ReportTitle); } if (display) { AuditDesktopSession.ShowPDFFile(ro.ReportTempFileFullName, false); } }
private void btnPreviousAuditTrakker_Click(object sender, EventArgs e) { if (gvMissingItems.SelectedRows.Count != 1) { return; } TrakkerItem item = gvMissingItems.SelectedRows[0].Tag as TrakkerItem; if (item == null) { return; } CommonDatabaseContext dataContext = CreateCommonDatabaseContext(); InventoryAuditProcedures.GetPreviousLocation(ADS.ActiveAudit, item, dataContext); if (!dataContext.Result) { MessageBox.Show("No previous location"); return; } PreviousAuditTrakker previousAuditTrakker = new PreviousAuditTrakker(item); previousAuditTrakker.ShowDialog(); }
private void btnAbort_Click(object sender, EventArgs e) { if (gvAudits.SelectedRows.Count != 1) { return; } InventoryAuditVO audit = gvAudits.SelectedRows[0].Tag as InventoryAuditVO; if (audit == null) { return; } if (MessageBox.Show("All data will be lost. Are you sure you want to abort this audit?", "Abort Audit", MessageBoxButtons.YesNo) != DialogResult.Yes) { return; } audit.Status = AuditStatus.ABORT; CommonDatabaseContext dataContext = CreateCommonDatabaseContext(); InventoryAuditProcedures.EditAudit(audit, dataContext); if (!dataContext.Result) { MessageBox.Show("Error while aborting audit."); return; } LoadAudits(); }
private void btnContinue_Click(object sender, EventArgs e) { SiteId store = ddlStore.SelectedItem as SiteId; if (store == null) { return; } List <InventoryAuditVO> audits = new List <InventoryAuditVO>(); CommonDatabaseContext dataContext = CreateCommonDatabaseContext(); if (!InventoryAuditProcedures.GetInventoryAudits(audits, null, "ACTIVE", dataContext)) { MessageBox.Show("Error loading active audits."); return; } if (audits.Any(a => a.StoreNumber == store.StoreNumber)) { MessageBox.Show("There is already an active audit for this store. Complete the existing audit and try again."); return; } ADS.ActiveAudit = new InventoryAuditVO(); ADS.ActiveAudit.StoreNumber = store.StoreNumber; ADS.ActiveAudit.InitiatedBy = ADS.ActiveUserData.CurrentUserFullName; NavControlBox.Action = NavBox.NavAction.SUBMIT; }
public EnterCaccItems() { InitializeComponent(); DataSet data; CommonDatabaseContext dataContext = CreateCommonDatabaseContext(); bool dataReturned = InventoryAuditProcedures.GetCACCInfo(ADS.ActiveAudit, dataContext, out data); gvItems.AutoGenerateColumns = false; gvItems.Columns["colShortCode"].DataPropertyName = "CAT_CODE"; gvItems.Columns["colCategory"].DataPropertyName = "CAT_DESC"; gvItems.Columns["colPreQty"].DataPropertyName = "ORG_QTY"; gvItems.Columns["ttl_cost"].DataPropertyName = "ORG_COST"; gvItems.Columns["colPreQty"].HeaderCell.Style.Alignment = DataGridViewContentAlignment.BottomCenter; gvItems.Columns["colPreAvg"].HeaderCell.Style.Alignment = DataGridViewContentAlignment.BottomCenter; gvItems.Columns["colPostQty"].HeaderCell.Style.Alignment = DataGridViewContentAlignment.BottomCenter; gvItems.Columns["colPostQty"].DataPropertyName = "NEW_QTY"; gvItems.Columns["colPostAvgCost"].HeaderCell.Style.Alignment = DataGridViewContentAlignment.BottomCenter; var bs = new BindingSource(); bs.DataSource = data.Tables["CACC_summary"]; gvItems.DataSource = bs; btnUndo.Enabled = false; }
private void btnContinue_Click(object sender, System.EventArgs e) { if (Uploaded) { NavControlBox.Action = NavBox.NavAction.SUBMIT; return; } DownloadFiles(); SetButtonStates(); if (!Uploaded) { return; } ADS.ActiveAudit.UploadDate = ShopDateTime.Instance.FullShopDateTime; CommonDatabaseContext dataContext = CreateCommonDatabaseContext(); InventoryAuditProcedures.EditAudit(ADS.ActiveAudit, dataContext); if (!dataContext.Result) { MessageBox.Show(dataContext.ErrorText); return; } }
public void SetInventorySummaryCACCData() { CommonDatabaseContext dataContext = CreateCommonDatabaseContext(); List <AuditReportsObject.InventorySummaryChargeOffsField> fieldsCacc = new List <AuditReportsObject.InventorySummaryChargeOffsField>(); AuditReportsProcedures.GetInventorySummaryReportFieldsCACC(ref fieldsCacc, ADS.ActiveAudit.StoreNumber, ADS.ActiveAudit.AuditId, dataContext); ADS.InventorySummaryReportFieldsCACC = fieldsCacc; }
void bwLoadTrakkerItems_DoWork(object sender, DoWorkEventArgs e) { TrakkerItems = new List <TrakkerItem>(); CommonDatabaseContext dataContext = CreateCommonDatabaseContext(); InventoryAuditProcedures.GetTrakkerItems(TrakkerItems, ADS.ActiveAudit, dataContext); e.Result = dataContext; }
private void btnContinue_Click(object sender, EventArgs e) { if (gvAudits.SelectedRows.Count != 1) { return; } InventoryAuditVO audit = gvAudits.SelectedRows[0].Tag as InventoryAuditVO; if (audit == null) { return; } panelButtons.Enabled = false; ProcessingMessage = new ProcessingMessage("Loading Audit Information", 0); ProcessingMessage.Show(); CommonDatabaseContext dataContext = CreateCommonDatabaseContext(); InventoryAuditProcedures.GetSummaryInfo(audit, dataContext); InventoryAuditProcedures.GetAdditionalAuditInfo(audit, dataContext); ProcessingMessage.Close(); if (!dataContext.Result) { MessageBox.Show("Error loading CACC information"); panelButtons.Enabled = true; return; } ADS.ActiveAudit = audit; switch (audit.Status) { case AuditStatus.ACTIVE: panelButtons.Enabled = true; NavControlBox.IsCustom = true; NavControlBox.CustomDetail = "VIEWACTIVEAUDIT"; NavControlBox.Action = NavBox.NavAction.SUBMIT; break; case AuditStatus.CLOSED: panelButtons.Enabled = true; NavControlBox.IsCustom = true; NavControlBox.CustomDetail = "VIEWCLOSEDAUDIT"; NavControlBox.Action = NavBox.NavAction.SUBMIT; break; default: MessageBox.Show("Status not implemented: " + audit.Status.ToString()); panelButtons.Enabled = true; break; } }
protected CommonDatabaseContext CreateCommonDatabaseContext() { CommonDatabaseContext dataContext = new CommonDatabaseContext(); dataContext.CurrentSiteId = ADS.CurrentSiteId; dataContext.FullUserName = ADS.FullUserName; dataContext.User = ADS.LoggedInUserSecurityProfile; dataContext.UserName = ADS.UserName; return(dataContext); }
private void LoadAudits() { List <InventoryAuditVO> audits = new List <InventoryAuditVO>(); CommonDatabaseContext dataContext = CreateCommonDatabaseContext(); bool retVal = false; gvAudits.Rows.Clear(); if (IsAuditStatusClosed()) { retVal = InventoryAuditProcedures.GetInventoryAudits(audits, ddlShopNumber.Text, null, dataContext); //Closed } else { retVal = InventoryAuditProcedures.GetInventoryAudits(audits, null, "ACTIVE", dataContext); } if (!retVal) { MessageBox.Show(dataContext.ErrorText); return; } List <InventoryAuditVO> sortedAudits = new List <InventoryAuditVO>(); foreach (var audit in audits.FindAll(a => a.StoreNumber == ADS.CurrentSiteId.StoreNumber).OrderBy(ao => ao.DateInitiated).ToList()) { sortedAudits.Add(audit); } foreach (var audit in audits.FindAll(a => a.StateCode == ADS.CurrentSiteId.State && !sortedAudits.Any(sa => sa.AuditId == a.AuditId)).OrderBy(ao => ao.StoreNumber).ThenBy(at => at.DateInitiated).ToList()) { sortedAudits.Add(audit); } foreach (var audit in audits.FindAll(a => !sortedAudits.Any(sa => sa.AuditId == a.AuditId)).OrderBy(ao => ao.StoreNumber).ThenBy(at => at.DateInitiated).ToList()) { sortedAudits.Add(audit); } foreach (InventoryAuditVO audit in sortedAudits) { DataGridViewRow row = gvAudits.Rows.AddNew(); row.Cells[colAuditNumber.Index].Value = audit.AuditId; row.Cells[colAuditType.Index].Value = audit.AuditType.ToString(); row.Cells[colShopNumber.Index].Value = audit.StoreNumber; row.Cells[colDateInitiated.Index].Value = audit.DateInitiated; row.Cells[colLastUpdated.Index].Value = audit.LastUpdated; row.Cells[colInitiatedBy.Index].Value = audit.InitiatedBy; row.Tag = audit; } }
private void SelectStore_Load(object sender, EventArgs e) { List <SiteId> stores = new List <SiteId>(); CommonDatabaseContext dataContext = CreateCommonDatabaseContext(); bool retVal = InventoryAuditProcedures.GetStores(stores, dataContext); if (!retVal) { MessageBox.Show(dataContext.ErrorText); return; } ddlStore.DisplayMember = "StoreNumber"; ddlStore.DataSource = stores; }
public void GetInventorySummaryReport() { CommonDatabaseContext dataContext = CreateCommonDatabaseContext(); List <AuditReportsObject.InventorySummaryChargeOffsField> fields = new List <AuditReportsObject.InventorySummaryChargeOffsField>(); //List<AuditReportsObject.InventorySummaryChargeOffsField> fieldsCacc = new List<AuditReportsObject.InventorySummaryChargeOffsField>(); List <AuditReportsObject.InventorySummaryHistoryField> invHistoryfields = new List <AuditReportsObject.InventorySummaryHistoryField>(); StringBuilder employeesPresent = new StringBuilder(); StringBuilder termEmployees = new StringBuilder(); //AuditReportsProcedures.GetInventorySummaryReportFields(ADS.ActiveAudit.StoreNumber, ADS.ActiveAudit.AuditId, dataContext); AuditReportsProcedures.GetInventorySummaryReportFields(ref fields, ref invHistoryfields, ref employeesPresent, ref termEmployees, ADS.ActiveAudit.StoreNumber, ADS.ActiveAudit.AuditId, dataContext); //AuditReportsProcedures.GetInventorySummaryReportFieldsCACC(ref fieldsCacc, ADS.ActiveAudit.StoreNumber, ADS.ActiveAudit.AuditId, dataContext); List <AuditReportsObject.InventoryQuestion> listQuestions = new List <AuditReportsObject.InventoryQuestion>(); foreach (InventoryQuestion question in ADS.InventoryQuestionsWithResponses) { AuditReportsObject.InventoryQuestion roQuestion = new AuditReportsObject.InventoryQuestion() { Question = question.Question, QuestionNumber = question.QuestionNumber, Response = question.Response, }; listQuestions.Add(roQuestion); } var newListQuestions = listQuestions.OrderBy(x => x.QuestionNumber); AuditReportsObject ro = new AuditReportsObject(); ro.InventoryQuestionsAdditionalComments = ADS.InventoryQuestionsAdditionalComments; ro.ReportNumber = 22; ro.ReportStore = ADS.ActiveAudit.StoreName; //ro.StoreNumber = ADS.ActiveAudit.StoreNumber; ro.StoreNumber = ADS.ActiveAudit.StoreNumber; ro.InventoryAuditDate = DateTime.Today; ro.ListInventorySummaryChargeOffsField = fields; ro.ListInventorySummaryChargeOffsFieldCACC = ADS.InventorySummaryReportFieldsCACC; ro.ListInventorySummaryHistoryField = invHistoryfields; ro.ListInventoryQuestions = newListQuestions.ToList(); ro.StringbuilderInvSummEmployeesPresent = employeesPresent; ro.StringbuilderInvSummTermEmployees = termEmployees; ro.ActiveAudit = ADS.ReportActiveAudit; ro.ReportTempFile = ReportDirectoryPath; InventorySummaryReport invRpt = new InventorySummaryReport(); invRpt.ReportObject = ro; invRpt.CreateReport(); PrintAndStoreReport(ro, "Inventory Summary"); }
private void bwLoadMissingItems_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) { CommonDatabaseContext dataContext = e.Result as CommonDatabaseContext; if (dataContext != null && !dataContext.Result) { ProcessingMessage.Close(); MessageBox.Show(dataContext.ErrorText); NavControlBox.Action = NavBox.NavAction.CANCEL; return; } PopulateMissingItems(); tableLayoutPanel1.Enabled = true; ProcessingMessage.Close(); }
private void bwPostAudit_DoWork(object sender, DoWorkEventArgs e) { CommonDatabaseContext dataContext = CreateCommonDatabaseContext(); ADS.beginTransactionBlock(); InventoryAuditProcedures.PostAudit(ADS.ActiveAudit, dataContext); if (!dataContext.Result) { ADS.endTransactionBlock(EndTransactionType.ROLLBACK); } else { ADS.endTransactionBlock(EndTransactionType.COMMIT); } e.Result = dataContext; }
private void bwLoadInventorySummary_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) { CommonDatabaseContext dataContext = e.Result as CommonDatabaseContext; if (dataContext != null && !dataContext.Result) { ProcessingMessage.Close(); MessageBox.Show(dataContext.ErrorText); NavControlBox.Action = NavBox.NavAction.CANCEL; return; } ReportSummaryDataSet = dataContext.OutputDataSet1; PopulateReportSummary(); PopulateAuditInfo(); ProcessingMessage.Close(); }
private void InitiateAudit_Load(object sender, EventArgs e) { lblShopNumber.Text = ADS.ActiveAudit.StoreNumber; lblAuditorName.Text = ADS.ActiveAudit.InitiatedBy; lblMarketManagerName.Text = "Unknown"; cboTypeOfAudit.SelectedIndex = 0; cboAuditScope.SelectedIndex = 0; cboAuditReason.SelectedIndex = 0; cboReportDetail.SelectedIndex = 2; CommonDatabaseContext dataContext = CreateCommonDatabaseContext(); string marketManagerName = string.Empty; InventoryAuditProcedures.GetMarketManagerName(ref marketManagerName, dataContext); if (dataContext.Result) { lblMarketManagerName.Text = marketManagerName; } }
private void LoadStoresIfNecessary() { if (CachedStores != null) { return; } CachedStores = new List <SiteId>(); CommonDatabaseContext dataContext = CreateCommonDatabaseContext(); bool retVal = InventoryAuditProcedures.GetStores(CachedStores, dataContext); if (!retVal) { MessageBox.Show(dataContext.ErrorText); return; } ddlShopNumber.DisplayMember = "StoreNumber"; ddlShopNumber.DataSource = CachedStores; }
private void bwPostAudit_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) { CommonDatabaseContext dataContext = e.Result as CommonDatabaseContext; ProcessingMessage.Close(); if (!dataContext.Result) { btnContinue.Enabled = true; MessageBox.Show("Error while posting audit"); return; } ADS.InventoryQuestionsWithResponses = Questions.FindAll(q => !string.IsNullOrEmpty(q.Response)); Reports.CallAuditReport callReport = new Reports.CallAuditReport(); callReport.GetInventorySummaryReport(); callReport.GetPostAuditReport(); callReport.GetTrakkerUploadReport(true, false); btnContinue.Enabled = true; ADS.RefreshAuditList = true; NavControlBox.Action = NavBox.NavAction.SUBMIT; }
void bwLoadTrakkerItems_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) { ProcessingMessage.Close(); CommonDatabaseContext dataContext = e.Result as CommonDatabaseContext; if (dataContext != null && !dataContext.Result) { MessageBox.Show(dataContext.ErrorText); NavControlBox.Action = NavBox.NavAction.CANCEL; return; } if (TrakkerItems == null || TrakkerItems.Count == 0) { MessageBox.Show("Unable to load merchandise."); NavControlBox.Action = NavBox.NavAction.CANCEL; return; } ChangeStatusValue1(TrakkerItems.Count.ToString()); }
private void btnContinue_Click(object sender, EventArgs e) { //TODO: update the cacc counts in database CommonDatabaseContext dataContext = CreateCommonDatabaseContext(); int?nrCD, nrVideo, nrGames, nrPremGame, nrDVD; if (gvItems.CurrentCell.IsInEditMode) { gvItems.EndEdit(); } nrCD = Utilities.GetNullableIntegerValue(gvItems.Rows[0].Cells["colActualQty"].Value.ToString(), null); nrVideo = Utilities.GetNullableIntegerValue(gvItems.Rows[1].Cells["colActualQty"].Value.ToString(), null); nrGames = Utilities.GetNullableIntegerValue(gvItems.Rows[2].Cells["colActualQty"].Value.ToString(), null); nrPremGame = Utilities.GetNullableIntegerValue(gvItems.Rows[3].Cells["colActualQty"].Value.ToString(), null); nrDVD = Utilities.GetNullableIntegerValue(gvItems.Rows[4].Cells["colActualQty"].Value.ToString(), null); bool retval = InventoryAuditProcedures.persistCACCCounts(dataContext, ADS.ActiveAudit.StoreNumber, ADS.ActiveAudit.AuditId, GetWritableValue(nrCD), GetWritableValue(nrVideo), GetWritableValue(nrGames), GetWritableValue(nrPremGame), GetWritableValue(nrDVD)); NavControlBox.Action = NavBox.NavAction.SUBMIT; }
void bwLoadTempIcns_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) { CommonDatabaseContext dataContext = e.Result as CommonDatabaseContext; if (dataContext != null && !dataContext.Result) { ProcessingMessage.Close(); MessageBox.Show(dataContext.ErrorText); TrakkerSequenceNumber = 0; DialogResult = DialogResult.Cancel; Close(); return; } if (TempItems == null) { ProcessingMessage.Close(); MessageBox.Show("Unable to load temporary icn's."); TrakkerSequenceNumber = 0; DialogResult = DialogResult.Cancel; Close(); return; } foreach (TrakkerItem item in TempItems) { DataGridViewRow row = gvItems.Rows.AddNew(); row.Cells[colIcn.Index].Value = item.Icn.ToString(); row.Cells[colStatus.Index].Value = item.Status; row.Cells[colCost.Index].Value = item.PfiAmount.ToString("c"); row.Cells[colDescription.Index].Value = item.Description; row.Tag = item; } gvItems.SetupAutoSizeColumns(); Refresh(); ProcessingMessage.Close(); }
private void bwLoadInventorySummary_DoWork(object sender, DoWorkEventArgs e) { CommonDatabaseContext dataContextSummary = CreateCommonDatabaseContext(); InventoryAuditProcedures.GetSummary(ADS.ActiveAudit, dataContextSummary); if (!dataContextSummary.Result) { e.Result = dataContextSummary; } CommonDatabaseContext dataContextAuditInfo = CreateCommonDatabaseContext(); InventoryAuditProcedures.GetAdditionalAuditInfo(ADS.ActiveAudit, dataContextAuditInfo); if (!dataContextAuditInfo.Result) { e.Result = dataContextAuditInfo; } dataContextSummary.OutputDataSet2 = dataContextAuditInfo.OutputDataSet1; e.Result = dataContextSummary; }
private void btnContinue_Click(object sender, EventArgs e) { InventoryAuditVO audit = ADS.ActiveAudit; audit.AuditScope = ((EnumPair <AuditScope>)cboAuditScope.SelectedItem).Value; audit.AuditType = ((EnumPair <AuditType>)cboTypeOfAudit.SelectedItem).Value; audit.DateInitiated = ShopDateTime.Instance.FullShopDateTime; audit.ExitingShopManager = txtExitingShopManagerName.Text.Trim(); audit.MarketManagerPresent = cboMarketManagerPresent.AnswerYes; audit.AuditReason = ((EnumPair <AuditReason>)cboAuditReason.SelectedItem).Value; audit.ReportDetail = ((EnumPair <AuditReportDetail>)cboReportDetail.SelectedItem).Value; CommonDatabaseContext dataContext = new CommonDatabaseContext(); InventoryAuditProcedures.CreateAudit(audit, dataContext); if (!dataContext.Result) { MessageBox.Show("Error initiating audit."); return; } NavControlBox.Action = NavBox.NavAction.SUBMIT; }
public static bool GetInventorySummaryReportFieldsCACC(ref List <AuditReportsObject.InventorySummaryChargeOffsField> chargeoffields, string storenumber, int auditID, CommonDatabaseContext dataContext) { OracleDataAccessor dA = GlobalDataAccessor.Instance.OracleDA; string lastInvAudit = string.Empty; //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_last_inv_audit", "o_last_inv_audit")); refCursors.Add(new PairType <string, string>("o_cacc_info", "o_cacc_info")); //Make stored proc call bool retVal; DataSet outputDataSet; try { retVal = GlobalDataAccessor.Instance.OracleDA.issueSqlStoredProcCommand("ccsowner", "AUDIT_REPORTS", "getCACCInfo", oParams, refCursors, "o_return_code", "o_return_text", out outputDataSet); dataContext.ErrorCode = dA.ErrorCode; dataContext.ErrorText = dA.ErrorDescription; } catch (OracleException oEx) { BasicExceptionHandler.Instance.AddException("GetInventorySummaryReportFields Failed", oEx); dataContext.ErrorCode = "GetInventorySummaryReportFields"; dataContext.ErrorText = "OracleException thrown: " + oEx.Message; return(false); } if (retVal == false) { BasicExceptionHandler.Instance.AddException("GetInventorySummaryReportFields Failed: return value is false", new ApplicationException()); dataContext.ErrorCode = dA.ErrorCode + " --- GetInventorySummaryReportFields"; dataContext.ErrorText = dA.ErrorDescription + " -- Return value is false"; return(false); } if (outputDataSet == null) { return(false); } if (outputDataSet.Tables.Count > 0) { try { if (outputDataSet.Tables[TBL_INVENTORYSUMMARY_CHARGEOFF_CACC] != null && outputDataSet.Tables[TBL_INVENTORYSUMMARY_CHARGEOFF_CACC].Rows.Count > 0) { foreach (DataRow dr in outputDataSet.Tables[TBL_INVENTORYSUMMARY_CHARGEOFF_CACC].Rows) { AuditReportsObject.InventorySummaryChargeOffsField field = new AuditReportsObject.InventorySummaryChargeOffsField(); field.Category = Utilities.GetIntegerValue(dr["CAT_CODE"], 0); field.CategoryDescription = Utilities.GetStringValue(dr["CAT_DESC"], string.Empty); field.TotalItems = Utilities.GetIntegerValue(dr["ORG_QTY"], 0); field.TotalAmount = Utilities.GetDecimalValue(dr["ORG_COST"], 0.00M); field.TotalItemsNF = Utilities.GetIntegerValue(dr["NEW_QTY"], 0); field.TotalAmountNF = Utilities.GetDecimalValue(dr["NEW_COST"], 0.00M); if (field.TotalItems > field.TotalItemsNF) { field.TotalItemsNF = field.TotalItems - field.TotalItemsNF; } else { field.TotalItemsNF = 0; } if (field.TotalAmount > field.TotalAmountNF) { field.TotalAmountNF = field.TotalAmount - field.TotalAmountNF; } else { field.TotalAmountNF = 0.00m; } field.PercentItemsNF = (field.TotalItemsNF > 0 && field.TotalItems > 0) ? Math.Round((decimal)field.TotalItemsNF / (decimal)field.TotalItems * 100, 2) : 0.00M; field.PercentNFAmount = (field.TotalAmountNF > 0.00m & field.TotalAmount > 0.00m) ? Math.Round(field.TotalAmountNF / field.TotalAmount * 100, 2) : 0.00M; chargeoffields.Add(field); } } } catch (Exception e) { return(false); } } dataContext.ErrorCode = "0"; dataContext.ErrorText = "Success"; return(true); }
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); }
public static bool GetTrakkerUploadReportFields(ref List <AuditReportsObject.TrakkerUploadReportSinceLastInventory> uploadFields, string storenumber, int auditID, CommonDatabaseContext dataContext) { //CommonDatabaseContext dataContext = CreateCommonDatabaseContext(); if (uploadFields == null) { throw new ArgumentNullException("TrakkerUploadReportFields"); } 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_tmp_icn", "o_tmp_icn")); refCursors.Add(new PairType <string, string>("o_msg_items", "o_msg_items")); refCursors.Add(new PairType <string, string>("o_nxt_items", "o_nxt_items")); refCursors.Add(new PairType <string, string>("o_unexp_items", "o_unexp_items")); refCursors.Add(new PairType <string, string>("o_dup_items", "o_dup_items")); //Make stored proc call bool retVal; DataSet outputDataSet; try { retVal = GlobalDataAccessor.Instance.OracleDA.issueSqlStoredProcCommand("ccsowner", "AUDIT_REPORTS", "TrakkerUploadReport", oParams, refCursors, "o_return_code", "o_return_text", out outputDataSet); dataContext.ErrorCode = dA.ErrorCode; dataContext.ErrorText = dA.ErrorDescription; } catch (OracleException oEx) { BasicExceptionHandler.Instance.AddException("GetTrakkerUploadReportFields Failed", oEx); dataContext.ErrorCode = "GetTrakkerUploadReportFieldsFailed"; dataContext.ErrorText = "OracleException thrown: " + oEx.Message; return(false); } if (retVal == false) { BasicExceptionHandler.Instance.AddException("GetTrakkerUploadReportFields Failed: return value is false", new ApplicationException()); dataContext.ErrorCode = dA.ErrorCode + " --- GetTrakkerUploadReportFields"; dataContext.ErrorText = dA.ErrorDescription + " -- Return value is false"; return(false); } if (outputDataSet == null) { return(false); } if (outputDataSet.Tables.Count > 0) { if (outputDataSet.Tables[TBL_TRAKKER_TMP_ICN] != null && outputDataSet.Tables[TBL_TRAKKER_TMP_ICN].Rows.Count > 0) { foreach (DataRow dr in outputDataSet.Tables[TBL_TRAKKER_TMP_ICN].Rows) { uploadFields.Add(new AuditReportsObject.TrakkerUploadReportSinceLastInventory() { ICN = Utilities.GetStringValue(dr["ICN"], string.Empty), MerchandiseDescription = Utilities.GetStringValue(dr["MD_DESC"], string.Empty), Cost = Utilities.GetDecimalValue(dr["PFI_AMOUNT"], 0.00M), Retail = Utilities.GetDecimalValue(dr["RETAIL_PRICE"], 0.00M), Status = Utilities.GetStringValue(dr["STATUS_CD"], string.Empty), Category = (int)EnumTrakkerUploadReportCategories.TempICNsSinceLastInventory }); } } if (outputDataSet.Tables[TBL_TRAKKER_MISSING_ITEMS] != null && outputDataSet.Tables[TBL_TRAKKER_MISSING_ITEMS].Rows.Count > 0) { //int rowcount = 1; foreach (DataRow dr in outputDataSet.Tables[TBL_TRAKKER_MISSING_ITEMS].Rows) { uploadFields.Add(new AuditReportsObject.TrakkerUploadReportMissingItems() { ICN = Utilities.GetStringValue(dr["ICN"], string.Empty), MerchandiseDescription = Utilities.GetStringValue(dr["MD_DESC"], string.Empty), Cost = Utilities.GetDecimalValue(dr["PFI_AMOUNT"], 0.00M), Retail = Utilities.GetDecimalValue(dr["RETAIL_PRICE"], 0.00M), Status = Utilities.GetStringValue(dr["STATUS_CD"], string.Empty), Category = (int)EnumTrakkerUploadReportCategories.MissingItems }); } } if (outputDataSet.Tables[TBL_TRAKKER_NXT_ITEMS] != null && outputDataSet.Tables[TBL_TRAKKER_NXT_ITEMS].Rows.Count > 0) { foreach (DataRow dr in outputDataSet.Tables[TBL_TRAKKER_NXT_ITEMS].Rows) { uploadFields.Add(new AuditReportsObject.TrakkerUploadReportNXTsSinceLastInventory() { ICN = Utilities.GetStringValue(dr["ICN"], string.Empty), MerchandiseDescription = Utilities.GetStringValue(dr["MD_DESC"], string.Empty), Retail = Utilities.GetDecimalValue(dr["RETAIL_PRICE"], 0.00M), Status = Utilities.GetStringValue(dr["STATUS_CD"], string.Empty), TransactionNumber = Utilities.GetStringValue(dr["MSR"], string.Empty), Category = (int)EnumTrakkerUploadReportCategories.NXTICNsSinceLastInventory }); } } if (outputDataSet.Tables[TBL_TRAKKER_UNEXP_ITEMS] != null && outputDataSet.Tables[TBL_TRAKKER_UNEXP_ITEMS].Rows.Count > 0) { foreach (DataRow dr in outputDataSet.Tables[TBL_TRAKKER_UNEXP_ITEMS].Rows) { uploadFields.Add(new AuditReportsObject.TrakkerUploadReportUnexpectedItems() { ICN = Utilities.GetStringValue(dr["ICN"], string.Empty), MerchandiseDescription = Utilities.GetStringValue(dr["MD_DESC"], string.Empty), Cost = Utilities.GetDecimalValue(dr["PFI_AMOUNT"], 0.00M), TrakID = Utilities.GetIntegerValue(dr["TRAK_ID"], 0), ScanSequence = Utilities.GetIntegerValue(dr["TRAK_SEQ"], 0), Status = Utilities.GetStringValue(dr["STATUS_CD"], string.Empty), TrakFlag = Utilities.GetStringValue(dr["TRAK_NEW_FLAG"], string.Empty), Category = (int)EnumTrakkerUploadReportCategories.UnexpectedItems }); } } if (outputDataSet.Tables[TBL_TRAKKER_DUP_ITEMS] != null && outputDataSet.Tables[TBL_TRAKKER_DUP_ITEMS].Rows.Count > 0) { foreach (DataRow dr in outputDataSet.Tables[TBL_TRAKKER_DUP_ITEMS].Rows) { uploadFields.Add(new AuditReportsObject.TrakkerUploadReportDuplicateScans() { ICN = Utilities.GetStringValue(dr["ICN"], string.Empty), MerchandiseDescription = Utilities.GetStringValue(dr["MD_DESC"], string.Empty), Cost = Utilities.GetDecimalValue(dr["PFI_AMOUNT"], 0.00M), TrakID = Utilities.GetIntegerValue(dr["TRAK_ID"], 0), AuditLocation = Utilities.GetStringValue(dr["TRAK_LOC"], string.Empty), ScanSequence = Utilities.GetIntegerValue(dr["TRAK_SEQ"], 0), Status = Utilities.GetStringValue(dr["STATUS_CD"], string.Empty), TrakFlag = Utilities.GetStringValue(dr["TRAK_NEW_FLAG"], string.Empty), Category = (int)EnumTrakkerUploadReportCategories.DuplicateScans }); } } dataContext.ErrorCode = "0"; dataContext.ErrorText = "Success"; } return(true); }