Ejemplo n.º 1
0
        public virtual int?GetDefaultLaborItem(int?employeeID, string earningType, int?projectID)
        {
            if (employeeID == null)
            {
                return(null);
            }

            int?result = null;

            if (ProjectDefaultAttribute.IsProject(this, projectID))
            {
                result = EPContractRate.GetProjectLaborClassID(this, projectID.Value, employeeID.Value, earningType);
            }

            if (result == null)
            {
                result = EPEmployeeClassLaborMatrix.GetLaborClassID(this, employeeID, earningType);
            }

            if (result == null)
            {
                EPEmployee employee = PXSelect <EPEmployee, Where <EPEmployee.bAccountID, Equal <Current <EPTimeCard.employeeID> > > > .Select(this);

                if (employee != null)
                {
                    result = employee.LabourItemID;
                }
            }

            return(result);
        }
Ejemplo n.º 2
0
        public virtual int?GetLaborClass(PMTimeActivity activity, EPEmployee employee, CRCase refCase)
        {
            if (employee == null)
            {
                throw new ArgumentNullException("employee", Messages.EmptyEmployeeID);
            }

            int?laborClassID = null;

            if (refCase != null)
            {
                CRCaseClass caseClass = (CRCaseClass)PXSelectorAttribute.Select <CRCase.caseClassID>(graph.Caches[typeof(CRCase)], refCase);
                if (caseClass.PerItemBilling == BillingTypeListAttribute.PerActivity)
                {
                    laborClassID = CRCaseClassLaborMatrix.GetLaborClassID(graph, caseClass.CaseClassID, activity.EarningTypeID);
                }
            }

            if (laborClassID == null && activity.ProjectID != null && employee.BAccountID != null)
            {
                laborClassID = EPContractRate.GetProjectLaborClassID(graph, (int)activity.ProjectID, (int)employee.BAccountID, activity.EarningTypeID);
            }

            if (laborClassID == null)
            {
                laborClassID = EPEmployeeClassLaborMatrix.GetLaborClassID(graph, employee.BAccountID, activity.EarningTypeID);
            }

            if (laborClassID == null)
            {
                laborClassID = employee.LabourItemID;
            }

            return(laborClassID);
        }
Ejemplo n.º 3
0
        public virtual int?GetLaborClass(CR.EPActivity activity)
        {
            int?laborClassID = null;

            CR.CRCase refCase = PXSelect <CR.CRCase, Where <CR.CRCase.noteID, Equal <Required <CR.EPActivity.refNoteID> > > > .Select(graph, activity.RefNoteID);

            if (refCase != null)
            {
                CR.CRCaseClass caseClass = (CR.CRCaseClass)PXSelectorAttribute.Select <CR.CRCase.caseClassID>(graph.Caches[typeof(CR.CRCase)], refCase);
                laborClassID = CR.CRCaseClassLaborMatrix.GetLaborClassID(graph, caseClass.CaseClassID, activity.EarningTypeID);
            }

            EPEmployee employee = PXSelect <EPEmployee> .Search <EPEmployee.userID>(graph, activity.Owner);

            if (employee == null)
            {
                throw new Exception(Messages.EmptyEmployeeID);
            }

            if (laborClassID == null && activity.ProjectID != null && employee.BAccountID != null)
            {
                laborClassID = EPContractRate.GetProjectLaborClassID(graph, (int)activity.ProjectID, (int)employee.BAccountID, activity.EarningTypeID);
            }

            if (laborClassID == null)
            {
                laborClassID = EPEmployeeClassLaborMatrix.GetLaborClassID(graph, employee.BAccountID, activity.EarningTypeID);
            }

            if (laborClassID == null)
            {
                laborClassID = employee.LabourItemID;
            }

            return(laborClassID);
        }