Exemple #1
0
        private void PopulateHeaders()
        {
            Deployment.Current.Dispatcher.BeginInvoke(() =>
            {
                InvoiceBasicInfo invoiceHeaderDetails = (InvoiceBasicInfo)PhoneApplicationService.Current.State[SelectedInvoice];
                invoiceHeader.HeaderInfo = invoiceHeaderDetails;

                if (userdata.IsMultipleLineItemAdjust)
                {
                    lineitemNetAmount = adjustMultiple.NetAmount;

                    if (!adjustMultiple.PositiveAdjustment)
                    {
                        plusButton.IsEnabled = false;
                    }
                }
                else
                {
                    if (!invoiceHeaderDetails.Permissions.PositiveAdjustmentAllowed)
                    {
                        plusButton.IsEnabled = false;
                    }
                }

                netAmountLabel.Text = FormatAmount(lineitemNetAmount);
            });
        }
Exemple #2
0
 private void PopulateHeaders()
 {
     Deployment.Current.Dispatcher.BeginInvoke(() =>
     {
         InvoiceBasicInfo invoiceHeaderDetails = (InvoiceBasicInfo)PhoneApplicationService.Current.State[SelectedInvoice];
         invoiceHeader.HeaderInfo = invoiceHeaderDetails;
     });
 }
Exemple #3
0
        private void PrePopulate()
        {
            this.ProgressBar.Show();
            PageInProgress = true;
            InvoiceBasicInfo invoiceSummary = (InvoiceBasicInfo)PhoneApplicationService.Current.State[SelectedInvoice];

            currencyButton.Content = invoiceSummary.CurrencySymbol;
            PopulateHeaders();
            LoadReasons();
            ShowAdjustAppBar();
            this.ProgressBar.Hide();
            PageInProgress = false;
        }
        private void LoadTotalNetAmount()
        {
            InvoiceBasicInfo invoiceSummary = (InvoiceBasicInfo)PhoneApplicationService.Current.State[SelectedInvoice];

            rejectMultiple.InvoiceId           = invoiceSummary.InvoiceId;
            rejectMultiple.SelectedLineItemIds = new List <string>();
            for (int i = 0; i < lstLineItems.Count; i++)
            {
                rejectMultiple.SelectedLineItemIds.Add(lstLineItems[i].LineItemId);
            }
            string postData = JsonConvert.SerializeObject(rejectMultiple);

            try
            {
                ServiceInvoker.InvokeServiceUsingPost("/api/t360/LineItem/CalculateLineItemNetAmount", postData, false, delegate(object a, ServiceEventArgs serviceEventArgs)
                {
                    ServiceResponse result = serviceEventArgs.Result;
                    if (result.Status)
                    {
                        MultipleLineItemsInputDetails rejectMultipleitem = JsonConvert.DeserializeObject <MultipleLineItemsInputDetails>(result.Output);
                        rejectMultipleitem.InvoiceId           = rejectMultiple.InvoiceId;
                        rejectMultipleitem.SelectedLineItemIds = rejectMultiple.SelectedLineItemIds;
                        PopulateRejectionData(rejectMultipleitem);
                    }
                    else
                    {
                        List <Error> resultError = result.ErrorDetails;
                        ShowError(new AppException(resultError), LineItemReasonError);
                        if (resultError[0] != null && T360ErrorCodes.NotInReviewerQueue == resultError[0].Code)
                        {
                            Deployment.Current.Dispatcher.BeginInvoke(() =>
                            {
                                RedirectToInvoiceList();
                            });
                        }
                    }
                    PageInProgress = false;
                });
            }
            catch (Exception ex)
            {
                ShowError((AppException)ex);
            }
        }
Exemple #5
0
        private void PopulateHeaders()
        {
            Deployment.Current.Dispatcher.BeginInvoke(() =>
            {
                InvoiceBasicInfo invoiceHeaderDetails = (InvoiceBasicInfo)PhoneApplicationService.Current.State[SelectedInvoice];
                invoiceHeader.HeaderInfo = invoiceHeaderDetails;

                if (!invoiceHeaderDetails.Permissions.AdjustExpense)
                {
                    expenseButton.IsEnabled = false;
                }
                if (!invoiceHeaderDetails.Permissions.AdjustFee)
                {
                    feeButton.IsEnabled = false;
                }
                if (!invoiceHeaderDetails.Permissions.PositiveAdjustmentAllowed)
                {
                    plusButton.IsEnabled = false;
                }

                if (invoiceHeaderDetails.Permissions.AdjustExpense && !invoiceHeaderDetails.Permissions.AdjustFee)
                {
                    netAmountLabel.Text   = FormatAmount(invoiceHeaderDetails.BilledExpenses);
                    expenseButton.Opacity = 1;
                    expenseButton.Tag     = 1;
                }
                else if (!invoiceHeaderDetails.Permissions.AdjustExpense && invoiceHeaderDetails.Permissions.AdjustFee)
                {
                    netAmountLabel.Text = FormatAmount(invoiceHeaderDetails.BilledFees);
                    feeButton.Tag       = 1;
                }
                else
                {
                    netAmountLabel.Text = FormatAmount(invoiceHeaderDetails.BilledFees);
                    feeButton.Tag       = 1;
                }
            });
        }
Exemple #6
0
        private AdjustInputDetails GetData()
        {
            InvoiceBasicInfo invoiceSummary = (InvoiceBasicInfo)PhoneApplicationService.Current.State[SelectedInvoice];
            string           adjustmentType;

            if (IsPercentageSelected)
            {
                adjustmentType = "%";
            }
            else
            {
                adjustmentType = "$";
            }

            string adjustmentStyle;

            if (adjustByRadioButton.IsChecked == true)
            {
                adjustmentStyle = "Adjust By";
            }
            else
            {
                adjustmentStyle = "Adjust To";
            }

            string adjustmentMode = "";
            string strNetTotal    = lineitemNetAmount;

            if (strNetTotal.StartsWith("("))
            {
                strNetTotal = strNetTotal.Substring(1, strNetTotal.Length - 2);
            }
            if (strNetTotal.StartsWith("$") || strNetTotal.StartsWith("€"))
            {
                strNetTotal = strNetTotal.Substring(1, strNetTotal.Length - 1);
            }

            ReasonCode         reason;
            AdjustInputDetails adjustInputDetails = new AdjustInputDetails();

            string adjustAmount = string.IsNullOrWhiteSpace(adjustTextBox.Text) ? "0" : adjustTextBox.Text;

            adjustInputDetails.LineItemIds = new List <string>();
            if (userdata.IsMultipleLineItemAdjust)
            {
                adjustInputDetails.LineItemIds          = adjustMultiple.SelectedLineItemIds;
                adjustInputDetails.IsMultiSelectEnabled = true;
            }
            else
            {
                LineItemInputDetails selectedLineItem = new LineItemInputDetails((string)PhoneApplicationService.Current.State[SelectedInvoiceId], (string)PhoneApplicationService.Current.State[SelectedLineItemId]);
                adjustInputDetails.LineItemIds.Add(selectedLineItem.LineItemId);
                adjustInputDetails.IsMultiSelectEnabled = false;
            }
            adjustInputDetails.InvoiceId        = invoiceSummary.InvoiceId;
            adjustInputDetails.AdjustmentAmount = this.IsMinusSelected ? "-" + Convert.ToDouble(adjustAmount.Trim()).ToString(CultureInfo.InvariantCulture)
                                                       : Convert.ToDouble(adjustAmount.Trim()).ToString(CultureInfo.InvariantCulture);
            adjustInputDetails.AdjustmentMode  = adjustmentMode;
            adjustInputDetails.AdjustmentStyle = adjustmentStyle;
            adjustInputDetails.AdjustmentType  = adjustmentType;
            adjustInputDetails.NetTotal        = strNetTotal;
            adjustInputDetails.NarrativeText   = narrativeTextBox.Text.Trim();

            if (reasonListPicker.Items.Count == 0)
            {
                adjustInputDetails.ReasonId = string.Empty;
            }
            else
            {
                reason = reasonListPicker.SelectedItem as ReasonCode;
                adjustInputDetails.ReasonId = reason.Id.ToString();
            }

            return(adjustInputDetails);
        }
Exemple #7
0
        private void CalculateAdjustmentAmount()
        {
            try
            {
                NumberFormatInfo numberFormat     = NumberFormatInfo.CurrentInfo;
                string           decimalSeparator = numberFormat.CurrencyDecimalSeparator;
                string           groupSeparator   = numberFormat.CurrencyGroupSeparator;

                InvoiceBasicInfo invoiceSummary = (InvoiceBasicInfo)PhoneApplicationService.Current.State[SelectedInvoice];

                string strNetAmount = lineitemNetAmount;

                strNetAmount = FormatAmount(strNetAmount);
                if (strNetAmount.Contains(invoiceSummary.CurrencySymbol))
                {
                    strNetAmount = strNetAmount.Replace(invoiceSummary.CurrencySymbol, "").Trim();
                }

                double netAmount = Convert.ToDouble(strNetAmount);
                netAmountLabel.Text = invoiceSummary.CurrencySymbol + strNetAmount;

                if (String.IsNullOrEmpty(adjustTextBox.Text.Trim()))
                {
                    return;
                }

                string adjustAmount = adjustTextBox.Text.Replace(groupSeparator, "");

                if (IsPercentageSelected)
                {
                    if (Convert.ToDouble(adjustAmount) > 100)
                    {
                        adjustTextBox.Text = initialValue;
                        adjustAmount       = initialValue;
                    }
                }

                if (string.IsNullOrEmpty(initialValue))
                {
                    initialValue = adjustAmount;
                }

                if (adjustAmount.Contains(decimalSeparator))
                {
                    string[] tmpStrArr = adjustAmount.Split(decimalSeparator.ToCharArray());
                    if (tmpStrArr.Length < 2)
                    {
                        return;
                    }
                    if (!string.IsNullOrEmpty(tmpStrArr[1]) && tmpStrArr[1].Length > 2)
                    {
                        adjustAmount = String.Format("{0:n}", initialValue.Replace(groupSeparator, ""));
                    }
                    else if (tmpStrArr[0].Length > 12)
                    {
                        adjustAmount = initialValue;
                    }
                    else if (string.IsNullOrEmpty(tmpStrArr[0]))
                    {
                        adjustAmount = initialValue;
                    }

                    double amount       = Convert.ToDouble(adjustAmount);
                    int    decimalCount = tmpStrArr[1].Length > 2 ? 2 : tmpStrArr[1].Length;
                    adjustAmount = string.Format("{0:n" + decimalCount + "}", amount) +
                                   (adjustAmount.EndsWith(decimalSeparator) ? decimalSeparator : string.Empty);

                    if (!adjustAmount.Contains(decimalSeparator))
                    {
                        adjustTextBox.Text = initialValue;
                    }
                    else
                    {
                        adjustTextBox.Text = adjustAmount;
                    }
                }
                else
                {
                    if (adjustAmount.Length > 12)
                    {
                        adjustAmount = initialValue.Replace(groupSeparator, "");
                    }
                    double amount = Convert.ToDouble(adjustAmount);
                    adjustAmount       = amount.ToString();
                    adjustTextBox.Text = String.Format("{0:n0}", amount);
                }
                adjustTextBox.Select(adjustTextBox.Text.Length, adjustTextBox.Text.Length);

                if ((bool)adjustToRadioButton.IsChecked)
                {
                    return;
                }

                if (IsPercentageSelected)
                {
                    double percent = netAmount * Convert.ToDouble(adjustTextBox.Text.Trim()) / 100;
                    if (IsPlusSelected)
                    {
                        netAmount = netAmount + percent;
                    }
                    else
                    {
                        netAmount = netAmount - percent;
                    }
                }
                else
                {
                    if (IsPlusSelected)
                    {
                        netAmount = netAmount + Convert.ToDouble(adjustTextBox.Text.Trim());
                    }
                    else
                    {
                        netAmount = netAmount - Convert.ToDouble(adjustTextBox.Text.Trim());
                    }
                }
                netAmountLabel.Text = invoiceSummary.CurrencySymbol + String.Format("{0:n}", netAmount);
            }
            catch (Exception)
            {
            }
        }
Exemple #8
0
        private AdjustInputDetails GetData()
        {
            InvoiceBasicInfo invoiceSummary = (InvoiceBasicInfo)PhoneApplicationService.Current.State[SelectedInvoice];

            string adjustmentType;

            if (IsPercentageSelected)
            {
                adjustmentType = "%";
            }
            else
            {
                adjustmentType = "$";
            }

            string adjustmentStyle;

            if (adjustByRadioButton.IsChecked == true)
            {
                adjustmentStyle = "Adjust By";
            }
            else
            {
                adjustmentStyle = "Adjust To";
            }

            string adjustmentMode;

            if (IsFeeSelected)
            {
                adjustmentMode = "Fees";
            }
            else
            {
                adjustmentMode = "Expense";
            }

            string strNetTotal = IsFeeSelected ? invoiceSummary.BilledFees : invoiceSummary.BilledExpenses;

            if (strNetTotal.StartsWith("("))
            {
                strNetTotal = strNetTotal.Substring(1, strNetTotal.Length - 2);
            }
            if (strNetTotal.StartsWith("$") || strNetTotal.StartsWith("€"))
            {
                strNetTotal = strNetTotal.Substring(1, strNetTotal.Length - 1);
            }

            ReasonCode         reason;
            AdjustInputDetails adjustInputDetails;
            string             adjustAmount = string.IsNullOrWhiteSpace(adjustTextBox.Text) ? "0" : adjustTextBox.Text;

            if (reasonListPicker.Items.Count == 0)
            {
                adjustInputDetails = new AdjustInputDetails()
                {
                    InvoiceId        = invoiceSummary.InvoiceId,
                    ReasonId         = string.Empty,
                    AdjustmentAmount = this.IsMinusSelected ? "-" + Convert.ToDouble(adjustAmount.Trim()).ToString(CultureInfo.InvariantCulture)
                                                            : Convert.ToDouble(adjustAmount.Trim()).ToString(CultureInfo.InvariantCulture),
                    AdjustmentMode  = adjustmentMode,
                    AdjustmentStyle = adjustmentStyle,
                    AdjustmentType  = adjustmentType,
                    NetTotal        = strNetTotal,
                    NarrativeText   = narrativeTextBox.Text.Trim()
                };
            }
            else
            {
                reason             = reasonListPicker.SelectedItem as ReasonCode;
                adjustInputDetails = new AdjustInputDetails()
                {
                    InvoiceId        = invoiceSummary.InvoiceId,
                    ReasonId         = reason.Id.ToString(),
                    AdjustmentAmount = this.IsMinusSelected ? "-" + Convert.ToDouble(adjustAmount.Trim()).ToString(CultureInfo.InvariantCulture)
                                                            : Convert.ToDouble(adjustAmount.Trim()).ToString(CultureInfo.InvariantCulture),
                    AdjustmentMode  = adjustmentMode,
                    AdjustmentStyle = adjustmentStyle,
                    AdjustmentType  = adjustmentType,
                    NetTotal        = strNetTotal,
                    NarrativeText   = narrativeTextBox.Text.Trim()
                };
            }

            return(adjustInputDetails);
        }
        private void PopulateHeaders()
        {
            InvoiceBasicInfo invoiceHeaderDetails = (InvoiceBasicInfo)PhoneApplicationService.Current.State[SelectedInvoice];

            invoiceHeader.HeaderInfo = invoiceHeaderDetails;
        }
Exemple #10
0
        private RejectInput GetData()
        {
            ReasonCode         reason;
            InvoiceBasicInfo   invoiceSummary     = null;
            RejectInputDetails rejectInputDetails = new RejectInputDetails();

            if (PhoneApplicationService.Current.State.ContainsKey(SelectedInvoice))
            {
                invoiceSummary = (InvoiceBasicInfo)PhoneApplicationService.Current.State[SelectedInvoice];
            }
            string invoiceId = string.Empty;

            if (Source == Model.Base.Source.INVOICE_SINGLE_REJECT)
            {
                invoiceId = InvoiceDetails.InvoiceId.ToString();
            }

            if (Source == Model.Base.Source.LINE_ITEM_SINGLE_REJECT)
            {
                reason = reasonPicker.SelectedItem as ReasonCode;
                //LineItemInputDetails selectedLineItem = new LineItemInputDetails((string)PhoneApplicationService.Current.State[SelectedInvoiceId], (string)PhoneApplicationService.Current.State[SelectedLineItemId]);
                //invoiceSummary.LineItemId = selectedLineItem.LineItemId;
                rejectInputDetails.InvoiceId            = LineItemRejectDetails.InvoiceDetails.InvoiceId.ToString();
                rejectInputDetails.lstLineItemId        = new List <string>();
                rejectInputDetails.lstLineItemId        = LineItemRejectDetails.SelectedLineItemIds;
                rejectInputDetails.ReasonId             = reason.Id.ToString();
                rejectInputDetails.NarrativeText        = narrativeTextBox.Text.Trim();
                rejectInputDetails.IsMultiSelectEnabled = false;
            }
            else if (Source == Model.Base.Source.LINE_ITEM_MULTI_REJECT_CONFIRMATION)
            {
                reason = reasonPicker.SelectedItem as ReasonCode;
                rejectInputDetails.InvoiceId            = LineItemRejectDetails.InvoiceDetails.InvoiceId.ToString();
                rejectInputDetails.lstLineItemId        = new List <string>();
                rejectInputDetails.lstLineItemId        = LineItemRejectDetails.SelectedLineItemIds;
                rejectInputDetails.ReasonId             = reason.Id.ToString();
                rejectInputDetails.NarrativeText        = narrativeTextBox.Text.Trim();
                rejectInputDetails.IsMultiSelectEnabled = true;
            }
            else if (Source == Model.Base.Source.INVOICE_MULTI_REJECT_CONFIRMATION)
            {
                RejectInputMultipleInvoice rejectInputMultiInvoice;
                if (reasonPicker.Items.Count == 0)
                {
                    rejectInputMultiInvoice = new RejectInputMultipleInvoice()
                    {
                        SelectedInvoiceIds = InvoiceInputDetails.SelectedInvoiceIds, ReasonId = string.Empty, NarrativeText = narrativeTextBox.Text.Trim()
                    };
                }
                else
                {
                    reason = reasonPicker.SelectedItem as ReasonCode;
                    rejectInputMultiInvoice = new RejectInputMultipleInvoice()
                    {
                        SelectedInvoiceIds = InvoiceInputDetails.SelectedInvoiceIds, ReasonId = reason.Id.ToString(), NarrativeText = narrativeTextBox.Text.Trim()
                    };
                }
                return(rejectInputMultiInvoice);
            }
            else
            {
                if (reasonPicker.Items.Count == 0)
                {
                    rejectInputDetails = new RejectInputDetails()
                    {
                        InvoiceId = InvoiceDetails.InvoiceId.ToString(), ReasonId = string.Empty, NarrativeText = narrativeTextBox.Text.Trim()
                    };
                }
                else
                {
                    reason             = reasonPicker.SelectedItem as ReasonCode;
                    rejectInputDetails = new RejectInputDetails()
                    {
                        InvoiceId = InvoiceDetails.InvoiceId.ToString(), ReasonId = reason.Id.ToString(), NarrativeText = narrativeTextBox.Text.Trim()
                    };
                }
            }
            return(rejectInputDetails);
        }