private void IssueToNextJob(JobOrder jOrder, ObservableCollection<JobOrderType> orderTypes)
 {
     if (jOrder != null && jOrder.ValidateIssueAndReceiptDetails())
     {
         IssueNextJob(jOrder, orderTypes);
     }
 }
 public IssueToPopupBox()
 {
     InitializeComponent();
     JobOrder = new JobOrder();
     this.JobOrder.RequiredDateWrapper = DateTime.Now;
     
 }
Esempio n. 3
0
 public bool SendForSpecialApproval(JobOrder jOrder)
 {
     bool res = false;
     jOrder.IsWaitingForApproval = true;
     res = Save();
     if (res)
         jOrder.Refresh();
     return res;
 }
 public IssueToPopupBox(JobOrder jOrder)
     : this()
 {
     JobOrder = jOrder;
     JobOrder.RequiredDateWrapper = DateTime.Now;
     materialName.Text = jOrder.GRNReciept.OrderedItem.ProductMaterialItem.SubMaterial.Name;
     quantity.Text = jOrder.JobQuantity.ToString();          
     issueToComboBox.SelectedItem = jOrder.JobOrderTypeWrapper;
     issueToComboBox.IsHitTestVisible = false;
     supplierComboBox.SelectedItem = jOrder.Supplier;
     supplierComboBox.IsHitTestVisible = false;
 }
        public KnittingJoViewModel(Order order, decimal quantity, GRNReciept reciept, bool jobOrderIssued, JobOrder parentJO)
        {
            this.Order = order;
            JO = new KnittingJO();
            JO.Order = order;
            JO.QuoteDate = order.OrderDate;
            JO.JoDate = DBResources.Instance.GetServerTime();
            JO.JobOrder = parentJO;
            JO.GRNReciept = reciept;

            JO.JoNoWrapper = "K" + (DBResources.Instance.Context.KnittingJOes.Count() + 1).ToString();
            JO.Add();
        }
        public DyeingJoViewModel(Order order, decimal quantity, PurchaseOrder po, string grnRefNo, GRNReciept reciept, bool jobOrderIssued, JobOrder parentJo)
        {
            this.Order = order;
            JO = new DyeingJO();
            JO.Order = order;
            JO.QuoteDate = order.OrderDate;
            JO.JODate = DBResources.Instance.GetServerTime();
            JO.PurchaseOrder = po;
            JO.GRNRefNo = grnRefNo;

            JO.GRNReciept = reciept;
            JO.JobOrder = parentJo;
            JO.JoNo = "D" + (DBResources.Instance.Context.DyeingJOes.Count() + 1).ToString();

            JO.Add();
        }
        public IssueToPopupBox(JobOrder jOrder, ObservableCollection<JobOrderType> nextJobTypes, string selectedJobType):this()
        {          
            JobOrder = jOrder;
            JobOrder.RequiredDateWrapper = DateTime.Now;
            materialName.Text = jOrder.GRNReciept.OrderedItem.ProductMaterialItem.SubMaterial.Name;
            quantity.Text = jOrder.JobQuantity.ToString();
            issueToComboBox.ItemsSource = nextJobTypes;

            foreach (var item in nextJobTypes)
            {
                if (item.Type == selectedJobType)
                {
                    issueToComboBox.SelectedItem = item;
                    jOrder.JobOrderType = item;
                    break;
                }
            }
        }
        private void CalculateActual(OrderedItem orderedItem, JobOrder Jo)
        {
            if (Jo != null)
            {
                //Job Order Charges
                PreviousActualInINR += Jo.GetCumulativeJOCharges();

                //GRN Reciept Value
                if (Jo.GRNReciept.OtherChargesInINR != null && Jo.GRNReciept.OtherChargesInINR.Value != 0 && Jo.GRNReciept.RecievedInHandWrapper != 0)
                {
                    decimal perUnitGRNRecieptValue = Jo.GRNReciept.OtherChargesInINR.Value / Jo.GRNReciept.RecievedInHandWrapper;
                    PreviousActualInINR += perUnitGRNRecieptValue;
                }

                //Purchase Order Value
                PreviousActualInINR += orderedItem.ActualInINR / orderedItem.OrderedQuantity;
            }
        }
Esempio n. 9
0
 public bool IssueNewJob(JobOrder jobOrder)
 {
     bool res = false;
     if (jobOrder != null)
     {
         if (jobOrder.JobOrderType.Type.ToLower() == "stock")
         {
             res=IssueToStock(jobOrder.JobQuantity);                    
         }
         else
         {
             jobOrder.GRNReciept.JobOrders.Add(jobOrder);
             res = Save();
         }               
         if (res)
             jobOrder.Refresh();
     }
     return res;
 }
Esempio n. 10
0
 private void IssueNextJob(JobOrder jOrder, ObservableCollection<JobOrderType> jobTypes)
 {
     JobOrder newJob = new JobOrder();
     newJob.JobQuantity = jOrder.QualityPassed.GetValueOrDefault(0);
     newJob.GRNReciept = jOrder.GRNReciept;
     IssueToPopupBox issuePopup = new IssueToPopupBox(newJob, jobTypes, string.Empty);
     if (issuePopup.ShowDialog() == true)
     {
         jOrder.IsIssued = true;
         if (issuePopup.JobOrder.JobOrderType.Type.ToLower() == "stock")
         {
             if (ViewModel.IssueToStock(issuePopup.JobOrder.JobQuantity))
                 jOrder.Refresh();
         }
         else
         {
             if (ViewModel.IssueNewJob(issuePopup.JobOrder))
                 jOrder.Refresh();
         }
     }
 }
Esempio n. 11
0
        private void CreateNewJobOrderForFailedQuantity(JobOrder jOrder)
        {
            if (jOrder != null && jOrder.ValidateIssueAndReceiptDetails())
            {
                JobOrder newJob = new JobOrder();
                newJob.GRNReciept = jOrder.GRNReciept;
                newJob.JobQuantity = jOrder.QualityFailed.GetValueOrDefault(0);
                newJob.JobOrderType = jOrder.JobOrderType;
                newJob.Supplier = jOrder.Supplier;
                newJob.Instructions = jOrder.Instructions;
                newJob.RequiredDate = jOrder.RequiredDate;
                newJob.ChargesInINR = jOrder.ChargesInINR;

                IssueToPopupBox issuePopup = new IssueToPopupBox(newJob);
                if (issuePopup.ShowDialog() == true)
                {
                    jOrder.FailedQuantityIssued = true;
                    if (ViewModel.IssueNewJob(issuePopup.JobOrder))
                        jOrder.Refresh();
                }
            }
        }   
        public bool IssueNewJob(JobOrder jobOrder)
        {
            bool res = false;
            if (jobOrder != null)
            {
                if (jobOrder.JobOrderType.Type.ToLower() == "stock")
                {
                    if (jobOrder.GRNReciept != null)
                    {
                        if (jobOrder.GRNReciept.OrderedItem.ProductMaterialItem.SubMaterial.InStock == null)
                            jobOrder.GRNReciept.OrderedItem.ProductMaterialItem.SubMaterial.InStock = 0;

                        MaterialStock stock = new MaterialStock();
                        stock.Order = this.Order;
                        stock.SubMaterial = jobOrder.GRNReciept.OrderedItem.ProductMaterialItem.SubMaterial;
                        stock.InStockDateTime = DBResources.Instance.GetServerTime();
                        stock.StockQuantity = jobOrder.JobQuantity;
                        stock.UnitsOfMeasurement = jobOrder.GRNReciept.OrderedItem.ProductMaterialItem.UnitsOfMeasurementWrapper;
                        jobOrder.GRNReciept.OrderedItem.ProductMaterialItem.SubMaterial.MaterialStocks.Add(stock);
                        jobOrder.GRNReciept.OrderedItem.ProductMaterialItem.SubMaterial.InStock += jobOrder.JobQuantity;
                    }
                    else
                        return false;
                }
                else
                {
                    jobOrder.GRNReciept.JobOrders.Add(jobOrder);
                }
                res = Save();
                if (res)
                    jobOrder.Refresh();
            }
            return res;
        }
 public void CreateNewJo(Order order,decimal quantity,GRNReciept reciept, bool jobOrderIssued, JobOrder parentJo)
 {
     ViewModel = new KnittingJoViewModel(order, quantity, reciept, jobOrderIssued, parentJo);
     //budgetVsActualControl.Initialize(reciept.OrderedItem, parentJo);
 }
 public void CreateNewJo(Order order, decimal quantity, PurchaseOrder po, string grnRefNo, GRNReciept receipt, bool jobOrderIssued, JobOrder parentJo)
 {
     ViewModel = new DyeingJoViewModel(order, quantity, po, grnRefNo, receipt, jobOrderIssued,parentJo);
     //budgetVsActualControl.Initialize(receipt.OrderedItem, parentJo);
 }
        public bool Approve()
        {
            try
            {
                StringBuilder comment = new StringBuilder();
                comment.AppendLine("Approved on " + DBResources.Instance.GetServerTime() + " by " + DBResources.Instance.CurrentUser.UserName);
                comment.Append(ViewModel.JO.Approval.Comments);

                ViewModel.JO.Approval.Comments = comment.ToString();
                ViewModel.JO.Approval.IsApproved = true;

                int itemNumber = 1;
                foreach (var item in ViewModel.JO.DyeingJoItems)
                {
                    JobOrder jo = new JobOrder();
                    jo.Company = ViewModel.JO.Company;
                    jo.GRNReciept = ViewModel.JO.GRNReciept;
                    jo.ChargesInINR = item.NetQtyWrapper * item.RatePerKgWrapper;
                    jo.RequiredDateWrapper = DateTime.Now;
                    jo.JobOrderTypeID  = 2;
                    jo.JobOrder2 = ViewModel.JO.JobOrder;
                    jo.Instructions = ViewModel.JO.TermsAndConditionsWrapper;
                    jo.JobQuantity = item.NetQtyWrapper;
                    jo.DyeingJoItems.Add(item);
                    item.JobOrder = jo;

                    itemNumber += 1;
                }

                DBResources.Instance.Save();

                ViewModel.JO.RefreshInfoJobOrderInfo();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
                return false;
            }

            return true;
        }
Esempio n. 16
0
 public void Initialize(OrderedItem orderedItem, JobOrder parentJO)
 {
     CalculateBudget(orderedItem);
     CalculateActual(orderedItem, parentJO);
 }
 public void CreateNewJo(Order order, decimal quantity, PurchaseOrder po, string grnRefNo, GRNReciept receipt, bool jobOrderIssued, JobOrder parentJo)
 {
     ViewModel = new CompactingJoViewModel(order, quantity, po, grnRefNo, receipt, jobOrderIssued, parentJo);
 }
Esempio n. 18
0
        void mItem_Click(object sender, RoutedEventArgs e)
        {
            MenuItem item = sender as MenuItem;
            JobOrder jOrder = jobOrderDetails.SelectedItem as JobOrder;

            switch (item.Header.ToString())
            {
                case "Knitting":
                    CreateJoWindow knittWindow = new CreateJoWindow();
                    knittWindow.Order = jOrder.GRNReciept.OrderedItem.PurchaseOrder.Order;
                    knittWindow.PurchaseOrder = jOrder.GRNReciept.OrderedItem.PurchaseOrder;
                    knittWindow.Quantity = jOrder.QualityPassed.Value;
                    knittWindow.GRNRefNo = jOrder.GRNReciept.GRNReciptID.ToString();
                    knittWindow.GRNReciept = jOrder.GRNReciept;
                    knittWindow.ParentJobOrder = jOrder;
                    jOrder.IsIssued = true;
                    knittWindow.InitializeForKnitting();
                    knittWindow.ShowDialog();
                    break;
                case "Dyeing":
                    CreateJoWindow dyeWindow = new CreateJoWindow();
                    dyeWindow.Order = jOrder.GRNReciept.OrderedItem.PurchaseOrder.Order;
                    dyeWindow.PurchaseOrder = jOrder.GRNReciept.OrderedItem.PurchaseOrder;
                    dyeWindow.ParentJobOrder = jOrder;
                    dyeWindow.Quantity = jOrder.QualityPassed.Value;
                    dyeWindow.GRNRefNo = jOrder.GRNReciept.GRNReciptID.ToString();
                    dyeWindow.GRNReciept = jOrder.GRNReciept;
                    jOrder.IsIssued = true;
                    dyeWindow.InitializeForDyeing();
                    dyeWindow.ShowDialog();
                    break;
                case "Compacting":
                    CreateJoWindow compactingWindow = new CreateJoWindow();
                    compactingWindow.Order = jOrder.GRNReciept.OrderedItem.PurchaseOrder.Order;
                    compactingWindow.PurchaseOrder = jOrder.GRNReciept.OrderedItem.PurchaseOrder;
                    compactingWindow.ParentJobOrder = jOrder;
                    compactingWindow.Quantity = jOrder.QualityPassed.Value;
                    compactingWindow.GRNRefNo = jOrder.GRNReciept.GRNReciptID.ToString();
                    compactingWindow.GRNReciept = jOrder.GRNReciept;
                    jOrder.IsIssued = true;
                    compactingWindow.InitializeForCompacting();
                    compactingWindow.ShowDialog();
                    break;
                case "Printing":
                case "Washing":
                case "Other":
                case "Stock":
                    JobOrder newJob = new JobOrder();
                    newJob.JobQuantity = jOrder.QualityPassed.GetValueOrDefault(0);
                    newJob.GRNReciept = jOrder.GRNReciept;
                    newJob.JobOrder2 = jOrder;
                    IssueToPopupBox issuePopup = new IssueToPopupBox(newJob, GetNextJobOrderTypes(jOrder), item.Header.ToString());
                    issuePopup.MaterialName = jOrder.RecievedAsWrapper;
                    if (issuePopup.ShowDialog() == true)
                    {
                        jOrder.IsIssued = true;
                        if (ViewModel.IssueNewJob(issuePopup.JobOrder))
                            jOrder.Refresh();
                    }
                    break;
            }

            jOrder.Refresh();
            jOrder.RefreshAllProperties();
        }
Esempio n. 19
0
        private ObservableCollection<JobOrderType> GetNextJobOrderTypes(JobOrder jOrder)
        {
            ObservableCollection<JobOrderType> nextTypes;
            switch (jOrder.JobOrderTypeID)
            {
                case 1:
                    nextTypes = DBResources.Instance.AfterKnittingJobs;
                    break;
                case 2:
                    nextTypes = DBResources.Instance.AfterDyeingJobs;
                    break;
                case 3:
                    nextTypes = DBResources.Instance.AfterPrintingJobs;
                    break;
                case 4:
                    nextTypes = DBResources.Instance.AfterCompactingJobs;
                    break;
                case 5:
                    nextTypes = DBResources.Instance.AfterWashingJobs;
                    break;
                case 6:
                    nextTypes = DBResources.Instance.AfterOtherJobs;
                    break;
                default:
                    return null;
            }

            return nextTypes;
        }
Esempio n. 20
0
 private void SpecialApproval(JobOrder jOrder)
 {
     if (jOrder != null && jOrder.ValidateIssueAndReceiptDetails())
     {
         ViewModel.SpecialApproval(jOrder);
     }
 }