Exemplo n.º 1
0
        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;
            }
        }
Exemplo n.º 2
0
        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));
                    }
                }
            }
        }
Exemplo n.º 3
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;
            }
        }