private void InitialScreen() { InitailSpread(); InitialComboBox(); tsbNew.Visible = false; tsSeperator1.Visible = false; //txtSearch.KeyPress += CommonLib.CtrlUtil.SetRestrictKeyInput; //txtSearch.KeyUp += CommonLib.CtrlUtil.FilterRestrictChar; dtPeriodBegin.Format = Common.CurrentUserInfomation.DateFormatString; dtPeriodEnd.Format = Common.CurrentUserInfomation.DateFormatString; //NZString YearMonth = new NZString(null, Common.GetDatabaseDateTime().ToString("yyyyMM")); InventoryPeriodBIZ biz = new InventoryPeriodBIZ(); InventoryPeriodDTO dto = biz.LoadCurrentPeriod(); if (dto != null) { dtPeriodBegin.Value = dto.PERIOD_BEGIN_DATE.StrongValue; dtPeriodEnd.Value = dto.PERIOD_END_DATE.StrongValue; } LoadData(); dtPeriodBegin.Focus(); }
private void LoadDefaultPeriod(bool LoadCurrentPeriod, bool LoadDefaultYearMonth) { InventoryPeriodBIZ biz = new InventoryPeriodBIZ(); InventoryPeriodDTO dto; if (LoadCurrentPeriod) { dto = biz.LoadCurrentPeriod(); } else { dto = biz.LoadPeriodByDate(new NZDateTime(dtInventoryMonth, dtInventoryMonth.Value)); } if (dto != null) { int year = Convert.ToInt32(dto.YEAR_MONTH.StrongValue.Substring(0, 4)); int month = Convert.ToInt32(dto.YEAR_MONTH.StrongValue.Substring(4, 2)); if (LoadDefaultYearMonth) { dtInventoryMonth.Value = new DateTime(year, month, 1); } dtPeriodFrom.Value = dto.PERIOD_BEGIN_DATE.StrongValue; dtPeriodTo.Value = dto.PERIOD_END_DATE.StrongValue; } else { dtPeriodFrom.Value = new DateTime(dtInventoryMonth.Value.Value.Year, dtInventoryMonth.Value.Value.Month, 1); dtPeriodTo.Value = new DateTime(dtInventoryMonth.Value.Value.Year, dtInventoryMonth.Value.Value.Month, DateTime.DaysInMonth(dtInventoryMonth.Value.Value.Year, dtInventoryMonth.Value.Value.Month)); } }
private void InitialScreen() { picWaiting.Visible = false; switch (CommonLib.Common.CurrentUserInfomation.DateFormat) { case eDateFormat.DMY: case eDateFormat.MDY: dtInventoryMonth.Format = "MM/yyyy"; break; case eDateFormat.YMD: dtInventoryMonth.Format = "yyyy/MM"; break; } InventoryPeriodBIZ biz = new InventoryPeriodBIZ(); InventoryPeriodDTO dto = biz.LoadCurrentPeriod(); DateTime currentYearMonth = new DateTime( Convert.ToInt32(dto.YEAR_MONTH.StrongValue.Substring(0, 4)), Convert.ToInt32(dto.YEAR_MONTH.StrongValue.Substring(4, 2)), 1); dtInventoryMonth.DateValue = currentYearMonth; CommonLib.CtrlUtil.EnabledControl(false, txtInfo, dtInventoryMonth); }
public ErrorItem CheckWorkResultDate(NZDateTime date) { if (date.IsNull) { return(new ErrorItem(date.Owner, TKPMessages.eValidate.VLM0046.ToString())); } InventoryPeriodBIZ biz = new InventoryPeriodBIZ(); InventoryPeriodDTO dto = biz.LoadCurrentPeriod(); if (dto == null) { return(new ErrorItem(date.Owner, TKPMessages.eValidate.VLM0047.ToString())); } // edit by tar // AddMonths(1) to period end date if (date.StrongValue.Date.CompareTo(dto.PERIOD_BEGIN_DATE.StrongValue.Date) < 0 || date.StrongValue.Date.CompareTo(dto.PERIOD_END_DATE.StrongValue.AddMonths(1).Date) > 0) { return(new ErrorItem(date.Owner, TKPMessages.eValidate.VLM0047.ToString())); } return(null); }
public ErrorItem CheckIssueDate(NZDateTime IssueDate) { if (IssueDate.IsNull) { return(new ErrorItem(IssueDate.Owner, TKPMessages.eValidate.VLM0031.ToString())); } InventoryPeriodBIZ biz = new InventoryPeriodBIZ(); //NZString YearMonth = new NZString(IssueDate.Owner, IssueDate.StrongValue.ToString("yyyyMM")); InventoryPeriodDTO dto = biz.LoadCurrentPeriod(); if (dto == null) { return(new ErrorItem(IssueDate.Owner, TKPMessages.eValidate.VLM0032.ToString())); } // edit by tar // AddMonths(1) to period end date if (dto.PERIOD_BEGIN_DATE.StrongValue.Date > IssueDate.StrongValue.Date || dto.PERIOD_END_DATE.StrongValue.AddMonths(1).Date < IssueDate.StrongValue.Date) { return(new ErrorItem(IssueDate.Owner, TKPMessages.eValidate.VLM0032.ToString())); } return(null); }
private void LoadDefaultPeriod() { InventoryPeriodBIZ biz = new InventoryPeriodBIZ(); InventoryPeriodDTO dto = biz.LoadCurrentPeriod(); dtMonth.NZValue = dto.PERIOD_BEGIN_DATE; }
private ErrorItem CheckCanRunProcess() { try { // get year month InventoryPeriodBIZ bizPeriod = new InventoryPeriodBIZ(); InventoryPeriodDTO dtoPeriod = bizPeriod.LoadCurrentPeriod(); if (!dtoPeriod.YEAR_MONTH.StrongValue.Equals(Convert.ToDateTime(dtpStockTakingDate.Value).ToString("yyyyMM"))) { return(new ErrorItem(null, TKPMessages.eValidate.VLM0084.ToString(), new[] { "" })); } if (Convert.ToDateTime(dtpLastSTKDate.DateValue) > Convert.ToDateTime(dtpStockTakingDate.Value)) { return(new ErrorItem(null, TKPMessages.eValidate.VLM0084.ToString(), new[] { "" })); } } catch (Exception ex) { MessageDialog.ShowBusiness(this, ex.Message); } return(null); }
private void LoadItemData(string keyFilter) { //set ให้ show column ทั้งหมด shtView.Columns[0, shtView.Columns.Count - 1].Visible = true; InventoryPeriodBIZ inventoryPeriodBIZ = new InventoryPeriodBIZ(); InventoryPeriodDTO inventoryPeriodDTO = inventoryPeriodBIZ.LoadCurrentPeriod(); DataTable dt = null; InventoryBIZ inventoryBIZ = new InventoryBIZ(); if (m_searchType == eSearchType.All) { dt = inventoryBIZ.LoadAllLotNo(inventoryPeriodDTO.YEAR_MONTH); shtView.Columns[(int)eColView.ON_HAND_QTY].Visible = false; } else if (m_searchType == eSearchType.DependOnItemAndLocation) { dt = inventoryBIZ.LoadAllLotNoByItemAndLocation(inventoryPeriodDTO.YEAR_MONTH, m_itemCode, m_locationCode); } else { dt = inventoryBIZ.LoadAllLotNo(inventoryPeriodDTO.YEAR_MONTH); shtView.Columns[(int)eColView.ON_HAND_QTY].Visible = false; } DataTable dtView = dt.Clone(); if (keyFilter != string.Empty) { // string filterString = string.Format(@" // {1} LIKE '%{0}%' // OR {2} LIKE '%{0}%' // ", keyFilter, eColView.LOT_NO, eColView.PACK_NO); string filterString = FilterStringUtil.GetFilterstring(dtView, keyFilter); //get only the rows you want DataRow[] results = dt.Select(filterString); //populate new destination table foreach (DataRow dr in results) { dtView.ImportRow(dr); } } else { foreach (DataRow dr in dt.Rows) { dtView.ImportRow(dr); } } fpView.DataSource = dtView; }
public ErrorItem CheckCurrentPeriod(NZString YearMonth) { InventoryPeriodBIZ biz = new InventoryPeriodBIZ(); InventoryPeriodDTO dto = biz.LoadCurrentPeriod(); if (dto.YEAR_MONTH.StrongValue != YearMonth.StrongValue) { return(new ErrorItem(null, TKPMessages.eValidate.VLM0078.ToString())); } return(null); }
public AdjustmentEntryUIDM ConvertDTOToUIDM(InventoryTransactionDTO dto) { AdjustmentEntryUIDM model = new AdjustmentEntryUIDM(); model.TransactionID = dto.TRANS_ID; model.AdjustNo = dto.SLIP_NO; model.AdjustDate = dto.TRANS_DATE; model.AdjustType = dto.IN_OUT_CLS; model.ItemCode = dto.ITEM_CD; model.StoredLoc = dto.LOC_CD; model.LotNo = dto.LOT_NO; model.PackNo = dto.PACK_NO; model.FGNo = dto.FG_NO; model.ExternalLotNo = dto.EXTERNAL_LOT_NO; model.AdjustWeight = dto.WEIGHT; model.AdjustQty = dto.QTY; model.Remark = dto.REMARK; model.ReasonCode = dto.TRAN_SUB_CLS; //== Get Item Description. ItemBIZ biz = new ItemBIZ(); ItemDTO itemDTO = biz.LoadItem(dto.ITEM_CD); model.ItemDesc = itemDTO.SHORT_NAME; //-- Get Customer Name DealingBIZ bizCust = new DealingBIZ(); DealingDTO dtoCust = bizCust.LoadLocation(itemDTO.CUSTOMER_CD); model.CustomerName = dtoCust.LOC_DESC; //== Get OnHand. InventoryBIZ inventoryBIZ = new InventoryBIZ(); InventoryPeriodBIZ inventoryPeriodBIZ = new InventoryPeriodBIZ(); InventoryPeriodDTO inventoryPeriodDTO = inventoryPeriodBIZ.LoadCurrentPeriod(); InventoryOnhandDTO inventoryOnhandDTO = inventoryBIZ.LoadInventoryOnHandByDate(inventoryPeriodDTO.YEAR_MONTH, dto.TRANS_DATE, dto.ITEM_CD, dto.LOC_CD, dto.LOT_NO, dto.PACK_NO); if (inventoryOnhandDTO == null) { model.OnHandQty.Value = 0; } else { model.OnHandQty = inventoryOnhandDTO.ON_HAND_QTY; } return(model); }
private void RollingStart(eMonthlyCloseProcess ProcessType) { try { NZString YearMonth = Convert.ToDateTime(dtInventoryMonth.DateValue).ToString("yyyyMM").ToNZString(); InventoryPeriodValidator val = new InventoryPeriodValidator(); //val.CheckBeforeRunProcess(ProcessType); ErrorItem err = val.CheckBeforeRunClosingProcess(ProcessType, YearMonth); if (err != null) { MessageDialogResult cf = MessageDialog.ShowConfirmation(this, EVOFramework.Message.LoadMessage(TKPMessages.eValidate.VLM0076.ToString()).MessageDescription, MessageDialogButtons.YesNo); if (cf != MessageDialogResult.Yes) { return; } } MessageDialogResult dr = MessageDialog.ShowConfirmation(this, new EVOFramework.Message(TKPMessages.eConfirm.CFM0005.ToString()).MessageDescription, MessageDialogButtons.YesNo); if (dr == MessageDialogResult.Yes) { if (RunProcess(ProcessType)) { MessageDialog.ShowBusiness(this, EVOFramework.Message.LoadMessage(SystemMaintenance.Messages.eInformation.INF9003.ToString())); } InventoryPeriodBIZ biz = new InventoryPeriodBIZ(); InventoryPeriodDTO dto = biz.LoadCurrentPeriod(); DateTime currentYearMonth = new DateTime( Convert.ToInt32(dto.YEAR_MONTH.StrongValue.Substring(0, 4)), Convert.ToInt32(dto.YEAR_MONTH.StrongValue.Substring(4, 2)), 1); dtInventoryMonth.DateValue = currentYearMonth; } } catch (ValidateException ex) { MessageDialog.ShowBusiness(this, ex.ErrorResults[0].Message); } catch (BusinessException ex) { MessageDialog.ShowBusiness(this, ex.Error.Message); } catch (Exception ex) { MessageDialog.ShowBusiness(this, ex.Message); } }
/// <summary> /// check ว่ามีการทำ inventory move หรือยัง /// </summary> /// <returns></returns> public ErrorItem CheckInventoryCurrentPeriod() { InventoryPeriodBIZ bizInventoryPeriod = new InventoryPeriodBIZ(); InventoryPeriodDTO dtoInventoryPeriod = bizInventoryPeriod.LoadCurrentPeriod(); if (IsInDateRange(dtoInventoryPeriod.PERIOD_BEGIN_DATE.StrongValue, dtoInventoryPeriod.PERIOD_END_DATE.StrongValue , CommonLib.Common.GetDatabaseDateTime())) { return(null); } return(new ErrorItem(null, SystemMaintenance.Messages.eInformation.INF9005.ToString())); //return false; }
/// <summary> /// Check if date is between date range of current period? /// </summary> /// <param name="checkDate"></param> /// <returns></returns> public ErrorItem DateIsInCurrentPeriod(DateTime checkDate) { InventoryPeriodBIZ bizInventoryPeriod = new InventoryPeriodBIZ(); InventoryPeriodDTO dtoInventoryPeriod = bizInventoryPeriod.LoadCurrentPeriod(); if (dtoInventoryPeriod.PERIOD_BEGIN_DATE.StrongValue > checkDate.Date || dtoInventoryPeriod.PERIOD_END_DATE.StrongValue.AddMonths(1).Date < checkDate.Date) { //return new ErrorItem(null, Message.LoadMessage(TKPMessages.eValidate.VLM0075.ToString()).MessageDescription); return(new ErrorItem(null, TKPMessages.eValidate.VLM0075.ToString())); } //IsInDateRange(dtoInventoryPeriod.PERIOD_BEGIN_DATE.StrongValue, // dtoInventoryPeriod.PERIOD_END_DATE.StrongValue.AddMonths(1) // , checkDate) return(null); }
/// <summary> /// Check empty and not in current period. /// </summary> /// <param name="date"></param> /// <returns></returns> public ErrorItem CheckReceiveDate(NZDateTime date) { if (date.IsNull) { return(new ErrorItem(date.Owner, TKPMessages.eValidate.VLM0041.ToString())); } // Check in using period. InventoryPeriodBIZ inventoryPeriodBIZ = new InventoryPeriodBIZ(); InventoryPeriodDTO inventoryPeriodDTO = inventoryPeriodBIZ.LoadCurrentPeriod(); InventoryPeriodValidator inventoryPeriodValidator = new InventoryPeriodValidator(); // fix by tar // AddMonths(1) to period end date if (date.StrongValue.Date < inventoryPeriodDTO.PERIOD_BEGIN_DATE.StrongValue.Date || date.StrongValue.Date > inventoryPeriodDTO.PERIOD_END_DATE.StrongValue.AddMonths(1).Date) { return(new ErrorItem(date.Owner, TKPMessages.eValidate.VLM0042.ToString())); } return(null); }
private void LoadCurrentStockTakingData() { InventoryPeriodBIZ biz = new InventoryPeriodBIZ(); InventoryPeriodDTO dto = biz.LoadCurrentPeriod(); //DateTime currentYearMonth = new DateTime( // Convert.ToInt32(dto.YEAR_MONTH.StrongValue.Substring(0, 4)), // Convert.ToInt32(dto.YEAR_MONTH.StrongValue.Substring(4, 2)), // 1); txtYearMonth.Text = dto.YEAR_MONTH; dtpStockTakingDate.Value = DateTime.Today; StockTakingBIZ stkBiz = new StockTakingBIZ(); StockTakingDTO stkDTO = stkBiz.LoadLastStockTaking(); if (stkDTO != null) { this.txtLastRemark.Text = stkDTO.REMARK; this.dtpLastSTKDate.DateValue = stkDTO.STOCK_TAKING_DATE; this.txtLastPreProcessBy.Text = stkDTO.PRE_PROCESS_BY + " - " + stkDTO.PRE_PROCESS_NAME; } //CommonLib.CtrlUtil.EnabledControl(false, txtInfo, dtInventoryMonth); }