Esempio n. 1
0
        private int CreateNewProject()
        {
            //Insert New Record
            var job = new Sales_JobMasterList();

            job.jobNumber      = "ToBeAssigned";
            job.sales          = _ep.Kam;
            job.sa1ID          = Convert.ToInt32(EmployeeEN.NEmployeeIDDefault.NullSales110);
            job.startTimeStamp = DateTime.Now;
            job.JobStatus      = Convert.ToInt16(NJobStatus.ProjectNew);
            job.subProject     = 0;
            job.yearNumber     = Convert.ToInt16(System.DateTime.Today.Year - 2000);
            job.jobTitle       = "From Lead -" + _ep.CustomString1;
            job.StatusChanged  = true;
            job.ProductLine    = 1;                 // Convert.ToInt32(CommissionEN.ProductLine.Signage);
            job.Rush           = true;
            job.Customer       = _ep.CustomerID;
            job.LeadID         = _ep.CustomInt2;
            job.targetDate     = DateTime.Today.AddMonths(1);

            _dbProject.Sales_JobMasterList.Add(job);
            _dbProject.SaveChanges();

            //Job Number
            job.jobNumber = GetJobNumber(job.jobID);

            return(job.jobID);
        }
 public MyWorkorderValidationContractAmount(int woID)
 {
     _woID         = woID;
     _value        = _db.Sales_JobMasterList_WO.Find(_woID);
     _project      = _db.Sales_JobMasterList.Find(_value.jobID);
     _isSubProject = _project.subProject != 0;
 }
        private bool IsWorkorderAmountExceedContractAmountSubProject()
        {
            if (!_isSubProject)
            {
                return(false);                //NA
            }
            double contractAmount = 0;


            //Check if the main project has contract
            Sales_JobMasterList mainProject =
                _db.Sales_JobMasterList.First(x => x.jobNumber == _project.jobTitle && x.subProject == 0);

            if (mainProject != null)
            {
                List <Sales_JobMasterList_QuoteRev> mainContracts = _db.Sales_JobMasterList_QuoteRev.Where(
                    x => x.jobID == mainProject.jobID && x.contractAmount > 0 & x.quoteStatus == 420).ToList();
                if (mainContracts.Any())
                {
                    foreach (Sales_JobMasterList_QuoteRev mainContract in mainContracts)
                    {
                        MyConvert.ConvertToDouble(mainContract.contractAmount);
                    }
                }
            }
            return(false);
        }
        //Master Project Has to be WIN
        private bool GetIsThereContract()
        {
            //Is there are Contract
            List <Sales_JobMasterList_QuoteRev> contracts =
                _db.Sales_JobMasterList_QuoteRev.Where(
                    x => x.jobID == _project.jobID && x.contractAmount > 0 && x.quoteStatus == 420).ToList();

            if (contracts.Any())
            {
                return(true);
            }

            if (_project.subProject == 0)
            {
                return(false);
            }
            //Check if the main project has contract
            Sales_JobMasterList mainProject =
                _db.Sales_JobMasterList.First(x => x.jobNumber == _project.jobTitle && x.subProject == 0);

            if (mainProject == null)
            {
                return(false);
            }
            List <Sales_JobMasterList_QuoteRev> mainContracts =
                _db.Sales_JobMasterList_QuoteRev.Where(
                    x => x.jobID == mainProject.jobID && x.contractAmount > 0 & x.quoteStatus == 420).ToList();

            return(mainContracts.Any());
        }
Esempio n. 5
0
        private int GetMyMainProjectID()
        {
            string projectName = Value.jobNumber;
            Sales_JobMasterList mainProject =
                _db.Sales_JobMasterList.First(x => x.jobNumber == projectName && x.subProject == 0);

            return(mainProject.jobID);
        }
Esempio n. 6
0
        public void UpdateCommission(Sales_JobMasterList commissionFactor)
        {
            Value.SalesType   = commissionFactor.SalesType;
            Value.ProductLine = commissionFactor.ProductLine;

            Value.IsPaidPremiu        = commissionFactor.IsPaidPremiu;
            Value.isBidToProject      = commissionFactor.isBidToProject;
            Value.IsGivenByOldPartner = commissionFactor.IsGivenByOldPartner;
            Value.OverLimitRate       = commissionFactor.OverLimitRate;
            Value.CommissionGivenBy   = commissionFactor.CommissionGivenBy;

            _db.Entry(Value).State = EntityState.Modified;
            _db.SaveChanges();
        }
Esempio n. 7
0
        public void GenerateMySelfSerialID()
        {
            Sales_JobMasterList_Invoice invoice = _db.Sales_JobMasterList_Invoice.Find(_invoiceID);
            int jobID = invoice.jobID;
            Sales_JobMasterList project = _db.Sales_JobMasterList.Find(jobID);
            int lastItemID = project.LastInvoiceItemID;

            project.LastInvoiceItemID = lastItemID + 1;
            _db.Entry(project).State  = EntityState.Modified;

            Invoice_Item item = _db.Invoice_Item.Find(_itemID);

            item.SerialID         = "I" + (lastItemID + 1).ToString("D2");
            _db.Entry(item).State = EntityState.Modified;

            _db.SaveChanges();
        }
Esempio n. 8
0
        public void GenerateMySelfSerialID()
        {
            Sales_JobMasterList_WO wo = _db.Sales_JobMasterList_WO.Find(_woID);
            int jobID = wo.jobID;
            Sales_JobMasterList project = _db.Sales_JobMasterList.Find(jobID);
            int lastItemID = project.LastWorkorderItemID;

            project.LastWorkorderItemID = lastItemID + 1;
            _db.Entry(project).State    = EntityState.Modified;

            WO_Item item = _db.WO_Item.Find(_itemID);

            item.SerialID         = "W" + (lastItemID + 1).ToString("D2");
            _db.Entry(item).State = EntityState.Modified;

            _db.SaveChanges();
        }
Esempio n. 9
0
        public void GenerateMySelfSerialID()
        {
            if (_quoteItemID == 0)
            {
                return;
            }

            Sales_JobMasterList_QuoteRev quote = _db.Sales_JobMasterList_QuoteRev.Find(_quoteRevID);
            int jobID = quote.jobID;
            Sales_JobMasterList project = _db.Sales_JobMasterList.Find(jobID);
            int lastItemID = project.LastQuoteItemID;

            project.LastQuoteItemID  = lastItemID + 1;
            _db.Entry(project).State = EntityState.Modified;

            Quote_Item item = _db.Quote_Item.Find(_quoteItemID);

            item.SerialID         = "Q" + (lastItemID + 1).ToString("D2");
            _db.Entry(item).State = EntityState.Modified;

            _db.SaveChanges();
        }
Esempio n. 10
0
 public MyProjectBiddingCreate(int salesID, int projectID)
 {
     _salesID = salesID;
     _project = _db.Sales_JobMasterList.Find(projectID);
 }