private void MN_ARSIVDEN_GERIAL_Click(object sender, EventArgs e) { SqlConnection myConnections = new SqlConnection(_GLOBAL_PARAMETERS._CONNECTIONSTRING_MDB); myConnections.Open(); int[] selectedRows = gridView_LIST.GetSelectedRows(); for (int ix = 0; ix <= selectedRows.Length - 1; ix++) { DateTime dtm = DateTime.Now; DataRow dr = gridView_LIST.GetDataRow(selectedRows[ix]); using (SqlCommand myCmd = new SqlCommand()) { myCmd.CommandText = " UPDATE dbo.FTR_LG_INVOICE SET AKTARIM_DURUMU='BEKLEMEDE', AKTARIM_SORUMLUSU=@AKTARIM_SORUMLUSU ,AKTARIM_TARIHI=@AKTARIM_TARIHI ,AKTARIM_NOTU=@AKTARIM_NOTU WHERE SIRKET_KODU=@SIRKET_KODU and NUMBER=@TASLAK_FATURA_NO "; //myCmd.CommandText += " UPDATE dbo.FTR_LG_STLINE WHERE SIRKET_KODU=@SIRKET_KODU and NUMBER=@TASLAK_FATURA_NO "; myCmd.Parameters.AddWithValue("@TASLAK_FATURA_NO", dr["NUMBER"].ToString()); myCmd.Parameters.AddWithValue("@SIRKET_KODU", _GLOBAL_PARAMETERS._SIRKET_KODU); myCmd.Parameters.AddWithValue("@AKTARIM_SORUMLUSU", _GLOBAL_PARAMETERS._KULLANICI_MAKINASI); myCmd.Parameters.AddWithValue("@AKTARIM_TARIHI", dtm.ToString("yyyy-MM-dd")); myCmd.Parameters.AddWithValue("@AKTARIM_NOTU", "MANUEL ARŞİVDEN ALINDI"); myCmd.Connection = myConnections; myCmd.ExecuteNonQuery(); myCmd.Connection.Close(); myConnections.Close(); } _GLOBAL_PARAMETERS.LOG_ISLEMLERI LF = new _GLOBAL_PARAMETERS.LOG_ISLEMLERI(); LF.LOG_AKTARIMI(dr["TIPI"].ToString(), dr["NUMBER"].ToString(), "ARŞİVDEN GERİ ALINDI", dr["TOTAL_NET"].ToString(), dr["TITLE"].ToString(), "", dr["DEFNFLD_PLAN_KODU"].ToString(), dr["NOTES1"].ToString(), ""); } BR_SELECT_ROW_FATURA_NO.Caption = ""; DATA_LOAD_BEKLEMEDE(); STLINE("0", "00000000-0000-0000-0000-000000000000", "0"); }
private void BTN_DELETE_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { //if (_GLOBAL_PARAMETERS._FATURA_SILME_YETKISI) //{ DialogResult c = MessageBox.Show("Silmek istediğinizden eminmisiniz.", "Uyarı", MessageBoxButtons.YesNo, MessageBoxIcon.Warning); if (c == DialogResult.Yes) { int[] selectedRows = gridView_LIST.GetSelectedRows(); for (int ix = 0; ix <= selectedRows.Length - 1; ix++) { DateTime dtm = DateTime.Now; DataRow dr = gridView_LIST.GetDataRow(selectedRows[ix]); SqlConnection myConnections = new SqlConnection(_GLOBAL_PARAMETERS._CONNECTIONSTRING_MDB); myConnections.Open(); using (SqlCommand myCmd = new SqlCommand()) { myCmd.CommandText += " delete dbo.FTR_LG_INVOICE WHERE SIRKET_KODU=@SIRKET_KODU and TASLAK_FATURA_NO=@TASLAK_FATURA_NO "; myCmd.CommandText += " delete dbo.FTR_LG_STLINE WHERE SIRKET_KODU=@SIRKET_KODU and TASLAK_FATURA_NO=@TASLAK_FATURA_NO "; myCmd.Parameters.AddWithValue("@TASLAK_FATURA_NO", dr["NUMBER"].ToString()); myCmd.Parameters.AddWithValue("@SIRKET_KODU", _GLOBAL_PARAMETERS._SIRKET_KODU); myCmd.Connection = myConnections; myCmd.ExecuteNonQuery(); myCmd.Connection.Close(); myConnections.Close(); } _GLOBAL_PARAMETERS.LOG_ISLEMLERI LF = new _GLOBAL_PARAMETERS.LOG_ISLEMLERI(); LF.LOG_AKTARIMI(dr["TIPI"].ToString(), dr["NUMBER"].ToString(), "SİL", dr["TOTAL_NET"].ToString(), dr["TITLE"].ToString(), "", dr["DEFNFLD_PLAN_KODU"].ToString(), dr["NOTES1"].ToString(), ""); } BR_SELECT_ROW_FATURA_NO.Caption = ""; DATA_LOAD_BEKLEMEDE(); } //} //else //{ // MessageBox.Show("Yetkiniz yok", "Uyarı", MessageBoxButtons.OK, MessageBoxIcon.Warning); //} }
private void FIRMAYA_AKTAR(string OLD_FIRMA, string NEW_FIRMA_KODU) { int[] selectedRows = gridView_LIST.GetSelectedRows(); for (int ix = 0; ix <= selectedRows.Length - 1; ix++) { DataRow dr = gridView_LIST.GetDataRow(selectedRows[ix]); string V_RETURN = "FATURA YOK"; using (SqlConnection myConnections = new SqlConnection(_GLOBAL_PARAMETERS._CONNECTIONSTRING_MDB)) { myConnections.Open(); SqlCommand myCommands = new SqlCommand(); myCommands.Connection = myConnections; myCommands.CommandText = "SELECT NUMBER from dbo.FTR_LG_INVOICE WHERE SIRKET_KODU=@SIRKET_KODU AND TASLAK_FATURA_NO=@TASLAK_FATURA_NO "; myCommands.Parameters.AddWithValue("@TASLAK_FATURA_NO", dr["TASLAK_FATURA_NO"].ToString().Replace(" ", "").Trim()); myCommands.Parameters.AddWithValue("@SIRKET_KODU", _GLOBAL_PARAMETERS._SIRKET_KODU.ToString()); SqlDataReader sqlreaders = myCommands.ExecuteReader(CommandBehavior.CloseConnection); while (sqlreaders.Read()) { V_RETURN = String.Format("BU NUMARA İLE FATURA VAR ({0})", dr["TASLAK_FATURA_NO"]); } sqlreaders.Close(); myCommands.Connection.Close(); } if (V_RETURN == "FATURA YOK") { using (SqlConnection myConnections = new SqlConnection(_GLOBAL_PARAMETERS._CONNECTIONSTRING_MDB)) { using (SqlCommand myCommandSubLineEx = new SqlCommand()) { myCommandSubLineEx.CommandText += "INSERT INTO FTR_LG_INVOICE ( AKTARIM_DURUMU, SIRKET_KODU, SIPARISI_VEREN, DEPARTMAN, BELGE_TYPE, TYPE, TASLAK_FATURA_NO, NUMBER, DOC_TRACK_NR, EINVOICE, ACCOUNT_TYPE, DEFNFLD_MUSTERI_KODU, CODE, TITLE, ADDRESS1, ADDRESS2, CITY, POSTAL_CODE, TELEPHONE1, FAX, TAX_OFFICE, TAX_ID, DATE, DOC_DATE, DOC_NUMBER, AUXIL_CODE, ARP_CODE, GL_CODE, VAT_RATE, ADD_DISCOUNTS, TOTAL_DISCOUNTS, TOTAL_VAT, TOTAL_GROSS, TOTAL_NET, TOTAL_DISCOUNTED, NOTES1, NOTES2, NOTES3, NOTES4, CURR_INVOICE, TC_NET, RC_XRATE, RC_NET, TC_XRATE, CURRSEL_TOTALS, CURRSEL_DETAILS, DEFNFLD_PAZARLAMA_SIRKETI_KODU, DEFNFLD_LEVEL_, DEFNFLD_MODULENR, DEFNFLD_PLAN_KODU,DEFNFLD_MECRA_TURU, DEFNFLD_FATURA_BASKI_SEKLI, DEFNFLD_FAKTORING_SIRKETI_KODU, DEFNFLD_ILGILI_FATURA_NO, DEFNFLD_SIPARISI_VEREN, DEFNFLD_DEPARTMAN, DEFNFLD_BOLGE_KODU, DEFNFLD_ILGILI_IS_UNITESI, DEFNFLD_EFATURA_KODU, DEFNFLD_PO_DETAILS, DEFNFLD_IS_KODU, DEFNFLD_ILGILI_KISI_ADI_SOYADI, DEFNFLD_ILGILI_KISI_MAIL_ADRESI, DEFNFLD_NOTES, DEFNFLD_XML_ATTRIBUTE, PAYMENT_DATE, PAYMENT_MODULENR, PAYMENT_TRCODE, PAYMENT_TOTAL, PAYMENT_PROCDATE, PAYMENT_DISCOUNT_DUEDATE, TRCURR, TRRATE, PAYMENT_MODIFIED, PAYMENT_PAY_NO, TRNET, PAYTR_CURR, PAYTR_RATE, PAYTR_NET, GLOBAL_CODE, PAYMENT_DISCTRLIST, PAYMENT_DISCTRDELLIST, INVOICE_Id, DEDUCTIONPART1, DEDUCTIONPART2, PROJECT_CODE, AKTARIM_SORUMLUSU, AKTARIM_TARIHI, AKTARIM_NOTU) "; myCommandSubLineEx.CommandText += " select AKTARIM_DURUMU, '" + _GLOBAL_PARAMETERS._SIRKET_KODU.ToString() + "', SIPARISI_VEREN, DEPARTMAN, BELGE_TYPE, TYPE, TASLAK_FATURA_NO, NUMBER, DOC_TRACK_NR, EINVOICE, ACCOUNT_TYPE, DEFNFLD_MUSTERI_KODU, CODE, TITLE, ADDRESS1, ADDRESS2, CITY, POSTAL_CODE, TELEPHONE1, FAX, TAX_OFFICE, TAX_ID, DATE, DOC_DATE, DOC_NUMBER, AUXIL_CODE, ARP_CODE, GL_CODE, VAT_RATE, ADD_DISCOUNTS, TOTAL_DISCOUNTS, TOTAL_VAT, TOTAL_GROSS, TOTAL_NET, TOTAL_DISCOUNTED, NOTES1, NOTES2, NOTES3, NOTES4, CURR_INVOICE, TC_NET, RC_XRATE, RC_NET, TC_XRATE, CURRSEL_TOTALS, CURRSEL_DETAILS, DEFNFLD_PAZARLAMA_SIRKETI_KODU, DEFNFLD_LEVEL_, DEFNFLD_MODULENR, DEFNFLD_PLAN_KODU,DEFNFLD_MECRA_TURU, DEFNFLD_FATURA_BASKI_SEKLI, DEFNFLD_FAKTORING_SIRKETI_KODU, DEFNFLD_ILGILI_FATURA_NO, DEFNFLD_SIPARISI_VEREN, DEFNFLD_DEPARTMAN, DEFNFLD_BOLGE_KODU, DEFNFLD_ILGILI_IS_UNITESI, DEFNFLD_EFATURA_KODU, DEFNFLD_PO_DETAILS, DEFNFLD_IS_KODU, DEFNFLD_ILGILI_KISI_ADI_SOYADI, DEFNFLD_ILGILI_KISI_MAIL_ADRESI, DEFNFLD_NOTES, DEFNFLD_XML_ATTRIBUTE, PAYMENT_DATE, PAYMENT_MODULENR, PAYMENT_TRCODE, PAYMENT_TOTAL, PAYMENT_PROCDATE, PAYMENT_DISCOUNT_DUEDATE, TRCURR, TRRATE, PAYMENT_MODIFIED, PAYMENT_PAY_NO, TRNET, PAYTR_CURR, PAYTR_RATE, PAYTR_NET, GLOBAL_CODE, PAYMENT_DISCTRLIST, PAYMENT_DISCTRDELLIST, INVOICE_Id, DEDUCTIONPART1, DEDUCTIONPART2, PROJECT_CODE, AKTARIM_SORUMLUSU, AKTARIM_TARIHI, AKTARIM_NOTU from FTR_LG_INVOICE WHERE SIRKET_KODU='" + OLD_FIRMA + "' AND TASLAK_FATURA_NO='" + dr["NUMBER"].ToString() + "'"; myCommandSubLineEx.CommandText += " select ID from FTR_LG_INVOICE WHERE (TASLAK_FATURA_NO='" + dr["NUMBER"].ToString() + "')"; myCommandSubLineEx.CommandType = System.Data.CommandType.Text; myCommandSubLineEx.Connection = myConnections; myConnections.Open(); SqlDataReader myReaderSubLineEx = myCommandSubLineEx.ExecuteReader(CommandBehavior.CloseConnection); while (myReaderSubLineEx.Read()) { using (SqlConnection myConnectionTable = new SqlConnection(_GLOBAL_PARAMETERS._CONNECTIONSTRING_MDB.ToString())) { myConnectionTable.Open(); SqlCommand myCmd = new SqlCommand(); myCmd.CommandText += "INSERT INTO FTR_LG_STLINE ( SIRKET_KODU, INVOICE_REF, INVOICE_NUMBER, TASLAK_FATURA_NO, TYPE, MASTER_CODE, NAME, GL_CODE1, GL_CODE2, AUXIL_CODE, QUANTITY, PRICE, TOTAL, CURR_PRICE, PC_PRICE, CURR_TRANSACTION, TC_XRATE, DISCOUNT_DISTR, DESCRIPTION, UNIT_GLOBAL_CODE, UNIT_CODE, UNIT_CONV1, UNIT_CONV2, VAT_RATE, VAT_AMOUNT, VAT_BASE, TOTAL_NET, EDT_CURR, EDT_PRICE, PROJECT_CODE, TRANSACTION_REF, STLINE_REF, MODULENR, LEVEL_, PLAN_KODU, SEHIR, FILM_ADI, SURE, TARIH, OLCU, TARIFE, CANDEDUCT, DEDUCTIONPART1, DEDUCTION_PART2, XML_ATTRIBUTE, TRANSACTION_Id, DETAIL_LEVEL, DISCOUNT_RATE) "; myCmd.CommandText += " select '" + _GLOBAL_PARAMETERS._SIRKET_KODU.ToString() + "','" + myReaderSubLineEx["ID"] + "', INVOICE_NUMBER, TASLAK_FATURA_NO, TYPE, MASTER_CODE, NAME, GL_CODE1, GL_CODE2, AUXIL_CODE, QUANTITY, PRICE, TOTAL, CURR_PRICE, PC_PRICE, CURR_TRANSACTION, TC_XRATE, DISCOUNT_DISTR, DESCRIPTION, UNIT_GLOBAL_CODE, UNIT_CODE, UNIT_CONV1, UNIT_CONV2, VAT_RATE, VAT_AMOUNT, VAT_BASE, TOTAL_NET, EDT_CURR, EDT_PRICE, PROJECT_CODE, TRANSACTION_REF, STLINE_REF, MODULENR, LEVEL_, PLAN_KODU, SEHIR, FILM_ADI, SURE, TARIH, OLCU, TARIFE, CANDEDUCT, DEDUCTIONPART1, DEDUCTION_PART2, XML_ATTRIBUTE, TRANSACTION_Id, DETAIL_LEVEL, DISCOUNT_RATE from FTR_LG_STLINE WHERE SIRKET_KODU= '" + OLD_FIRMA + "' AND (INVOICE_NUMBER='" + dr["NUMBER"].ToString() + "') "; myCmd.Connection = myConnectionTable; myCmd.ExecuteNonQuery(); } } } } DateTime dtm = DateTime.Now; using (SqlConnection myConnections = new SqlConnection(_GLOBAL_PARAMETERS._CONNECTIONSTRING_MDB)) { myConnections.Open(); using (SqlCommand myCmd = new SqlCommand()) { myCmd.CommandText = " UPDATE dbo.FTR_LG_INVOICE SET AKTARIM_DURUMU='AKTARILDI', AKTARIM_SORUMLUSU=@AKTARIM_SORUMLUSU,AKTARIM_TARIHI=@AKTARIM_TARIHI,AKTARIM_NOTU=@AKTARIM_NOTU WHERE SIRKET_KODU=@SIRKET_KODU AND (TASLAK_FATURA_NO=@TASLAK_FATURA_NO) "; myCmd.Parameters.AddWithValue("@SIRKET_KODU", OLD_FIRMA); myCmd.Parameters.AddWithValue("@TASLAK_FATURA_NO", dr["TASLAK_FATURA_NO"]); myCmd.Parameters.AddWithValue("@AKTARIM_SORUMLUSU", _GLOBAL_PARAMETERS._KULLANICI_MAIL); myCmd.Parameters.AddWithValue("@AKTARIM_TARIHI", dtm.ToString("yyyy-MM-dd hh:mm:ss")); myCmd.Parameters.AddWithValue("@AKTARIM_NOTU", "BASARILI"); myCmd.Connection = myConnections; myCmd.ExecuteNonQuery(); } using (SqlCommand myCmd = new SqlCommand()) { myCmd.CommandText = " UPDATE dbo.FTR_LG_STLINE SET AKTARIM_DURUMU='AKTARILDI' WHERE SIRKET_KODU=@SIRKET_KODU AND (TASLAK_FATURA_NO=@TASLAK_FATURA_NO) "; myCmd.Parameters.AddWithValue("@SIRKET_KODU", OLD_FIRMA); myCmd.Parameters.AddWithValue("@TASLAK_FATURA_NO", dr["TASLAK_FATURA_NO"]); myCmd.Connection = myConnections; myCmd.ExecuteNonQuery(); } _GLOBAL_PARAMETERS.LOG_ISLEMLERI LF = new _GLOBAL_PARAMETERS.LOG_ISLEMLERI(); LF.LOG_AKTARIMI(dr["TIPI"].ToString(), dr["NUMBER"].ToString(), "KAYIT", dr["TOTAL_NET"].ToString(), dr["TITLE"].ToString(), "", dr["DEFNFLD_PLAN_KODU"].ToString(), dr["NOTES1"].ToString(), ""); myConnections.Close(); } } else { MessageBox.Show(V_RETURN); } } }