예제 #1
0
        private void load_data(string CostingNo)
        {
            DataSet dsHeader = new costingCRUD().getData(CostingNo);

            txtCostingNo.Text      = CostingNo;
            cbDIV.SelectedValue    = dsHeader.Tables[0].Rows[0]["GDIV"].ToString();
            cbTypeID.SelectedValue = dsHeader.Tables[0].Rows[0]["TYPEID"].ToString();
            txtQty.Text            = dsHeader.Tables[0].Rows[0]["QTYORDER"].ToString();
            txtCustomerID.Text     = dsHeader.Tables[0].Rows[0]["CUSTVENDCODE"].ToString();
            txtStyleID.Text        = dsHeader.Tables[0].Rows[0]["ITEMSID"].ToString();
            txtCategoryID.Text     = dsHeader.Tables[0].Rows[0]["CATEGORYID"].ToString();
            txtKurs.Text           = dsHeader.Tables[0].Rows[0]["KURS"].ToString();
            cbValueIn.Text         = dsHeader.Tables[0].Rows[0]["VALUEIN"].ToString();
            dateCreated.Value      = (DateTime)dsHeader.Tables[0].Rows[0]["DATE"];
            txtPPN.Text            = dsHeader.Tables[0].Rows[0]["PPN"].ToString();
            txtMargin.Text         = dsHeader.Tables[0].Rows[0]["MARGIN"].ToString();
            txtFOB.Text            = dsHeader.Tables[0].Rows[0]["SELLINGPRICE"].ToString();
            txtRemarks.Text        = dsHeader.Tables[0].Rows[0]["REMARKS"].ToString();
            DataSet dsDetail = new costingdetailCRUD().getData(CostingNo);

            dtGrid.Rows.Clear();
            for (int i = 0; i < dsDetail.Tables[0].Rows.Count; i++)
            {
                dtGrid.Rows.Add();
                dtGrid.Rows[i].HeaderCell.Value            = "V";
                dtGrid.Rows[i].Cells["hCostingNo"].Value   = dsDetail.Tables[0].Rows[i]["COSTINGNO"].ToString();
                dtGrid.Rows[i].Cells["hID"].Value          = dsDetail.Tables[0].Rows[i]["ID"].ToString();
                dtGrid.Rows[i].Cells["hAllowance"].Value   = Convert.ToSingle(dsDetail.Tables[0].Rows[i]["ALLOWANCE"]);
                dtGrid.Rows[i].Cells["hAmount"].Value      = Convert.ToSingle(dsDetail.Tables[0].Rows[i]["AMOUNT"]);
                dtGrid.Rows[i].Cells["hConsumption"].Value = Convert.ToSingle(dsDetail.Tables[0].Rows[i]["CONSUMPTION"]);
                dtGrid.Rows[i].Cells["hCostType"].Value    = dsDetail.Tables[0].Rows[i]["COSTID"].ToString();

                dtGrid.Rows[i].Cells["hCurrency"].Value    = dsDetail.Tables[0].Rows[i]["CURRENCY"].ToString();
                dtGrid.Rows[i].Cells["hDescription"].Value = dsDetail.Tables[0].Rows[i]["DESCRIPTION"].ToString();
                dtGrid.Rows[i].Cells["hKurs"].Value        = Convert.ToSingle(dsDetail.Tables[0].Rows[i]["KURS"]);
                dtGrid.Rows[i].Cells["hPrice"].Value       = Convert.ToSingle(dsDetail.Tables[0].Rows[i]["PRICE"]);
                dtGrid.Rows[i].Cells["hUOM"].Value         = dsDetail.Tables[0].Rows[i]["UOMID"].ToString();
                dtGrid.Rows[i].Cells["hUsage"].Value       = dsDetail.Tables[0].Rows[i]["USAG"].ToString();
                dtGrid.Rows[i].Cells["hWidth"].Value       = dsDetail.Tables[0].Rows[i]["WIDTH"].ToString();
            }
        }
예제 #2
0
        private void dtGrid_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            var senderGrid = (DataGridView)sender;

            GStrCode   = "";
            GitemsDesc = "";
            //untuk items
            if (senderGrid.Columns[e.ColumnIndex] is DataGridViewButtonColumn &&
                e.RowIndex >= 0 && senderGrid.Columns[e.ColumnIndex] == dtGrid.Columns["hItemsID"])
            {
                frmItemsSearch f = new frmItemsSearch();
                f.AddItemCallback = new frmItemsSearch.AddItemDelegate(this.SetItemsCallBack);
                f.ShowDialog();
                if (GStrCode != "")
                {
                    // MessageBox.Show("keren bok");
                    dtGrid.Rows[e.RowIndex].Cells["hItemsID"].Value     = GStrCode;
                    dtGrid.Rows[e.RowIndex].Cells["hDescription"].Value = GitemsDesc;

                    /*
                     * DataSet dsDetail = new mitemsCRUD().getData(GStrCode);
                     * if (dsDetail.Tables[0].Rows.Count > 0)
                     * {
                     *  DataGridViewComboBoxCell dtgCol = dtGrid.Rows[e.RowIndex].Cells["hItemsID"] as DataGridViewComboBoxCell;
                     *  dtgCol.DataSource = dsDetail.Tables[0];
                     *  dtgCol.DisplayMember = "DESCRIPTION";
                     *  dtgCol.ValueMember = "ITEMSID";
                     *
                     * }
                     * */
                }
            }


            //untuk costing
            if (senderGrid.Columns[e.ColumnIndex] is DataGridViewButtonColumn &&
                e.RowIndex >= 0 && senderGrid.Columns[e.ColumnIndex] == dtGrid.Columns["hCostingNo"])
            {
                GStrCode = "";
                frmcostingSearch f = new frmcostingSearch();
                f.AddItemCallback = new frmcostingSearch.AddCostingDelegate(this.SetCostingCallBack);
                f.ShowDialog();
                if (GStrCode != "")
                {
                    dtGrid.Rows[e.RowIndex].Cells["hCostingNo"].Value = GStrCode;
                    DataSet dsDetail = new costingdetailCRUD().getData(GStrCode);
                    if (dsDetail.Tables[0].Rows.Count > 0)
                    {
                        //DataGridViewComboBoxColumn CostingID = dtGrid.Columns["hCostingID"] as DataGridViewComboBoxColumn;//new DataGridViewComboBoxColumn();
                        //CostingID.DataSource = dsDetail.Tables[0];
                        //CostingID.DisplayMember = "DESCRIPTION";
                        //CostingID.ValueMember = "ID";
                        DataGridViewComboBoxCell dtgCol = dtGrid.Rows[e.RowIndex].Cells["hCostingID"] as DataGridViewComboBoxCell;
                        // dtgCol.Items.Add("comboitem1");
                        //dtgCol.Items.Add("comboitem2");
                        dtgCol.DataSource    = dsDetail.Tables[0];
                        dtgCol.DisplayMember = "DESCRIPTION";
                        dtgCol.ValueMember   = "ID";
                        //dtGrid.Rows[e.RowIndex].Cells["hCostingID"].Value
                    }
                    // else { dtGrid.Rows[e.RowIndex].Cells["hCostingID"].Value = ""; }
                    //MessageBox.Show("wowowowwowow");
                }
            }
        }
예제 #3
0
        private void RecordTSB_Click(object sender, EventArgs e)
        {
            frmPurchaseSearch f = new frmPurchaseSearch();

            f.AddItemCallback = new frmPurchaseSearch.AddPurchaseDelegate(this.SetPurchaseCallBack);
            f.ShowDialog();
            //txtCostingNo.Text
            if (GStrCode != "")
            {
                DataSet dsHeader = new purchaseCRUD().getData(GStrCode);
                txtPONO.Text        = GStrCode;
                cbDIV.SelectedValue = dsHeader.Tables[0].Rows[0]["GDIV"];
                dateCreated.Value   = (DateTime)dsHeader.Tables[0].Rows[0]["DATE"];
                txtRemarks.Text     = dsHeader.Tables[0].Rows[0]["REMARKS"].ToString();
                cbCurrency.Text     = dsHeader.Tables[0].Rows[0]["CURRENCYID"].ToString();
                txtKurs.Text        = dsHeader.Tables[0].Rows[0]["KURS"].ToString();
                //txtPPN.Text=dsHeader.Tables[0].Rows[0]["PPN"].ToString();
                txtCustomerID.Text = dsHeader.Tables[0].Rows[0]["CUSTVENDID"].ToString();
                txtDeliveryTo.Text = dsHeader.Tables[0].Rows[0]["DELIVERYTO"].ToString();
                // txtAddress.Text = dsHeader.Tables[0].Rows[0]["DELIVERYTOADDRESS"].ToString();
                txtRefer.Text    = dsHeader.Tables[0].Rows[0]["REFERTO"].ToString();
                cbCourier.Text   = dsHeader.Tables[0].Rows[0]["SHIPMODA"].ToString();
                txtAddresTo.Text = dsHeader.Tables[0].Rows[0]["DELIVERYTOADDRESS"].ToString();
                dateDue.Value    = (DateTime)dsHeader.Tables[0].Rows[0]["DUEDATE"];
                dateETA.Value    = (DateTime)dsHeader.Tables[0].Rows[0]["ETA"];
                dateETD.Value    = (DateTime)dsHeader.Tables[0].Rows[0]["ETD"];
                cbTerms.Text     = dsHeader.Tables[0].Rows[0]["TERMOFPAYMENT"].ToString();
                //txtDiscount.Text = dsHeader.Tables[0].Rows[0]["DISCOUNT"].ToString();
                //MessageBox.Show("testttt");
                DataSet dsDetail = new purchasedetailCRUD().getData(GStrCode);
                dtGrid.Rows.Clear();
                for (int i = 0; i < dsDetail.Tables[0].Rows.Count; i++)
                {
                    dtGrid.Rows.Add();
                    dtGrid.Rows[i].HeaderCell.Value          = "V";
                    dtGrid.Rows[i].Cells["hCostingNo"].Value = dsDetail.Tables[0].Rows[i]["COSTINGNO"].ToString();
                    // cari items costing
                    GStrCode = dsDetail.Tables[0].Rows[i]["COSTINGNO"].ToString();
                    DataSet dsDetailtemp = new costingdetailCRUD().getData(GStrCode);
                    if (dsDetailtemp.Tables[0].Rows.Count > 0)
                    {
                        DataGridViewComboBoxCell dtgCol = dtGrid.Rows[i].Cells["hCostingID"] as DataGridViewComboBoxCell;
                        dtgCol.DataSource    = dsDetailtemp.Tables[0];
                        dtgCol.DisplayMember = "DESCRIPTION";
                        dtgCol.ValueMember   = "ID";
                    }

                    dtGrid.Rows[i].Cells["hItemsID"].Value = dsDetail.Tables[0].Rows[i]["ITEMSID"];

                    dtGrid.Rows[i].Cells["hCostingID"].Value   = dsDetail.Tables[0].Rows[i]["COSTINGID"];
                    dtGrid.Rows[i].Cells["hPONO"].Value        = dsDetail.Tables[0].Rows[i]["PONO"].ToString();
                    dtGrid.Rows[i].Cells["hID"].Value          = dsDetail.Tables[0].Rows[i]["ID"].ToString();
                    dtGrid.Rows[i].Cells["hQuantity"].Value    = dsDetail.Tables[0].Rows[i]["QUANTITY"].ToString();
                    dtGrid.Rows[i].Cells["hUOM"].Value         = dsDetail.Tables[0].Rows[i]["UOM"].ToString();
                    dtGrid.Rows[i].Cells["hPrice"].Value       = dsDetail.Tables[0].Rows[i]["PRICE"].ToString();
                    dtGrid.Rows[i].Cells["hDescription"].Value = dsDetail.Tables[0].Rows[i]["DESCRIPTION"].ToString();

                    dtGrid.Rows[i].Cells["hQtyPurchase"].Value   = dsDetail.Tables[0].Rows[i]["QTYPURCHASE"].ToString();
                    dtGrid.Rows[i].Cells["hUOMPurchase"].Value   = dsDetail.Tables[0].Rows[i]["UOMPURCHASE"].ToString();
                    dtGrid.Rows[i].Cells["hPricePurchase"].Value = dsDetail.Tables[0].Rows[i]["PRICEPURCHASE"].ToString();
                    // dtGrid.Rows[i].Cells["hPPN"].Value = dsDetail.Tables[0].Rows[i]["PPN"];
                    //dtGrid.Rows[i].Cells["hDiscount"].Value = dsDetail.Tables[0].Rows[i]["DISCOUNT"];
                    dtGrid.Rows[i].Cells["hConvert"].Value  = dsDetail.Tables[0].Rows[i]["CONVER"];
                    dtGrid.Rows[i].Cells["hCurrency"].Value = dsDetail.Tables[0].Rows[i]["CURRENCYID"].ToString();
                    dtGrid.Rows[i].Cells["hKurs"].Value     = dsDetail.Tables[0].Rows[i]["KURS"].ToString();
                }

                SimpanTSB.Enabled = false;
                UbahTSB.Enabled   = true;
                dtGrid.Enabled    = true;
            }
        }