Beispiel #1
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="sender"></param>
 private void CalculateTax(object sender)
 {
     double tax = 0;
     foreach (EDetails edetail in dgEstimate.ItemsSource)
     {
         if (((TextBlock)((DataGrid)sender).Columns[5].GetCellContent(edetail)) != null)
         {
             if (((TextBlock)((DataGrid)sender).Columns[5].GetCellContent(edetail)).Text != string.Empty)
                 if (edetail != null)
                     if (edetail.TaxRate != 0)
                         tax += float.Parse(((TextBlock)((DataGrid)sender).Columns[5].GetCellContent(edetail)).Text) * edetail.TaxRate / 100;
         }
         else if (edetail.Product != "")
         {
             tax += (edetail.Quantity * edetail.UCost) * edetail.TaxRate / 100;
         }
     }
     taxTotal = tax;
     txtTax.Text = tax.ToString("C");
 }
 /// <summary>
 /// 
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="ed"></param>
 private void CalculateTax(object sender)
 {
     float tax = 0;
     foreach (DBService.RDetails rdetail in dgRequisition.ItemsSource)
     {
         if (((TextBlock)((DataGrid)sender).Columns[4].GetCellContent(rdetail)) != null)
             if (((TextBlock)((DataGrid)sender).Columns[4].GetCellContent(rdetail)).Text != string.Empty)
                 if (rdetail != null)
                     if (rdetail.TaxRate != 0)
                         tax += long.Parse(((TextBlock)((DataGrid)sender).Columns[4].GetCellContent(rdetail)).Text) * rdetail.TaxRate / 100;
     }
     taxTotal = tax;
     txtTax.Text = taxTotal.ToString("C");
 }
Beispiel #3
0
        /// <summary>
        /// 
        /// </summary>
        private void InitForm()
        {

            if (opMod == (int)OperationMod.AddOnly)
            {
                ObservableCollection<EDetails> edetails = new ObservableCollection<EDetails>();
                for (int i = 0; i <= 14; i++)
                    edetails.Add(new DBService.EDetails());
                dgEstimate.ItemsSource = edetails;
                dtpCreateDate.Text = DateTime.Today.ToString("yyyy/MM/dd");
                new ComboSelectedValue(cboExpDate).SetValue("M_EXP_DATE");
                new ComboSelectedValue(cboPayCond).SetValue("M_PAY_COND");
                hasError = true;
                rbReCreate.Visibility = System.Windows.Visibility.Collapsed;
                rbUpdate.Visibility = System.Windows.Visibility.Collapsed;
                lblReCreate.Visibility = System.Windows.Visibility.Collapsed;
                lblUpdate.Visibility = System.Windows.Visibility.Collapsed;
                Grid.SetColumnSpan(txtMemo1, 8);
                SetContextMenu(false);
                ButtonHandle(FormState.InitState);
            }
            else if (opMod == (int)OperationMod.AddAndUpdate)
            {
                new ComboSelectedValue(cboExpDate, est.ExpDateCode).SetValue("M_EXP_DATE");
                new ComboSelectedValue(cboPayCond, est.PayCondCode).SetValue("M_PAY_COND");
                estCode = est.Code;
                dtpCreateDate.Text = est.CreationDate.ToString("yyyy/MM/dd");
                txtCustomer.Text = est.Customer_Nm;
                Common.customer = new DBService.Customer();
                Common.customer.Nm = est.Customer_Nm;
                Common.customer.Code = est.CustCode;
                txtTitle.Text = est.Title;
                foreach (int index in Enumerable.Range(est.EDetails.Count, 15 - est.EDetails.Count))
                    est.EDetails.Add(new DBService.EDetails());
                dgEstimate.ItemsSource = est.EDetails;
                txtMemo1.Text = est.Remarks1;                
                Grid.SetColumnSpan(txtMemo1, 1); 
                txtEstNo.Text = est.EstimateNo;
                if (est.FinishDate != null || !est.Old_Est_No.Trim().Equals(string.Empty))
                    rbReCreate.IsEnabled = false;
                else
                    rbReCreate.IsEnabled = true;
                hasError = false;
                rbReCreate.Visibility = System.Windows.Visibility.Visible;
                rbUpdate.Visibility = System.Windows.Visibility.Visible;
                lblReCreate.Visibility = System.Windows.Visibility.Visible;
                lblUpdate.Visibility = System.Windows.Visibility.Visible;
                SetContextMenu(true);
                ButtonHandle(FormState.EditState);                
            }
            else if (opMod == (int)OperationMod.ShinkiSakusei)
            {
                new ComboSelectedValue(cboExpDate, est.ExpDateCode).SetValue("M_EXP_DATE");
                new ComboSelectedValue(cboPayCond, est.PayCondCode).SetValue("M_PAY_COND");
                //estCode = est.Code;
                dtpCreateDate.Text = est.CreationDate.ToString("yyyy/MM/dd");
                txtCustomer.Text = est.Customer_Nm;
                Common.customer = new DBService.Customer();
                Common.customer.Nm = est.Customer_Nm;
                Common.customer.Code = est.CustCode;
                txtTitle.Text = est.Title;
                foreach (int index in Enumerable.Range(est.EDetails.Count, 15 - est.EDetails.Count))
                    est.EDetails.Add(new DBService.EDetails());
                dgEstimate.ItemsSource = est.EDetails;
                txtMemo1.Text = est.Remarks1;
                Grid.SetColumnSpan(txtMemo1, 1);
                //txtEstNo.Text = est.EstimateNo;
                //if (est.FinishDate != null || !est.Old_Est_No.Trim().Equals(string.Empty))
                //    rbReCreate.IsEnabled = false;
                //else
                //    rbReCreate.IsEnabled = true;
                hasError = false;
                rbReCreate.Visibility = System.Windows.Visibility.Visible;
                rbUpdate.Visibility = System.Windows.Visibility.Visible;
                lblReCreate.Visibility = System.Windows.Visibility.Visible;
                lblUpdate.Visibility = System.Windows.Visibility.Visible;
                //SetContextMenu(true);
                //ButtonHandle(FormState.EditState);
                Add();
            }
            tax = new Tax(dtpCreateDate.Text);
            
            isInitialised = true;            
            SetControlActive(true);
        }
 /// <summary>
 /// 
 /// </summary>
 private void InitForm()
 {
     if (opMod == (int)OperationMod.AddOnly)
     {
         ObservableCollection<DBService.RDetails> rdetails = new ObservableCollection<DBService.RDetails>();
         for (int i = 0; i <= 14; i++)
         {
             rdetails.Add(new RDetails());
         }
         dgRequisition.ItemsSource = rdetails;
         dtpCreateDate.Text = DateTime.Today.ToString("yyyy/MM/dd");
         dtpCreateDate.SelectedDateFormat = DatePickerFormat.Short;
         tax = new Tax(dtpCreateDate.Text);
         Grid.SetColumnSpan(txtMemo1, 3); 
         hasError = true;
         SetContextMenu(false);
         ButtonHandle(FormState.InitState);
     }
     else if (opMod == (int)OperationMod.AddAndUpdate)
     {
         reqCode = req.Code;
         dtpCreateDate.Text = req.CreationDate.ToString("yyyy/MM/dd");
         dtpCreateDate.SelectedDateFormat = DatePickerFormat.Short;
         Common.customer = new DBService.Customer();
         Common.customer.Nm = req.Customer_Nm;
         Common.customer.Code = req.CustCode;
         txtReqNo.Text = req.Req_No;
         txtTitle.Text = req.Title;
         txtMemo1.Text = req.Remarks1;
         Grid.SetColumnSpan(txtMemo1, 2); 
         txtCustomer.Text = req.Customer_Nm; 
         dgRequisition.ItemsSource = req.RDetails;
         foreach (int index in Enumerable.Range(req.RDetails.Count, 15 - req.RDetails.Count))
             req.RDetails.Add(new DBService.RDetails());
         hasError = false;
         SetContextMenu(true);
         ButtonHandle(FormState.EditState);
     }
     tax = new Tax(dtpCreateDate.Text);
     isInitialised = true;            
     SetControlActive(true);
 }