Esempio n. 1
0
        private void FormTransaction_Load(object sender, EventArgs e)
        {
            //set numeric updown

            ModuleControlSettings.SetNumericUpDown(num_Quantity);
            ModuleControlSettings.SetNumericUpDown(num_Jumlah, true);
            ModuleControlSettings.SetNumericUpDown(num_Disc);
            ModuleControlSettings.SetNumericUpDown(num_Total, true);
            ModuleControlSettings.SetNumericUpDown(num_Tax);
            ModuleControlSettings.SetNumericUpDown(num_TaxValue);
            ModuleControlSettings.SetNumericUpDown(num_GrandTotal, true);
            ModuleControlSettings.SetNumericUpDown(num_Pay);

            ModuleControlSettings.SetNumericUpDown(num_Back, true);
            num_Back.Minimum = decimal.MinValue;


            for (int i = 0; i < 7; i++)
            {
                grid_Trans.Columns.Add(i.ToString(), i.ToString());
            }

            // Mengatur lebar kolom
            grid_Trans.Columns[0].Width = 192 - 1;
            grid_Trans.Columns[1].Width = 223;
            grid_Trans.Columns[2].Width = 65;
            grid_Trans.Columns[3].Width = 73 - 1;
            grid_Trans.Columns[4].Width = 101 - 1;
            grid_Trans.Columns[5].Width = 60 - 1;
            grid_Trans.Columns[6].Width = 89;

            grid_Trans.Columns[0].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleLeft;
            grid_Trans.Columns[1].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleLeft;

            ModuleControlSettings.SetDateTimePicker(dt_TransactionDate);
            dt_TransactionDate.Value = DateTime.Now;
            txt_TransactionId.Text   = DateTime.Now.ToFileTimeUtc().ToString();

            MSetting set = (MSetting)DataMaster.GetObjectByProperty(typeof(MSetting), MSetting.ColumnNames.SettingId, AppCode.AssemblyProduct);

            if (set != null)
            {
                lbl_ShopName.Text    = set.CompanyName;
                lbl_ShopAddress.Text = set.CompanyAddress + " " + set.CompanyCity;
                lbl_ShopTelp.Text    = "Telp : " + set.CompanyTelp;
            }
            //set location shop header
            float shopWidth = (lbl_ShopName.Text.Length * (lbl_ShopName.Font.Size - 2));
            float xShop     = (groupBox5.Width / 2) - (shopWidth / 2) + groupBox5.Location.X;

            lbl_ShopName.Location = new Point(Convert.ToInt32(xShop), lbl_ShopName.Location.Y);

            shopWidth = (lbl_ShopAddress.Text.Length * (lbl_ShopAddress.Font.Size - 2));
            xShop     = (groupBox5.Width / 2) - (shopWidth / 2) + groupBox5.Location.X;
            lbl_ShopAddress.Location = new Point(Convert.ToInt32(xShop), lbl_ShopAddress.Location.Y);

            shopWidth             = (lbl_ShopTelp.Text.Length * (lbl_ShopTelp.Font.Size - 2));
            xShop                 = (groupBox5.Width / 2) - (shopWidth / 2) + groupBox5.Location.X;
            lbl_ShopTelp.Location = new Point(Convert.ToInt32(xShop), lbl_ShopTelp.Location.Y);

            SetInitialSettings();
            detailControl_KeyDown(null, null);

            //show tunai group box
            if (!(lbl_TempTransaction.Text.Equals(ListOfTransaction.Sales.ToString()) || lbl_TempTransaction.Text.Equals(ListOfTransaction.SalesVIP.ToString())))
            {
                lbl_Pay.Visible  = false;
                num_Pay.Visible  = false;
                lbl_Back.Visible = false;
                num_Back.Visible = false;
            }

            if (lbl_TempTransaction.Text.Equals(ListOfTransaction.Sales.ToString()) || lbl_TempTransaction.Text.Equals(ListOfTransaction.ReturSales.ToString()) || lbl_TempTransaction.Text.Equals(ListOfTransaction.SalesVIP.ToString()) || lbl_TempTransaction.Text.Equals(ListOfTransaction.ReturSalesVIP.ToString()))
            {
                lbl_Customer.Text = "Pelanggan :";
                if (lbl_TempTransaction.Text.Equals(ListOfTransaction.Sales.ToString()) || lbl_TempTransaction.Text.Equals(ListOfTransaction.SalesVIP.ToString()))
                {
                    ModuleControlSettings.SetNumericUpDown(num_Price, true);
                }
            }
            else if (lbl_TempTransaction.Text.Equals(ListOfTransaction.Correction.ToString()))
            {
                SetFormToCorrection();
            }
            else
            {
                lbl_Customer.Text = "Supplier :";
            }

            PictureBox searchPic = new PictureBox();

            ModuleControlSettings.SetSearchPictureBox(txt_CustId, ListOfSearchWindow.SearchCustomer.ToString(), searchPic);
            searchPic.Click += new EventHandler(searchPicCustomer_Click);
            txt_CustId.Controls.Add(searchPic);

            searchPic = new PictureBox();
            ModuleControlSettings.SetSearchPictureBox(txt_ItemId, ListOfSearchWindow.SearchItem.ToString(), searchPic);
            searchPic.Click += new EventHandler(searchPicItem_Click);
            txt_ItemId.Controls.Add(searchPic);

            string j = "Penjualan";

            if (lbl_TempTransaction.Text.Equals(ListOfTransaction.Sales.ToString()) || lbl_TempTransaction.Text.Equals(ListOfTransaction.SalesVIP.ToString()))
            {
                j = "Penjualan";
            }
            else if (lbl_TempTransaction.Text.Equals(ListOfTransaction.ReturSales.ToString()) || lbl_TempTransaction.Text.Equals(ListOfTransaction.ReturSalesVIP.ToString()))
            {
                j = "Retur Penjualan";
            }
            else if (lbl_TempTransaction.Text.Equals(ListOfTransaction.Purchase.ToString()))
            {
                j = "Pembelian";
            }
            else if (lbl_TempTransaction.Text.Equals(ListOfTransaction.ReturPurchase.ToString()))
            {
                j = "Retur Pembelian";
            }
            else if (lbl_TempTransaction.Text.Equals(ListOfTransaction.Correction.ToString()))
            {
                j = "Penyesuaian";
            }

            this.TabText = j;
            this.Text    = j;

            //fill suggest textbox
            ModuleControlSettings.FillItemSuggestSource(txt_ItemId);
            if (lbl_TempTransaction.Text.Equals(ListOfTransaction.Sales.ToString()) || lbl_TempTransaction.Text.Equals(ListOfTransaction.ReturSales.ToString()) || lbl_TempTransaction.Text.Equals(ListOfTransaction.SalesVIP.ToString()) || lbl_TempTransaction.Text.Equals(ListOfTransaction.ReturSalesVIP.ToString()))
            {
                ModuleControlSettings.SetCustomerTextBoxSuggest(txt_CustId);
            }
            else
            {
                ModuleControlSettings.SetSupplierTextBoxSuggest(txt_CustId);
            }
        }