private void btnSearch_Click(object sender, EventArgs e) { stockOutList.Clear(); ReportStockOutEventArgs eventArgs = new ReportStockOutEventArgs(); eventArgs.ReportDateStockOutParam = new ReportDateStockOutParam { FromDate = DateUtility.ZeroTime(dtpFrom.Value), ToDate = DateUtility.MaxTime(dtpTo.Value) }; EventUtility.fireEvent(LoadStockOutsEvent,this,eventArgs); if(eventArgs.ResultStockOutList!=null) { foreach (IList result in eventArgs.ResultStockOutList) { StockOutView stockOutView = new StockOutView(); stockOutView.StockOut = (StockOut)result[0]; stockOutView.TotalQuantity = (long) result[1]; stockOutView.Department = (Department) result[3]; if (stockOutView.Department != null) { stockOutView.DepartmentName = stockOutView.DepartmentName; } else { stockOutView.DepartmentName = " Kho chinh"; } stockOutView.CreateDate = stockOutView.StockOut.CreateDate; bdsStockOut.Add(stockOutView); } } bdsStockOut.EndEdit(); dgvStock.Refresh(); dgvStock.Invalidate(); CreateCountOnList(); }
private void btnSave_Click(object sender, EventArgs e) { DataGridViewSelectedRowCollection selectedRows = dgvStockOut.SelectedRows; if (!(selectedRows.Count > 0)) { return; } ReportStockOutEventArgs eventArgs = new ReportStockOutEventArgs(); IList list = new ArrayList(); foreach (DataGridViewRow row in selectedRows) { list.Add(deptStockOutList[row.Index].DepartmentStockOut); } eventArgs.ConfirmDepartmentStockOutList = list; EventUtility.fireEvent(ConfirmStockOutEvent, this, eventArgs); if (!eventArgs.HasErrors) { } ClearForm(); }
void reportStockOutView_LoadDepartmentStockOutByRangeEvent(object sender, ReportStockOutEventArgs e) { ObjectCriteria criteria = new ObjectCriteria(); criteria.AddBetweenCriteria("CreateDate", e.ReportDateStockOutParam.FromDate, e.ReportDateStockOutParam.ToDate); criteria.AddEqCriteria("DepartmentStockInPK.DepartmentId", e.SelectDepartment.DepartmentId); IList stockInList = DepartmentStockInLogic.FindAll(criteria); e.ResultStockOutList = stockInList; IList productMasterList = DepartmentStockInLogic.FindByProductMaster(e.SelectDepartment.DepartmentId, e.ReportDateStockOutParam.FromDate, e.ReportDateStockOutParam.ToDate); e.ProductMastersInList = productMasterList; }
private void btnSearch_Click(object sender, EventArgs e) { deptStockOutList.Clear(); ReportStockOutEventArgs eventArgs = new ReportStockOutEventArgs(); eventArgs.ReportDateStockOutParam = new ReportDateStockOutParam { FromDate = DateUtility.ZeroTime(dtpFrom.Value), ToDate = DateUtility.MaxTime(dtpTo.Value) }; EventUtility.fireEvent(LoadDepartmentStockOutsEvent, this, eventArgs); if (eventArgs.ResultStockOutList != null) { foreach (IList result in eventArgs.ResultStockOutList) { DepartmentStockOutView stockOutView = new DepartmentStockOutView(); stockOutView.DepartmentStockOut = (DepartmentStockOut)result[0]; stockOutView.TotalQuantity = (long)result[1]; stockOutView.Department = (Department)result[3]; if (stockOutView.Department != null) { stockOutView.DepartmentName = stockOutView.Department.DepartmentName; } else { stockOutView.DepartmentName = " Kho chinh"; } stockOutView.CreateDate = stockOutView.DepartmentStockOut.CreateDate; deptStockOutList.Add(stockOutView); } } else { MessageBox.Show(" Không có hoá đơn xuất kho của cửa hàng nào cần xác nhận."); } bdsDeptStockOut.EndEdit(); dgvStockOutDetail.Refresh(); dgvStockOutDetail.Invalidate(); CreateCountOnList(); }
void mainStockOutReportView_LoadStockOutsEvent(object sender, ReportStockOutEventArgs e) { IList list = StockOutLogic.FindStockOut(e.ReportDateStockOutParam.FromDate, e.ReportDateStockOutParam.ToDate); if (list != null) { IList parentList = new ArrayList(); for (int i = 0; i < list.Count; i++) { IList childList = new ArrayList(); childList.Add(((IList)list[i])[0]); childList.Add(((IList)list[i])[1]); childList.Add(((IList)list[i])[2]); long departmentId = (long) ((IList) list[i])[2]; Department dep = DepartmentLogic.FindById(departmentId); childList.Add(dep); parentList.Add(childList); } e.ResultStockOutList = parentList; } }
void reportStockOutView_LoadAllDeparmentEvent(object sender, ReportStockOutEventArgs e) { ObjectCriteria criteria = new ObjectCriteria(); criteria.AddEqCriteria("DelFlg", (long)0); IList departmentList = DepartmentLogic.FindAll(criteria); e.DepartmentsList = departmentList; }
void departmentStockOutReportView_DenyStockOutEvent(object sender, ReportStockOutEventArgs e) { IList list = e.DenyDepartmentStockOutList; foreach (DepartmentStockOut departmentStockOut in list) { foreach (DepartmentStockOutDetail detail in departmentStockOut.DepartmentStockOutDetails) { ObjectCriteria criteria = new ObjectCriteria(); criteria.AddEqCriteria("Product.ProductId", detail.Product.ProductId); IList productList = StockLogic.FindAll(criteria); if (productList != null) { Stock currStock = (Stock)productList[0]; currStock.GoodQuantity += detail.GoodQuantity; currStock.Quantity += detail.GoodQuantity; currStock.ErrorQuantity += detail.ErrorQuantity; currStock.Quantity += detail.ErrorQuantity; currStock.LostQuantity += detail.LostQuantity; currStock.LostQuantity += detail.LostQuantity; currStock.DamageQuantity += detail.DamageQuantity; currStock.DamageQuantity += detail.DamageQuantity; StockLogic.Update(currStock); } else // error { MessageBox.Show(" Không có mã vạch trong kho, đề nghị kiểm tra lại"); e.HasErrors = true; return; } } departmentStockOut.ConfirmFlg = 2; DepartmentStockOutLogic.Update(departmentStockOut); } MessageBox.Show(" Lưu thành công !"); e.HasErrors = false; }
void departmentStockOutReportView_ConfirmStockOutEvent(object sender, ReportStockOutEventArgs e) { IList list = e.ConfirmDepartmentStockOutList; StockOutMapper mapper = new StockOutMapper(); StockOutDetailMapper detailMapper = new StockOutDetailMapper(); DeptRetProdStockInMapper drpsiMapper = new DeptRetProdStockInMapper(); DeptRetProdStockInDetailMapper drpsiDetMapper = new DeptRetProdStockInDetailMapper(); foreach (DepartmentStockOut departmentStockOut in list) { StockOut stockOut = mapper.Convert(departmentStockOut); StockIn stockIn = drpsiMapper.Convert(departmentStockOut); stockIn.StockInDate = DateTime.Now; stockIn.StockInType = 3; // stock in for stock out to manufacturers stockIn.StockInDetails = new ArrayList(); stockOut.NotUpdateMainStock = true; stockOut.StockOutDate = DateTime.Now; IList detlist = new ArrayList(); foreach (DepartmentStockOutDetail detail in departmentStockOut.DepartmentStockOutDetails) { StockInDetail detailStockIn = drpsiDetMapper.Convert(detail); stockIn.StockInDetails.Add(detailStockIn); StockOutDetail detailStockOut = detailMapper.Convert(detail); detlist.Add(detailStockOut); } stockOut.StockOutDetails = detlist; StockInLogic.AddForStockOutToProducer(stockIn); StockOutLogic.Add(stockOut); departmentStockOut.ConfirmFlg = 2; departmentStockOut.StockOutDate = DateTime.Now; DepartmentStockOutLogic.Update(departmentStockOut); } MessageBox.Show(" Lưu thành công !"); e.HasErrors = false; }
private void DepartmentGoodsExportReportForm_Load(object sender, EventArgs e) { pSODetResultList = new DepartmentStockInResultDetailCollection(bdsStockOutResultPM); bdsStockOutResultPM.DataSource = pSODetResultList; pSODetList = new DepartmentStockInDetailCollection(bdsStockOutResultDetail); bdsStockOutResultDetail.DataSource = pSODetList; dgvStockProductsDetail.Columns[0].DefaultCellStyle.Format = "dd/MM/yyyy hh:mm:ss"; ReportStockOutEventArgs stockOutEventArgs = new ReportStockOutEventArgs(); EventUtility.fireEvent(LoadAllDeparmentEvent,this,stockOutEventArgs); BindingSource bdsDepartments = new BindingSource(); bdsDepartments.DataSource = stockOutEventArgs.DepartmentsList; cboDepartments.DataSource = bdsDepartments; cboDepartments.DisplayMember = "DepartmentName"; }
private void ok_Click(object sender, EventArgs e) { pSODetResultList.Clear(); ReportStockOutEventArgs eventArgs = new ReportStockOutEventArgs(); ReportDateStockOutParam dateStockInParam = new ReportDateStockOutParam(); dateStockInParam.FromDate = DateUtility.ZeroTime(dtpFrom.Value); dateStockInParam.ToDate = DateUtility.MaxTime(dtpTo.Value); eventArgs.ReportDateStockOutParam = dateStockInParam; if (cboDepartments != null) eventArgs.SelectDepartment = (Department)cboDepartments.SelectedItem; EventUtility.fireEvent(LoadStockOutByRangeEvent, this, eventArgs); // get result resultList = eventArgs.ResultStockOutList; System.Collections.IList stockDetailByPMList = eventArgs.ProductMastersInList; if (stockDetailByPMList.Count == 0) { MessageBox.Show("Không tìm thấy hàng nào", "Kết quả"); } foreach (var o in stockDetailByPMList) { System.Collections.IList stockDetailByPM = (IList)o; ProductMasterGlobal productMasterGlobal = new ProductMasterGlobal(); productMasterGlobal.ProductName = ((ProductMaster)stockDetailByPM[0]).ProductName; productMasterGlobal.ProductMaster = (ProductMaster)stockDetailByPM[0]; DepartmentStockInResultDetail stockInResultDetail = new DepartmentStockInResultDetail(); stockInResultDetail.ProductMasterGlobal = productMasterGlobal; stockInResultDetail.StockInQuantities = (long)stockDetailByPM[1]; stockInResultDetail.StockInTotalAmounts = (long)stockDetailByPM[2]; pSODetResultList.Add(stockInResultDetail); } bdsStockOutResultPM.EndEdit(); PopulateGrid(); }
void departmentStockOutReportView_DenyStockOutEvent(object sender, ReportStockOutEventArgs e) { IList list = e.DenyDepartmentStockOutList; StockOutMapper mapper = new StockOutMapper(); StockOutDetailMapper detailMapper = new StockOutDetailMapper(); DeptRetProdStockInMapper drpsiMapper = new DeptRetProdStockInMapper(); DeptRetProdStockInDetailMapper drpsiDetMapper = new DeptRetProdStockInDetailMapper(); foreach (DepartmentStockOut departmentStockOut in list) { // ++ Add code for add an empty stock in : 20090906 StockIn stockIn = drpsiMapper.Convert(departmentStockOut); stockIn.StockInDate = DateTime.Now; stockIn.StockInType = 0; // stock in for stock out to manufacturers stockIn.StockInDetails = new ArrayList(); stockIn.NotUpdateMainStock = true; foreach (DepartmentStockOutDetail detail in departmentStockOut.DepartmentStockOutDetails) { ObjectCriteria criteria = new ObjectCriteria(); criteria.AddEqCriteria("Product.ProductId", detail.Product.ProductId); IList productList = StockLogic.FindAll(criteria); if (productList != null) { Stock currStock = (Stock)productList[0]; currStock.GoodQuantity += detail.GoodQuantity; currStock.Quantity += detail.GoodQuantity; currStock.ErrorQuantity += detail.ErrorQuantity; currStock.Quantity += detail.ErrorQuantity; currStock.LostQuantity += detail.LostQuantity; currStock.LostQuantity += detail.LostQuantity; currStock.DamageQuantity += detail.DamageQuantity; currStock.DamageQuantity += detail.DamageQuantity; StockLogic.Update(currStock); StockInDetail detailStockIn = drpsiDetMapper.Convert(detail); stockIn.StockInDetails.Add(detailStockIn); } else // error { MessageBox.Show(" Không có mã vạch trong kho, đề nghị kiểm tra lại"); e.HasErrors = true; return; } } departmentStockOut.ConfirmFlg = 2; DepartmentStockOutLogic.Update(departmentStockOut); if(stockIn.StockInDetails.Count > 0 ) { StockInLogic.AddForStockOutToProducer(stockIn); } // -- Add code for add an empty stock in : 20090906 } MessageBox.Show(" Lưu thành công !"); e.HasErrors = false; }