protected void uiLinkButtonDeliveryOrderTotals_Click(object sender, EventArgs e)
        {
            uiReportViewerMain.Reset();
            uiReportViewerMain.LocalReport.ReportPath = BaseReportPath + "Report_GetDeliveryOrdersDetailsTotals.rdlc";
            IStock.BLL.DeliveryOrder DeliveryOrder = new IStock.BLL.DeliveryOrder();

            DeliveryOrder.Report_GetDeliveryOrdersDetailsTotals(uiTextBoxOrderFrom.Text, uiTextBoxOrderTo.Text);

            uiReportViewerMain.LocalReport.DataSources.Clear();
            uiReportViewerMain.LocalReport.DataSources.Add(new ReportDataSource("Report_GetDeliveryOrdersDetailsTotalsDataSet", DeliveryOrder.DefaultView));
            uiReportViewerMain.LocalReport.SetParameters(new ReportParameter("DeliveryOrderNoFrom", uiTextBoxFrom.Text));
            uiReportViewerMain.LocalReport.SetParameters(new ReportParameter("DeliveryOrderNoTo", uiTextBoxTo.Text));
            uiReportViewerMain.LocalReport.Refresh();
        }
        protected void uiLinkButtonDeliveryOrdersPeriod_Click(object sender, EventArgs e)
        {
            uiReportViewerMain.Reset();
            uiReportViewerMain.LocalReport.ReportPath = BaseReportPath + "Report_GetDeliveryOrdersDetailsTotalsWithinPeriod.rdlc";
            IStock.BLL.DeliveryOrder DeliveryOrder = new IStock.BLL.DeliveryOrder();

            DateTime? From = null, To = null;
            if (!string.IsNullOrEmpty(uiTextBoxFrom.Text))
                From = DateTime.ParseExact(uiTextBoxFrom.Text, "dd/MM/yyyy", null);
            if (!string.IsNullOrEmpty(uiTextBoxTo.Text))
                To = DateTime.ParseExact(uiTextBoxTo.Text, "dd/MM/yyyy", null);

            DeliveryOrder.Report_GetDeliveryOrdersDetailsTotalsWithinPeriod(From, To);

            uiReportViewerMain.LocalReport.DataSources.Clear();
            uiReportViewerMain.LocalReport.DataSources.Add(new ReportDataSource("Report_GetDeliveryOrdersDetailsTotalsWithinPeriodDataSet", DeliveryOrder.DefaultView));
            uiReportViewerMain.LocalReport.SetParameters(new ReportParameter("From", uiTextBoxFrom.Text));
            uiReportViewerMain.LocalReport.SetParameters(new ReportParameter("To", uiTextBoxTo.Text));
            uiReportViewerMain.LocalReport.Refresh();
        }
Пример #3
0
 protected void uiLinkButtonCalculate_Click(object sender, EventArgs e)
 {
     IStock.BLL.DeliveryOrder obj = new IStock.BLL.DeliveryOrder();
     uiGridViewOrders.DataSource = obj.GetDeliveryOrdersDetailsTotals(uiTextBoxFrom.Text, uiTextBoxTo.Text);
     uiGridViewOrders.DataBind();
 }
Пример #4
0
 private void BindOrders()
 {
     IStock.BLL.DeliveryOrder Orders = new IStock.BLL.DeliveryOrder();
     Orders.GetAllDeliveryOrders();
     uiGridViewOrders.DataSource = Orders.DefaultView;
     uiGridViewOrders.DataBind();
 }
Пример #5
0
        protected void uiLinkButtonOK_Click(object sender, EventArgs e)
        {
            IStock.BLL.DeliveryOrder order = new IStock.BLL.DeliveryOrder();
            if (CurrentDeliveryOrder == null)
                order.AddNew();
            else
                order = CurrentDeliveryOrder;

            order.DeliveryOrderNo = uiTextBoxCode.Text;
            order.ClientID = Convert.ToInt32(uiDropDownListClients.SelectedValue);
            order.DeliveryOrderDate = DateTime.ParseExact(uiTextBoxDate.Text, "dd/MM/yyyy", null);
            order.EmployeeID = Convert.ToInt32(uiDropDownListEmployee.SelectedValue);
            if (!string.IsNullOrEmpty(uiTextBoxDiscount.Text))
                order.Discount = decimal.Parse(uiTextBoxDiscount.Text);
            else
                order.Discount = 0;
            order.Save();

            IStock.BLL.ClientReturns clientReturn = new IStock.BLL.ClientReturns();
            clientReturn.GetLastClientReturnForDeliveryOrder(order.ClientID);
            if (clientReturn.RowCount > 0)
            {
                clientReturn.DeliveryOrderID = order.DeliveryOrderID;
                clientReturn.Save();
            }

            //ClearFields();
            CurrentDeliveryOrder = order;
            uiPanelEditDeliveryOrder.Visible = true;
            uiPanelAllOrders.Visible = false;
            uiPanelItems.Visible = true;
            //EnableDisableActions();
            BindItems();
        }
Пример #6
0
 protected void uiLinkButtonCancel_Click(object sender, EventArgs e)
 {
     ClearFields();
     CurrentDeliveryOrder = null;
     uiPanelEditDeliveryOrder.Visible = false;
     uiPanelAllOrders.Visible = true;
     uiPanelItems.Visible = false;
 }
Пример #7
0
 protected void uiLinkButtonAdd_Click(object sender, EventArgs e)
 {
     ClearFields();
     CurrentDeliveryOrder = null;
     uipanelError.Visible = false;
     uiPanelEditDeliveryOrder.Visible = true;
     IStock.BLL.DeliveryOrder d = new IStock.BLL.DeliveryOrder();
     uiTextBoxCode.Text = d.getNewSerial();
     uiPanelAllOrders.Visible = false;
 }
Пример #8
0
        protected void uiGridViewOrders_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            if (e.CommandName == "EditOrder")
            {
                IStock.BLL.DeliveryOrder objData = new IStock.BLL.DeliveryOrder();
                objData.LoadByPrimaryKey(Convert.ToInt32(e.CommandArgument.ToString()));

                uiTextBoxCode.Text = objData.DeliveryOrderNo;
                uiTextBoxDate.Text = objData.DeliveryOrderDate.ToString("dd/MM/yyy");
                uiDropDownListClients.SelectedValue = objData.ClientID.ToString();
                uiDropDownListEmployee.SelectedValue = objData.EmployeeID.ToString();
                if(!objData.IsColumnNull("Discount"))
                    uiTextBoxDiscount.Text = objData.Discount.ToString();
                uiPanelAllOrders.Visible = false;
                uiPanelEditDeliveryOrder.Visible = true;
                uiPanelItems.Visible = true;
                CurrentDeliveryOrder = objData;
                //EnableDisableActions();
                BindItems();
            }
            else if (e.CommandName == "DeleteOrder")
            {
                try
                {
                    IStock.BLL.DeliveryOrder objData = new IStock.BLL.DeliveryOrder();
                    objData.LoadByPrimaryKey(Convert.ToInt32(e.CommandArgument.ToString()));

                    IStock.BLL.DeliveryOrderDetails details = new IStock.BLL.DeliveryOrderDetails();
                    details.GetDeliveryOrderDetails(objData.DeliveryOrderID);

                    decimal total = objData.GetDeliveryOrderTotals(objData.DeliveryOrderID);

                    /* restore items to stock */
                    for (int i = 0; i < details.RowCount; i++)
                    {
                        IStock.BLL.Items item = new IStock.BLL.Items();
                        item.LoadByPrimaryKey(details.ItemID);
                        item.Quantity += details.Quantity;
                        details.MoveNext();
                        item.Save();
                    }
                    /* restore items to stock */

                    details.MarkAsDeleted();
                    details.Save();

                    /* update client credit */
                    IStock.BLL.Clients client = new IStock.BLL.Clients();
                    client.LoadByPrimaryKey(objData.ClientID);
                    client.StartCredit -= total;
                    client.Save();
                    /* update client credit */

                    IStock.BLL.ClientReturns cr = new IStock.BLL.ClientReturns ();
                    cr.GetClientReturnByDeliveryOrderID(objData.DeliveryOrderID);
                    if (cr.RowCount > 0)
                    {
                        cr.SetColumnNull("DeliveryOrderID");
                        cr.Save();
                    }

                    objData.MarkAsDeleted();
                    objData.Save();

                    CurrentDeliveryOrder = null;
                    BindOrders();
                }
                catch (Exception ex)
                {
                    uipanelError.Visible = true;
                }
            }
        }