public static void fillTaxItemGridViewCombo(DataGridViewComboBoxCell cmb) { cmb.Items.Clear(); try { TaxItemDB taxitemdb = new TaxItemDB(); List <taxitem> TaxItems = taxitemdb.getTaxItems(); foreach (taxitem ti in TaxItems) { if (ti.status == 1) { cmb.Items.Add(ti.TaxItemID + "-" + ti.Description); } } } catch (Exception ex) { MessageBox.Show(System.Reflection.MethodBase.GetCurrentMethod().Name + "() : Error"); } }
public static Boolean InsertSJVHeaderAndDetail(SJVHeader jvh) { //call when invoice inward is saved //Invoice types MRN,Work Order, PO General Boolean status = true; string utString = ""; string updateSQL = ""; try { updateSQL = "Delete from SJVHeader where InvDocumentID='" + jvh.InvDocumentID + "'" + " and InvTempNo=" + jvh.InvTempNo + " and InvTempDate='" + jvh.InvTempDate.ToString("yyyy-MM-dd") + "'"; utString = utString + updateSQL + Main.QueryDelimiter; updateSQL = "Delete from SJVDetail where InvDocumentID='" + jvh.InvDocumentID + "'" + " and InvTempNo=" + jvh.InvTempNo + " and InvTempDate='" + jvh.InvTempDate.ToString("yyyy-MM-dd") + "'"; utString = utString + updateSQL + Main.QueryDelimiter; //-- updateSQL = "insert into SJVHeader " + "(DocumentID,TemporaryNo,TemporaryDate,JournalNo,JournalDate,Narration," + "InvDocumentID,InvTempNo,InvTempDate,InvReferenceNo," + "Comments,CommentStatus,CreateUser,CreateTime,ForwarderList,DocumentStatus,Status)" + " values (" + "'" + jvh.DocumentID + "'," + jvh.TemporaryNo + "," + "'" + jvh.TemporaryDate.ToString("yyyy-MM-dd") + "'," + jvh.JournalNo + "," + "'" + jvh.JournalDate.ToString("yyyy-MM-dd") + "'," + "'" + jvh.Narration + "'," + "'" + jvh.InvDocumentID + "'," + jvh.InvTempNo + "," + "'" + jvh.InvTempDate.ToString("yyyy-MM-dd") + "'," + jvh.InvReferenceNo + "," + "'" + jvh.Comments + "'," + "'" + jvh.CommentStatus + "'," + "'" + Login.userLoggedIn + "'," + "GETDATE()" + "," + "'" + jvh.ForwarderList + "'," + jvh.DocumentStatus + "," + jvh.status + ")"; utString = utString + updateSQL + Main.QueryDelimiter; //////utString = utString + //////ActivityLogDB.PrepareActivityLogQquerString("insert", "SJVHeader", "", updateSQL) + //////Main.QueryDelimiter; jvaccmapping jvAcc = AutoJVAccMappingDB.getjvaccmappingPerDocument(jvh.DocumentID, jvh.InvDocumentID); if (jvAcc.AccountCodeDebit == null || jvAcc.AccountCodeDebit.Trim().Length == 0 || jvAcc.AccountCodeCredit == null || jvAcc.AccountCodeCredit.Length == 0) { MessageBox.Show("Debit and credit account not mapped for this document.\n Failed to update sales journal."); return(false); } updateSQL = "insert into SJVDetail " + "(DocumentID,TemporaryNo,TemporaryDate,AccountCode,AmountDebit,AmountCredit,SLCode,SLType,INVDocumentID,InvTempNo,InvTempDate) " + "values ('" + jvh.DocumentID + "'," + jvh.TemporaryNo + "," + "'" + jvh.TemporaryDate.ToString("yyyy-MM-dd") + "'," + /// "'11111111110248'," +//sundry creditors // credit "'" + jvAcc.AccountCodeDebit + "'," + (jvh.Amtount) + "," + 0 + ",'" + jvh.Customer + "','Party','" + jvh.InvDocumentID + "'," + jvh.InvTempNo + "," + "'" + jvh.InvTempDate.ToString("yyyy-MM-dd") + "')"; utString = utString + updateSQL + Main.QueryDelimiter; //////utString = utString + //////ActivityLogDB.PrepareActivityLogQquerString("insert", "SJVDetail", "", updateSQL) + //////Main.QueryDelimiter; //-- updateSQL = "insert into SJVDetail " + "(DocumentID,TemporaryNo,TemporaryDate,AccountCode,AmountDebit,AmountCredit,SLCode,SLType,INVDocumentID,InvTempNo,InvTempDate) " + "values ('" + jvh.DocumentID + "'," + jvh.TemporaryNo + "," + "'" + jvh.TemporaryDate.ToString("yyyy-MM-dd") + "'," + //"'11111111110557'," + //purchase ac "'" + jvAcc.AccountCodeCredit + "'," + 0 + "," + (jvh.Amtount - jvh.TaxAmount) + ",'','','" + jvh.InvDocumentID + "'," + jvh.InvTempNo + "," + "'" + jvh.InvTempDate.ToString("yyyy-MM-dd") + "')"; utString = utString + updateSQL + Main.QueryDelimiter; //////utString = utString + //////ActivityLogDB.PrepareActivityLogQquerString("insert", "SJVDetail", "", updateSQL) + //////Main.QueryDelimiter; //Updating SJV references in INvoice out updateSQL = "update InvoiceOutHeader set SJVTNo=" + jvh.TemporaryNo + ", SJVTDate='" + jvh.TemporaryDate.ToString("yyyy-MM-dd") + "'" + ", SJVNo='" + jvh.JournalNo + "'" + ", SJVDate='" + jvh.JournalDate.ToString("yyyy-MM-dd") + "'" + " where DocumentID='" + jvh.InvDocumentID + "'" + " and TemporaryNo=" + jvh.InvTempNo + " and TemporaryDate='" + jvh.InvTempDate.ToString("yyyy-MM-dd") + "'"; utString = utString + updateSQL + Main.QueryDelimiter; ////utString = utString + ////ActivityLogDB.PrepareActivityLogQquerString("update", "JournalVoucherHeader", "", updateSQL) + ////Main.QueryDelimiter; try { TaxItemDB taxitemdb = new TaxItemDB(); List <taxitem> TaxItems = taxitemdb.getTaxItems(); string[] lst1 = jvh.TaxDetail.Split('\n'); for (int i = 0; i < lst1.Length - 1; i++) { string taxCode = "Not Found"; string[] lst2 = lst1[i].Split('-'); int ind = searchList(TaxItems, lst2[0]); if (ind >= 0) { taxCode = TaxItems[ind].AccountCodeOUT; } updateSQL = "insert into SJVDetail " + "(DocumentID,TemporaryNo,TemporaryDate,AccountCode,AmountDebit,AmountCredit,SLCode,SLType,INVDocumentID,InvTempNo,InvTempDate) " + "values ('" + jvh.DocumentID + "'," + jvh.TemporaryNo + "," + "'" + jvh.TemporaryDate.ToString("yyyy-MM-dd") + "'," + "'" + taxCode + "'," + 0 + "," + lst2[1] + ",'','','" + jvh.InvDocumentID + "'," + jvh.InvTempNo + "," + "'" + jvh.InvTempDate.ToString("yyyy-MM-dd") + "')"; utString = utString + updateSQL + Main.QueryDelimiter; } } catch (Exception ex) { MessageBox.Show("InsertSJVHeaderAndDetail() : Error creating tax entries - " + ex.ToString()); } if (!UpdateTable.UT(utString)) { status = false; } } catch (Exception ex) { status = false; MessageBox.Show("Transaction Exception Occured"); } return(status); }