Ejemplo n.º 1
0
        private void FrmCotizationCreate_Load(object sender, EventArgs e)
        {
            //Estado de los controles del formulario
            txtServiceCode.Focus();
            //Consultamos la orden requerida. pruebas con RL-15
            string order_number = Order.Order_number_st;

            order                   = orderLog.Read_once(order_number);
            txtOrder.Text           = order.Order_number;
            dtpReception_date.Value = order.Order_reception_date;
            txtOrderType.Text       = order.Order_type;
            txtOrderState.Text      = order.Order_state;
            //Agregamos el objeto Technician
            txtTechnicianName.Text      = order.Technician.Technician_name;
            txtTechnicianTelephone.Text = order.Technician.Technician_telephone;
            txtTechnicianContact.Text   = order.Technician.Technician_contact;
            //Consultamos el código del equipo asignado a la orden en order_article
            string code = orderArticleLog.Read_code_article_of_order(order.Order_number);
            //Consultamos el artículo con el código de orden anterior
            Article article = articleLog.Read_once(code);

            txtArticleCode.Text        = article.Article_code;
            txtArticleDescription.Text = article.Article_description;
            Category category = categoryLog.Read_once(article.Category);

            txtCategory.Text = category.Category_name;
            //Consultamos en order article para traer el modelo->nro lote, especificacion y serial
            Order_articleFK order_ArticleFK = orderArticleLog.Read_ArticleOfOrder(order_number);

            txtArticleModel.Text  = order_ArticleFK.Model;
            txtArticleEsp.Text    = order_ArticleFK.Especification;
            txtArticleSerial.Text = order_ArticleFK.Serial;
            //Agregamos el campo report client
            txtReportClient.Text = order.Order_report_client;
            AutoCompleteService();
            AutoCompleteRefaction();
            CreateDataTables();
            //Console.WriteLine("IVA: " + taxLog.Read_once_value("19"));
            //Cargamos los articulos asociados a la orden
            //LoadArticlesOfOrder();
        }
Ejemplo n.º 2
0
        private void FrmCotizationViewer_Load(object sender, EventArgs e)
        {
            order = orderLog.Read_once(Order.Order_number_st);
            //Si la orden es "en espera"D
            if (order.Order_state.Equals("En espera"))
            {
                //Bloqueamos botones guardar y guardar & enviar
                IbtnSave.Enabled     = false;
                IbtnSaveSend.Enabled = false;
                //Visibilidad false botones anteriores
                IbtnSave.Visible     = false;
                IbtnSaveSend.Visible = false;
                //Movemos los botones a la posicion deseada
                IbtnFacturar.Location = new Point(816, 21);
                IbtnCancel.Location   = new Point(764, 21);
                IbtnEdit.Location     = new Point(685, 21);
            }
            else if (order.Order_state.Equals("Cotizada"))
            {
                //Ocultamos los botones del if
                IbtnFacturar.Visible = false;
                IbtnCancel.Visible   = false;
                IbtnEdit.Visible     = false;
            }
            else if (order.Order_state.Equals("Cancelada") || order.Order_state.Equals("Facturada"))
            {
                panel2.Visible = false;
            }
            txtCotizationId.Text = order.Cotization.Cotization_id;
            txtOrderType.Text    = order.Order_type;
            txtOrderNumber.Text  = order.Order_number;
            txtOrderState.Text   = order.Order_state;
            dtpGeneration.Value  = order.Cotization.Cotization_generation_date;
            //Agregamos el cliente
            txtClientId.Text       = order.Client.Client_id;
            txtClientName.Text     = order.Client.Client_name;
            txtClientAddress.Text  = order.Client.Client_address;
            txtClientLocation.Text = order.Client.Client_location;
            txtClientCity.Text     = order.Client.Client_city;
            txtClientDpt.Text      = order.Client.Client_department;
            txtClientTel1.Text     = order.Client.Client_tel1;
            txtClientTel2.Text     = order.Client.Client_tel2;
            txtClientEmail.Text    = order.Client.Client_email;
            //Agregamos el equipo
            //Article article = articleLog.Read_once(orderArticleLog.Read_code_article_of_order(Order.Order_number_st));
            //txtArticleCode.Text = article.Article_code;
            //txtArticleDescription.Text = article.Article_description;
            CreateDataTables();
            //Agregamos los articulos
            AddArticles();

            //Agregamos los servicios
            AddServices();
            //Agregamos los repuesto
            AddRefactions();
            //Comentarios
            //Console.WriteLine("Reporte cliente: " + order.Order_report_client);
            string comentarys = "";

            comentarys += "Cliente: " + Environment.NewLine + order.Order_report_client +
                          Environment.NewLine + Environment.NewLine;
            Cotization cotization = cotizationLog.Read_once(txtCotizationId.Text);

            comentarys        += "Técnico: " + Environment.NewLine + cotization.Cotization_comentarys;
            txtComentarys.Text = cotization.Cotization_comentarys;
            //Cargamos subtotal, descuento, iva y total
            lblSubtotal.Text = decimal.Parse(cotization.Cotization_subtotal, culture).ToString("C2");
            lblDiscount.Text = decimal.Parse(cotization.Cotization_discount, culture).ToString("C2");
            lblIva.Text      = decimal.Parse(cotization.Cotization_iva, culture).ToString("C2");
            lblTotal.Text    = decimal.Parse(cotization.Cotization_total, culture).ToString("C2");
        }