private void Detail_BeforePrint(System.Object sender, System.Drawing.Printing.PrintEventArgs e) { m_CurrentProduction = DevExpress.Xpo.XpoDefault.Session.GetObjectByKey <Production>(Convert.ToInt32(GetCurrentColumnValue("ProductionID"))); ItemMachineStandards MachineStandard = null; if (m_CurrentProduction != null) { MachineStandard = m_CurrentProduction.ProdMainItemID.MachineStandards.Where((IMS) => IMS.Machine.MachineLineID == m_CurrentProduction.ProdMainMachineLine.MachineLineID).FirstOrDefault(); if (MachineStandard != null) { if (MachineStandard.MinutesPerShift > 0) { m_MinPerHour = Convert.ToInt32(MachineStandard.MinutesPerShift / 7.16667); } else if (m_CurrentProduction.ProdMainItemID.MinutesPerShift > 0) { m_MinPerHour = Convert.ToInt32(m_CurrentProduction.ProdMainItemID.MinutesPerShift / 7.1667); } else { m_MinPerHour = MainXtraForm.MinPerHOur; } if (MachineStandard.ProductionPerMinute > 0) { m_MachineStandard = MachineStandard.ProductionPerMinute; } else { m_MachineStandard = 0; } if (MachineStandard.ProjectedPackers > 0) { m_MachinePackers = MachineStandard.ProjectedPackers; } else { m_MachinePackers = 0; } } else { if (m_CurrentProduction.ProdMainItemID.MinutesPerShift > 0) { m_MinPerHour = Convert.ToInt32(m_CurrentProduction.ProdMainItemID.MinutesPerShift / 7.1667); } else { m_MinPerHour = MainXtraForm.MinPerHOur; } m_MachineStandard = 0; m_MachinePackers = 0; } } else { m_MinPerHour = MainXtraForm.MinPerHOur; m_MachineStandard = 0; m_MachinePackers = 0; } m_TimeDiffStartToStop = DateHelper.DateDiff(DateHelper.DateInterval.Minute, Convert.ToDateTime(GetCurrentColumnValue("TimeStart")), Convert.ToDateTime(GetCurrentColumnValue("TimeStop"))); m_BreakMinutes = BreakTimeBLL.GetBreakMinutes(Convert.ToDateTime(GetCurrentColumnValue("ProductionDate")), Convert.ToDateTime(GetCurrentColumnValue("TimeStart")), Convert.ToDateTime(GetCurrentColumnValue("TimeStop"))); m_IntervalHoursMinusBreak = (m_TimeDiffStartToStop - m_BreakMinutes) / 60.0; m_IntervalHours = m_TimeDiffStartToStop / 60.0; m_CurrentPayrollTotal = Convert.ToDouble(Convert.IsDBNull(GetCurrentColumnValue("ProductionPackers")) ? 0 : GetCurrentColumnValue("ProductionPackers")) * m_IntervalHoursMinusBreak * m_PackersPay; m_ShiftMinutes += Convert.ToInt32(m_IntervalHoursMinusBreak * m_MinPerHour); m_ShiftHours += m_IntervalHours; m_ShiftPayroll += m_CurrentPayrollTotal; if (Convert.ToDouble(GetCurrentColumnValue("ProjectedPackers")) > 0 || m_MachinePackers > 0) { m_CustomerPackersCost += Convert.ToDouble(Convert.IsDBNull(GetCurrentColumnValue("ProductionPackers")) ? 0 : GetCurrentColumnValue("ProductionPackers")) * m_IntervalHoursMinusBreak * m_PackersPay; m_CompanyPackersCost += Convert.ToDouble(Convert.IsDBNull(GetCurrentColumnValue("ProductionPackers")) ? 0 : GetCurrentColumnValue("ProductionPackers")) * m_IntervalHoursMinusBreak * m_PackersPay; } if (Convert.ToDouble(GetCurrentColumnValue("ProjectedPackers")) > 0 || m_MachinePackers > 0) { if (m_MachineStandard > 0) { m_CustomerCost += (Convert.ToDouble(Convert.IsDBNull(GetCurrentColumnValue("ProductionPackers")) ? 0 : GetCurrentColumnValue("ProductionPackers")) * m_IntervalHoursMinusBreak * m_PackersPay) / Convert.ToDouble(Convert.IsDBNull(GetCurrentColumnValue("Quantity")) ? 0 : GetCurrentColumnValue("Quantity")); m_CompanyCost += (Convert.ToDouble(Convert.IsDBNull(GetCurrentColumnValue("ProductionPackers")) ? 0 : GetCurrentColumnValue("ProductionPackers")) * m_IntervalHoursMinusBreak * m_PackersPay) / Convert.ToDouble(Convert.IsDBNull(GetCurrentColumnValue("Quantity")) ? 0 : GetCurrentColumnValue("Quantity")); if (m_MachinePackers == 0) { m_CustomerProjectedCost += (Convert.ToDouble(GetCurrentColumnValue("ProjectedPackers")) * m_IntervalHoursMinusBreak * m_PackersPay) / ((m_MachineStandard / Convert.ToDouble(GetCurrentColumnValue("QtyPerUnit"))) * Convert.ToInt32(m_IntervalHoursMinusBreak * m_MinPerHour)); m_CompanyProjectedCost += (Convert.ToDouble(GetCurrentColumnValue("ProjectedPackers")) * m_IntervalHoursMinusBreak * m_PackersPay) / ((m_MachineStandard / Convert.ToDouble(GetCurrentColumnValue("QtyPerUnit"))) * Convert.ToInt32(m_IntervalHoursMinusBreak * m_MinPerHour)); } else { m_CustomerProjectedCost += (m_MachinePackers * m_IntervalHoursMinusBreak * m_PackersPay) / ((m_MachineStandard / Convert.ToDouble(GetCurrentColumnValue("QtyPerUnit"))) * Convert.ToInt32(m_IntervalHoursMinusBreak * m_MinPerHour)); m_CompanyProjectedCost += (m_MachinePackers * m_IntervalHoursMinusBreak * m_PackersPay) / ((m_MachineStandard / Convert.ToDouble(GetCurrentColumnValue("QtyPerUnit"))) * Convert.ToInt32(m_IntervalHoursMinusBreak * m_MinPerHour)); } } else if (Convert.ToDouble(GetCurrentColumnValue("ProjectedSpeed")) > 0) { m_CustomerCost += (Convert.ToDouble(Convert.IsDBNull(GetCurrentColumnValue("ProductionPackers")) ? 0 : GetCurrentColumnValue("ProductionPackers")) * m_IntervalHoursMinusBreak * m_PackersPay) / Convert.ToDouble(Convert.IsDBNull(GetCurrentColumnValue("Quantity")) ? 0 : GetCurrentColumnValue("Quantity")); m_CompanyCost += (Convert.ToDouble(Convert.IsDBNull(GetCurrentColumnValue("ProductionPackers")) ? 0 : GetCurrentColumnValue("ProductionPackers")) * m_IntervalHoursMinusBreak * m_PackersPay) / Convert.ToDouble(Convert.IsDBNull(GetCurrentColumnValue("Quantity")) ? 0 : GetCurrentColumnValue("Quantity")); if (m_MachinePackers == 0) { m_CustomerProjectedCost += (Convert.ToDouble(GetCurrentColumnValue("ProjectedPackers")) * m_IntervalHoursMinusBreak * m_PackersPay) / ((Convert.ToDouble(GetCurrentColumnValue("ProjectedSpeed")) / Convert.ToDouble(GetCurrentColumnValue("QtyPerUnit"))) * Convert.ToInt32(m_IntervalHoursMinusBreak * m_MinPerHour)); m_CompanyProjectedCost += (Convert.ToDouble(GetCurrentColumnValue("ProjectedPackers")) * m_IntervalHoursMinusBreak * m_PackersPay) / ((Convert.ToDouble(GetCurrentColumnValue("ProjectedSpeed")) / Convert.ToDouble(GetCurrentColumnValue("QtyPerUnit"))) * Convert.ToInt32(m_IntervalHoursMinusBreak * m_MinPerHour)); } else { m_CustomerProjectedCost += (m_MachinePackers * m_IntervalHoursMinusBreak * m_PackersPay) / ((Convert.ToDouble(GetCurrentColumnValue("ProjectedSpeed")) / Convert.ToDouble(GetCurrentColumnValue("QtyPerUnit"))) * Convert.ToInt32(m_IntervalHoursMinusBreak * m_MinPerHour)); m_CompanyProjectedCost += (m_MachinePackers * m_IntervalHoursMinusBreak * m_PackersPay) / ((Convert.ToDouble(GetCurrentColumnValue("ProjectedSpeed")) / Convert.ToDouble(GetCurrentColumnValue("QtyPerUnit"))) * Convert.ToInt32(m_IntervalHoursMinusBreak * m_MinPerHour)); } } } }
private void totalHoursFooterXRLabel_SummaryRowChanged(System.Object sender, EventArgs e) { //This runs before Detail_BeforePrint m_Minutes += Convert.ToInt32(DateHelper.DateDiff(DateHelper.DateInterval.Minute, Convert.ToDateTime(GetCurrentColumnValue("ProdMainTimeStart")), Convert.ToDateTime(GetCurrentColumnValue("ProdMainTimeStop"))) - (BreakTimeBLL.GetBreakMinutes(Convert.ToDateTime(GetCurrentColumnValue("ProdMainDate")), Convert.ToDateTime(GetCurrentColumnValue("ProdMainTimeStart")), Convert.ToDateTime(GetCurrentColumnValue("ProdMainTimeStop"))))); }
private void productionGridView_CustomUnboundColumnData(System.Object sender, DevExpress.XtraGrid.Views.Base.CustomColumnDataEventArgs e) { if (Convert.IsDBNull(productionGridView.GetListSourceRowCellValue(e.ListSourceRowIndex, startGridColumn))) { return; } if (Convert.IsDBNull(productionGridView.GetListSourceRowCellValue(e.ListSourceRowIndex, stopGridColumn))) { return; } if (e.Column.Name == "timeGridColumn") { DateTime ProductionDay = Convert.ToDateTime(productionGridView.GetListSourceRowCellValue(e.ListSourceRowIndex, dateGridColumn)); DateTime startTime = Convert.ToDateTime(productionGridView.GetListSourceRowCellValue(e.ListSourceRowIndex, startGridColumn)); DateTime stopTime = Convert.ToDateTime(productionGridView.GetListSourceRowCellValue(e.ListSourceRowIndex, stopGridColumn)); //Make sure that the work dates are the same as the production date startTime = new DateTime(ProductionDay.Year, ProductionDay.Month, ProductionDay.Day, startTime.Hour, startTime.Minute, 0); stopTime = new DateTime(ProductionDay.Year, ProductionDay.Month, ProductionDay.Day, stopTime.Hour, stopTime.Minute, 0); if (DateHelper.DateDiff(DateHelper.DateInterval.Minute, startTime, stopTime) < 1) { stopTime = stopTime.AddDays(1); } long interval = DateHelper.DateDiff(DateHelper.DateInterval.Minute, startTime, stopTime) - BreakTimeBLL.GetBreakMinutes(ProductionDay, startTime, stopTime); e.Value = string.Format("{0}:{1}", interval / 60, (interval % 60) / 1); } else if (e.Column.Name == colReasons.Name) { e.Value = m_ProductionSession.GetObjectByKey <Production>(productionGridView.GetListSourceRowCellValue(e.ListSourceRowIndex, idGridColumn)).Reasons; } }
private void Detail_BeforePrint(System.Object sender, System.Drawing.Printing.PrintEventArgs e) { m_TimeDiffStartToStop = DateHelper.DateDiff(DateHelper.DateInterval.Minute, Convert.ToDateTime(GetCurrentColumnValue("ProdMainTimeStart")), Convert.ToDateTime(GetCurrentColumnValue("ProdMainTimeStop"))); m_BreakMinutes = BreakTimeBLL.GetBreakMinutes(Convert.ToDateTime(GetCurrentColumnValue("ProdMainDate")), Convert.ToDateTime(GetCurrentColumnValue("ProdMainTimeStart")), Convert.ToDateTime(GetCurrentColumnValue("ProdMainTimeStop"))); m_IntervalHours = m_TimeDiffStartToStop / 60.0; m_IntervalHoursMinusBreak = (m_TimeDiffStartToStop - m_BreakMinutes) / 60.0; m_CurrentPayrollTotal = Convert.ToDouble(Convert.IsDBNull(GetCurrentColumnValue("ProdMainOperators")) ? 0 : GetCurrentColumnValue("ProdMainOperators")) * m_IntervalHoursMinusBreak * m_OperatorsPay + Convert.ToDouble(Convert.IsDBNull(GetCurrentColumnValue("ProdMainPackers")) ? 0 : GetCurrentColumnValue("ProdMainPackers")) * m_IntervalHoursMinusBreak * m_PackersPay + Convert.ToDouble(Convert.IsDBNull(GetCurrentColumnValue("ProdMainSupers")) ? 0 : GetCurrentColumnValue("ProdMainSupers")) * m_IntervalHoursMinusBreak * m_SupersPay; m_CurrentCost = (m_CurrentPayrollTotal + Convert.ToDouble(GetCurrentColumnValue("Freight")) + Convert.ToDouble(GetCurrentColumnValue("Film")) + Convert.ToDouble(GetCurrentColumnValue("Boxes")) + Convert.ToDouble(GetCurrentColumnValue("StretchWrap")) + Convert.ToDouble(GetCurrentColumnValue("Pallets")) + Convert.ToDouble(GetCurrentColumnValue("Other1")) + Convert.ToDouble(GetCurrentColumnValue("Other2")) + Convert.ToDouble(GetCurrentColumnValue("Other3")) + Convert.ToDouble(GetCurrentColumnValue("Other4")) + Convert.ToDouble(GetCurrentColumnValue("Other5"))) * -1 + Convert.ToDouble(GetCurrentColumnValue("Rebate")); m_CurrentQuantity = Convert.ToDouble(GetCurrentColumnValue("ProdMainQuantity")); m_CurrentTotalPrice = Convert.ToDouble(GetCurrentColumnValue("TotalPrice")); m_TotalPriceTotal += m_CurrentTotalPrice; m_CurrentProduction = DevExpress.Xpo.XpoDefault.Session.GetObjectByKey <Production>(Convert.ToInt32(GetCurrentColumnValue("ProdMainID"))); ItemMachineStandards MachineStandard = null; if (m_CurrentProduction != null) { MachineStandard = m_CurrentProduction.ProdMainItemID.MachineStandards.Where((IMS) => IMS.Machine.MachineLineID == m_CurrentProduction.ProdMainMachineLine.MachineLineID).FirstOrDefault(); if (MachineStandard != null) { if (MachineStandard.MinutesPerShift > 0) { m_MinPerHour = Convert.ToInt32(MachineStandard.MinutesPerShift / 7.16667); } else if (m_CurrentProduction.ProdMainItemID.MinutesPerShift > 0) { m_MinPerHour = Convert.ToInt32(m_CurrentProduction.ProdMainItemID.MinutesPerShift / 7.1667); } else { m_MinPerHour = MainXtraForm.MinPerHOur; } if (MachineStandard.ProductionPerMinute > 0) { m_MachineStandard = MachineStandard.ProductionPerMinute; } else { m_MachineStandard = 0; } if (MachineStandard.ProjectedPackers > 0) { m_MachinePackers = MachineStandard.ProjectedPackers; } else { m_MachinePackers = 0; } } else { if (m_CurrentProduction.ProdMainItemID.MinutesPerShift > 0) { m_MinPerHour = Convert.ToInt32(m_CurrentProduction.ProdMainItemID.MinutesPerShift / 7.1667); } else { m_MinPerHour = MainXtraForm.MinPerHOur; } m_MachineStandard = 0; m_MachinePackers = 0; } } else { m_MinPerHour = MainXtraForm.MinPerHOur; m_MachineStandard = 0; m_MachinePackers = 0; } }
private void Detail_BeforePrint(System.Object sender, System.Drawing.Printing.PrintEventArgs e) { m_Minutes = DateHelper.DateDiff(DateHelper.DateInterval.Minute, Convert.ToDateTime(GetCurrentColumnValue("ProdMainTimeStart")), Convert.ToDateTime(GetCurrentColumnValue("ProdMainTimeStop"))); m_BreakMinutes = BreakTimeBLL.GetBreakMinutes(Convert.ToDateTime(GetCurrentColumnValue("ProdMainDate")), Convert.ToDateTime(GetCurrentColumnValue("ProdMainTimeStart")), Convert.ToDateTime(GetCurrentColumnValue("ProdMainTimeStop"))); m_TotalMinutes += m_Minutes - m_BreakMinutes; m_CurrentProduction = DevExpress.Xpo.XpoDefault.Session.GetObjectByKey <Production>(Convert.ToInt32(GetCurrentColumnValue("ProdMainID"))); ItemMachineStandards MachineStandard = null; if (m_CurrentProduction != null) { MachineStandard = m_CurrentProduction.ProdMainItemID.MachineStandards.Where((IMS) => IMS.Machine.MachineLineID == m_CurrentProduction.ProdMainMachineLine.MachineLineID).FirstOrDefault(); if (MachineStandard != null) { if (MachineStandard.MinutesPerShift > 0) { m_MinPerHour = Convert.ToInt32(MachineStandard.MinutesPerShift / 7.16667); } else if (m_CurrentProduction.ProdMainItemID.MinutesPerShift > 0) { m_MinPerHour = Convert.ToInt32(m_CurrentProduction.ProdMainItemID.MinutesPerShift / 7.1667); } else { m_MinPerHour = MainXtraForm.MinPerHOur; } if (MachineStandard.ProductionPerMinute > 0) { m_MachineStandard = MachineStandard.ProductionPerMinute; } else { m_MachineStandard = 0; } if (MachineStandard.ProjectedPackers > 0) { m_MachinePackers = MachineStandard.ProjectedPackers; } else { m_MachinePackers = 0; } } else { if (m_CurrentProduction.ProdMainItemID.MinutesPerShift > 0) { m_MinPerHour = Convert.ToInt32(m_CurrentProduction.ProdMainItemID.MinutesPerShift / 7.1667); } else { m_MinPerHour = MainXtraForm.MinPerHOur; } m_MachineStandard = 0; m_MachinePackers = 0; } } else { m_MinPerHour = MainXtraForm.MinPerHOur; m_MachineStandard = 0; m_MachinePackers = 0; } }