Example #1
0
 private void btnAdd_Click(object sender, EventArgs e)
 {
     if (this.Lbl_MercName.Text != string.Empty)
     {
         if (Class7.ParseDoubleValue(this.Txt_Qty.Text) > Class7.ParseDoubleValue(this.Txt_OldQty.Text))
         {
             Class7.ShowMessageBox("Lượng trả lại kh\x00f4ng thể lớn hơn lượng đ\x00e3 b\x00e1n !", 1);
             this.Txt_Qty.Focus();
             this.Txt_Qty.SelectAll();
         }
         else
         {
             double num  = Class7.ParseDoubleValue(this.Txt_Qty.Text);
             string str  = this.Txt_GoodsId.Text.Trim();
             double num2 = (Class7.ParseDoubleValue(this.Txt_Amount.Text) / Class7.ParseDoubleValue(this.Txt_OldQty.Text)) * num;
             double num3 = (Class7.ParseDoubleValue(this.Txt_Discount.Text) / Class7.ParseDoubleValue(this.Txt_OldQty.Text)) * num;
             double num4 = (Class7.ParseDoubleValue(this.Txt_Surplus.Text) / Class7.ParseDoubleValue(this.Txt_OldQty.Text)) * num;
             double num5 = (Class7.ParseDoubleValue(this.Txt_Vatamt.Text) / Class7.ParseDoubleValue(this.Txt_OldQty.Text)) * num;
             string str2 = this.Lbl_MercName.Text.Trim();
             string str3 = this.Lbl_Unit.Text.Trim();
             this.string_1 = string.Concat(new object[] {
                 "IF NOT EXISTS(SELECT goods_id from ", this.string_0, " where goods_id = '", str, "') INSERT INTO ", this.string_0, "(goods_id, Name, qty, unit, amount, discount,surplus,vat_amt) VALUES ('", str, "',N'", str2, "',", num, ",'", str3, "',", num2,
                 ",", num3, ", ", num4, ",", num5, ") Else UPDATE ", this.string_0, " SET qty = '", num, "', amount = ", num2, ", discount = ", num3, ", surplus = ", num4,
                 ",vat_amt = ", num5, " where goods_id = '", str, "';DELETE FROM ", this.string_0, " where qty <= 0 "
             });
             Class6 class2 = new Class6();
             this.cnvLekth7 = new OleDbDataAdapter(this.string_1, this.oleDbConnection_0);
             DataSet dataSet = new DataSet();
             this.cnvLekth7.Fill(dataSet);
             class2.method_2(this.string_0);
             this.method_0();
             this.Txt_GoodsId.Focus();
         }
     }
 }
Example #2
0
 private void btn_Add_Click(object sender, EventArgs e)
 {
     if (string.IsNullOrEmpty(this.Lbl_MercName.Text))
     {
         this.Txt_GoodsId.Focus();
     }
     else if ((Class7.ParseDoubleValue(this.Txt_MinusQty.Text) < 0.0) | (Class7.ParseDoubleValue(this.Txt_PlusQty.Text) < 0.0))
     {
         this.Txt_MinusQty.Focus();
     }
     else
     {
         string str  = this.Txt_GoodsId.Text.Trim();
         string str2 = this.Lbl_MercName.Text.Trim();
         double num  = Class7.ParseDoubleValue(this.Txt_MinusQty.Text);
         double num2 = Class7.ParseDoubleValue(this.Txt_PlusQty.Text);
         double num3 = Class7.ParseDoubleValue(this.Txt_Price.Text);
         double num4 = num3 * num2;
         double num5 = num3 * num;
         string str3 = this.Cmb_Unit.Text.Trim();
         if (Class7.ParseDoubleValue(this.Txt_MinusQty.Text) < 0.0)
         {
             Class7.ShowMessageBox("Số lượng đăng k\x00fd kh\x00f4ng hợp lệ", 1);
             this.Txt_MinusQty.Focus();
         }
         else if (Class7.ParseDoubleValue(this.Txt_PlusQty.Text) < 0.0)
         {
             Class7.ShowMessageBox("Số lượng đăng k\x00fd kh\x00f4ng hợp lệ", 1);
             this.Txt_PlusQty.Focus();
         }
         else
         {
             Class6 class2            = new Class6();
             string selectCommandText = string.Concat(new object[] {
                 "IF NOT EXISTS (SELECT goods_id FROM ", this.string_1, " where goods_id = '", str, "') INSERT INTO ", this.string_1, "(goods_id, Name, pqty, mqty, price, mamount, pamount, unitsymb, merc_type) VALUES('", str, "',N'", str2, "',", num2, ",", num, ", ", num3,
                 ",", num5, ",", num4, ",'", str3, "','01') ELSE UPDATE ", this.string_1, " SET pqty =", num2, ",mqty=", num, ",pamount=", num4, ",mamount= ", num5,
                 " where goods_id = '", str, "' ; DELETE FROM ", this.string_1, " where mqty = 0 and pqty = 0 "
             });
             this.oleDbDataAdapter_0 = new OleDbDataAdapter(selectCommandText, this.oleDbConnection_1);
             DataSet dataSet = new DataSet();
             this.oleDbDataAdapter_0.Fill(dataSet);
             this.oleDbConnection_1.Close();
             class2.method_2(this.string_1);
             this.method_1();
             this.Txt_PlusQty.Text  = "0";
             this.Txt_MinusQty.Text = "0";
             this.Txt_GoodsId.Focus();
             this.Txt_GoodsId.SelectAll();
         }
     }
 }
Example #3
0
 private void btnAdd_Click(object sender, EventArgs e)
 {
     if (string.IsNullOrEmpty(this.Lbl_MercName.Text))
     {
         this.Txt_GoodsId.Focus();
     }
     else
     {
         this.Txt_GoodsId.Text.Trim();
         this.Lbl_MercName.Text.Trim();
         Class7.ParseDoubleValue(this.Txt_Qty.Text);
         Class7.ParseDoubleValue(this.Txt_DiscPc.Text);
         Class7.ParseDoubleValue(this.Txt_Price.Text);
         this.Cmb_Unit.Text.Trim();
         if (Class7.ParseDoubleValue(this.Txt_Qty.Text) < 0.0)
         {
             Class7.ShowMessageBox("Số lượng nhập đăng k\x00fd kh\x00f4ng hợp lệ", 1);
             this.Txt_Qty.Focus();
         }
         else
         {
             Class6 class2 = new Class6();
             this.ddvqeXfa4();
             class2.method_2(this.string_0);
             this.method_1();
             this.oleDbDataAdapter_0 = new OleDbDataAdapter("select sum(amount) AS a_amt, sum(amount*disc_rate/100) AS d_amt, sum(amount) AS t_amt, sum(vat_amt) AS v_amt from " + this.string_0, this.oleDbConnection_1);
             DataSet dataSet = new DataSet();
             this.oleDbDataAdapter_0.Fill(dataSet);
             this.oleDbConnection_1.Close();
             if (dataSet.Tables[0].Rows.Count != 0)
             {
                 this.Txt_ImpAmt.Text   = dataSet.Tables[0].Rows[0]["a_amt"].ToString();
                 this.Txt_TotalAmt.Text = dataSet.Tables[0].Rows[0]["t_amt"].ToString();
                 this.Txt_VatAmt.Text   = dataSet.Tables[0].Rows[0]["v_amt"].ToString();
                 this.Txt_DiscAmt.Text  = dataSet.Tables[0].Rows[0]["d_amt"].ToString();
             }
             else
             {
                 this.Txt_ImpAmt.Text   = "0";
                 this.Txt_TotalAmt.Text = "0";
                 this.Txt_VatAmt.Text   = "0";
                 this.Txt_DiscAmt.Text  = "0";
             }
             this.Txt_Qty.Text         = "1";
             this.Txt_DiscPc.EditValue = 0.0;
             this.Txt_GoodsId.Focus();
             this.Txt_GoodsId.SelectAll();
         }
     }
 }
Example #4
0
 private void btnAdd_Click(object sender, EventArgs e)
 {
     if (string.IsNullOrEmpty(this.Lbl_MercName.Text))
     {
         this.Txt_GoodsId.Focus();
     }
     else
     {
         string str    = this.Txt_GoodsId.Text.Trim();
         string str2   = this.Txt_ExpID.Text.Trim();
         string str3   = this.Lbl_MercName.Text.Trim();
         double num    = Class7.ParseDoubleValue(this.Txt_Qty.Text);
         double num2   = Class7.ParseDoubleValue(this.Txt_DiscPc.Text);
         double num3   = Class7.ParseDoubleValue(this.Txt_Price.Text);
         string str4   = this.Cmb_Unit.Text.Trim();
         Class6 class2 = new Class6();
         if (!class2.method_22() && (class2.method_21(str, str2) < num))
         {
             Class7.ShowMessageBox("Số lượng tồn kh\x00f4ng đủ để xuất kho !", 1);
             this.Txt_Qty.Focus();
         }
         else if (Class7.ParseDoubleValue(this.Txt_Qty.Text) < 0.0)
         {
             Class7.ShowMessageBox("Số lượng nhập đăng k\x00fd kh\x00f4ng hợp lệ", 1);
             this.Txt_Qty.Focus();
         }
         else
         {
             string selectCommandText = string.Concat(new object[] {
                 "IF EXISTS (SELECT goods_id FROM ", this.string_0, " where goods_id = '", str, "') UPDATE ", this.string_0, " SET [qty] = ", num, " ,[amount] = ", num3 * num, ",[price] = ", num3, ",disc_rate = ", num2, "  WHERE goods_id = '", str,
                 "' Else INSERT INTO ", this.string_0, "(goods_id, name, qty, price, disc_rate,amount,unitsymb,merc_type)  VALUES('", str, "' , N'", str3, "',", num, ",", num3, ",", num2, ",", num3 * num, ", '", str4,
                 "', '01') ; DELETE FROM ", this.string_0, " WHERE qty <= 0 "
             });
             this.oleDbDataAdapter_0 = new OleDbDataAdapter(selectCommandText, this.oleDbConnection_1);
             using (DataSet set = new DataSet())
             {
                 this.oleDbDataAdapter_0.Fill(set);
             }
             this.oleDbConnection_1.Close();
             class2.method_2(this.string_0);
             this.method_1();
             this.method_2();
             this.Txt_Qty.Text         = "1";
             this.Txt_DiscPc.EditValue = 0.0;
             this.Txt_GoodsId.Focus();
             this.Txt_GoodsId.SelectAll();
         }
     }
 }
Example #5
0
 private void btnAdd_Click(object sender, EventArgs e)
 {
     if (string.IsNullOrEmpty(this.Lbl_MercName.Text))
     {
         this.Txt_GoodsId.Focus();
     }
     else
     {
         string str    = this.Txt_GoodsId.Text.Trim();
         string str4   = this.Txt_ExpID.Text.Trim();
         string str2   = this.Lbl_MercName.Text.Trim();
         double num    = Class7.ParseDoubleValue(this.Txt_Qty.Text);
         double num2   = Class7.ParseDoubleValue(this.Txt_Price.Text);
         string str3   = this.Cmb_Unit.Text.Trim();
         Class6 class2 = new Class6();
         if (!class2.method_22() && (class2.method_21(str, str4) < num))
         {
             Class7.ShowMessageBox("Số lượng tồn kh\x00f4ng đủ để xuất kho !", 1);
             this.Txt_Qty.Focus();
         }
         else if (Class7.ParseDoubleValue(this.Txt_Qty.Text) < 0.0)
         {
             Class7.ShowMessageBox("Số lượng nhập đăng k\x00fd kh\x00f4ng hợp lệ", 1);
             this.Txt_Qty.Focus();
         }
         else
         {
             class2.method_1(this.string_0, str, str2, num, 0.0, num2, str3, "01");
             class2.method_2(this.string_0);
             this.method_1();
             this.Txt_Qty.Text = "1";
             this.Txt_GoodsId.Focus();
             this.Txt_GoodsId.SelectAll();
         }
     }
 }