private void deleteline_btn_Click(object sender, RoutedEventArgs e)
        {
            if (this.lineid_txt.Text != "")
            {
                _invLineController.DaleteInvLine(this.lineid_txt.Text,this.invid_txt.Text);

                this.clear_data_line();
                this.PopulateGridLine(this.invid_txt.Text);

                Invoice _invAll = new Invoice();
                _invAll = this._invController.GetSingleInvDataRAM(this.invid_txt.Text);

                this.invid_txt.Text = _invAll.inv_id;
                this.invno_txt.Text = _invAll.inv_no;
                this.invweb_txt.Text = _invAll.inv_web_no;
                this.pono_txt.Text = _invAll.po_no;
                this.disc_txt.Text = _invAll.disc;
                this.dp_txt.Text = _invAll.dp;
                this.total_sales_lbl.Content = _invAll.total_sales;
                this.nett_sales_lbl.Content = _invAll.nett_sales;
                this.ppn_lbl.Content = _invAll.ppn;
                this.grand_total_lbl.Content = _invAll.grand_total;
                this.invdate_dtpicker.Text = _invAll.inv_date;
                this.duedate_dtpicker.Text = _invAll.inv_due_date;
                this.podate_dtpicker.Text = _invAll.po_date;
                this.cust_cbox.SelectedValue = _invAll.cust_id;
                this.sales_cbox.SelectedValue = _invAll.sales_id;
                this.upname_txt.Text = _invAll.cust_up_name;

            }
        }
        private void invoice_datagrid_MouseDown(object sender, MouseButtonEventArgs e)
        {
            InvoiceSimple _invSimple = new InvoiceSimple();
            Invoice _invAll = new Invoice();


            _invSimple = (InvoiceSimple)this.invoice_datagrid.SelectedItem;

            if (_invSimple != null)
            {
                _invAll = this._invController.GetSingleInvDataTICKTAB(_invSimple.inv_id);

                this.PopulateGridLine(_invAll.inv_id);

                this.invid_txt.Text = _invAll.inv_id;
                this.invno_txt.Text = _invAll.inv_no;
                this.invweb_txt.Text = _invAll.inv_web_no;
                this.pono_txt.Text = _invAll.po_no;
                this.disc_txt.Text = _invAll.disc;
                this.dp_txt.Text = _invAll.dp;
                this.total_sales_lbl.Content = _invAll.total_sales;
                this.nett_sales_lbl.Content = _invAll.nett_sales;
                this.ppn_lbl.Content = _invAll.ppn;
                this.grand_total_lbl.Content = _invAll.grand_total;
                this.invdate_dtpicker.Text = _invAll.inv_date;
                this.duedate_dtpicker.Text = _invAll.inv_due_date;
                this.podate_dtpicker.Text = _invAll.po_date;
                this.cust_cbox.SelectedValue = _invAll.cust_id;
                this.sales_cbox.SelectedValue = _invAll.sales_id;
                this.upname_txt.Text = _invAll.cust_up_name;
            }
        }
        private void saveline_btn_Click(object sender, RoutedEventArgs e)
        {
            bool _result;

            if (this.invid_txt.Text != "")
            {

                if (this.lineid_txt.Text == "")
                {
                    _result = _invLineController.InsertInvLine(this.invid_txt.Text, this.linedesc_txt.Text, this.lineqty_txt.Text, this.unitprice_txt.Text, this.subtotal_txt.Text);
                }
                else
                {
                    _result = _invLineController.UpdateInvLine(this.invid_txt.Text, this.lineid_txt.Text, this.linedesc_txt.Text, this.lineqty_txt.Text, this.unitprice_txt.Text, this.subtotal_txt.Text);
                }

                if (_result == true)
                {
                    this.clear_data_line();
                    this.PopulateGridLine(this.invid_txt.Text);
                }

                Invoice _invAll = new Invoice();
                _invAll = this._invController.GetSingleInvDataRAM(this.invid_txt.Text);

                this.invid_txt.Text = _invAll.inv_id;
                this.invno_txt.Text = _invAll.inv_no;
                this.invweb_txt.Text = _invAll.inv_web_no;
                this.pono_txt.Text = _invAll.po_no;
                this.disc_txt.Text = _invAll.disc;
                this.dp_txt.Text = _invAll.dp;
                this.total_sales_lbl.Content = _invAll.total_sales;
                this.nett_sales_lbl.Content = _invAll.nett_sales;
                this.ppn_lbl.Content = _invAll.ppn;
                this.grand_total_lbl.Content = _invAll.grand_total;
                this.invdate_dtpicker.Text = _invAll.inv_date;
                this.duedate_dtpicker.Text = _invAll.inv_due_date;
                this.podate_dtpicker.Text = _invAll.po_date;
                this.cust_cbox.SelectedValue = _invAll.cust_id;
                this.sales_cbox.SelectedValue = _invAll.sales_id;
                this.upname_txt.Text = _invAll.cust_up_name;

            }

            this.linedesc_txt.Focus();
        }
예제 #4
0
        public Invoice GetSingleInvDataRAM(string _prmInvId)
        {
            Invoice _list=new Invoice();

            string _query = "SELECT"
                            + " inv_id"
                            + ",inv_no"
                            + ",inv_web_no"
                            + ",inv_type"
                            + ",inv_date"
                            + ",inv_due_date"
                            + ",inv_curr"
                            + ",a.cust_id"
                            + ",cust_name"
                            + ",cust_address"
                            + ",cust_up_name"
                            + ",po_no"
                            + ",po_date"
                            + ",a.sales_id"
                            + ",sales_name"
                            + ",total_sales"
                            + ",disc"
                            + ",dp"
                            + ",nett_sales"
                            + ",dpp"
                            + ",ppn"
                            + ",grand_total"
                            + ",isclose"
                            + " FROM invoice a"
                            + " LEFT JOIN salespersons b ON a.sales_id=b.sales_id"
                            + " LEFT JOIN customers c ON a.cust_id=c.cust_id"
                            + " WHERE inv_id=" + _prmInvId
                            + " AND UCASE(inv_type)='RAM'"
                            + " LIMIT 1";

            if (this.OpenConnection() == true)
            {
                MySqlCommand cmd = new MySqlCommand(_query, _connection);
                MySqlDataReader dataReader = cmd.ExecuteReader();

                while (dataReader.Read())
                {
                    _list = new Invoice(dataReader["inv_id"].ToString()
                        , dataReader["inv_no"].ToString()
                        , dataReader["inv_web_no"].ToString()
                        , dataReader["inv_type"].ToString()
                        , dataReader["inv_date"].ToString()
                        , dataReader["inv_due_date"].ToString()
                        , dataReader["inv_curr"].ToString()
                        , dataReader["cust_id"].ToString()
                        , dataReader["cust_name"].ToString()
                        , dataReader["cust_address"].ToString()
                        , dataReader["cust_up_name"].ToString()
                        , dataReader["po_no"].ToString()
                        , dataReader["po_date"].ToString()
                        , dataReader["sales_id"].ToString()
                        , dataReader["sales_name"].ToString()
                        , dataReader["total_sales"].ToString()
                        , dataReader["disc"].ToString()
                        , dataReader["dp"].ToString()
                        , dataReader["nett_sales"].ToString()
                        , dataReader["dpp"].ToString()
                        , dataReader["ppn"].ToString()
                        , dataReader["grand_total"].ToString()
                        , dataReader["isclose"].ToString()
                        );
                }
                dataReader.Close();

            }

            this.CloseConnection();
            return _list;
        }