Beta Release 2.1.0.4

Purchase - Vehicle/Spares Complete
This commit is contained in:
2023-05-06 12:29:34 +05:30
parent b5fc6ec85c
commit b3451c485b
14 changed files with 221 additions and 206 deletions
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+193 -178
View File
@@ -246,6 +246,12 @@ namespace TallyDataTool
procImportReceiptsToTally("CHETAK");
}
//close File
PBTallySync.Value = PBTallySync.Maximum;
pSWTallySyncLogs.Close();
MessageBox.Show("Process Complete!!", "Tally Data Tool");
Process.Start(pStrFilePath);
}
@@ -273,11 +279,11 @@ namespace TallyDataTool
pDblTotalAmount = 0;
if (TransType == "KTM")
{
oPurchase.TransactionTypeName = "Purchase - KTM";
oPurchase.TransactionTypeName = "Purchase Vehicle- KTM";
}
else
{
oPurchase.TransactionTypeName = "Purchase - CTK";
oPurchase.TransactionTypeName = "Purchase Vehicle- Chetak";
}
oPurchase.TransactionNumber = dtExcelSource.Rows[i]["DocNo"].ToString();
@@ -344,11 +350,21 @@ namespace TallyDataTool
});
pDblTotalAmount = pDblTotalAmount - double.Parse(double.Parse(dtExcelSource.Rows[i]["FAMEAmount"].ToString()).ToString("0.00"));
}
if (double.Parse(dtExcelSource.Rows[i]["IGST"].ToString()) > 0)
{
string pStrIGSTLED = "";
if (TransType == "KTM")
{
pStrIGSTLED = "IGST @28%";
}
else
{
pStrIGSTLED = "IGST @28%";
}
oLedgerDetails.Add(new TransactionLedgerDetailsModel
{
LedgerName = "IGST @28%",
LedgerName = pStrIGSTLED,
IsDeemedPositive = "YES",
IsPartyLedger = "NO",
LedgerAmount = "-" + double.Parse(dtExcelSource.Rows[i]["IGST"].ToString()).ToString()
@@ -383,15 +399,17 @@ namespace TallyDataTool
}
else if (TransType == "Chetak")
{
pStrPurLedger = "Purchase Chectak";
pStrPurLedger = "Purchase Chetak";
}
oInventoryDetails.Add(new TransactionInventoryDetailsModel
{
ItemName = drItemDetails[j]["ProductCode"].ToString(),
ItemQty = drItemDetails[j]["Qty"].ToString(),
ItemRate = drItemDetails[j]["Rate"].ToString(),
ItemAmount = drItemDetails[j]["Amount"].ToString(),
InventortyLedgerName = pStrPurLedger
ItemAmount = "-" + drItemDetails[j]["Amount"].ToString(),
InventortyLedgerName = pStrPurLedger,
IsDeemedPositive = "YES"
});
pDblINventoryTotal = pDblINventoryTotal + double.Parse(double.Parse(drItemDetails[j]["Amount"].ToString()).ToString("0.00"));
@@ -409,7 +427,7 @@ namespace TallyDataTool
LedgerName = "Round off",
IsDeemedPositive = "NO",
IsPartyLedger = "NO",
LedgerAmount = (double.Parse(pDblRoundoff.ToString()).ToString())
LedgerAmount = Math.Abs(double.Parse(pDblRoundoff.ToString())).ToString()
});
}
else
@@ -435,11 +453,11 @@ namespace TallyDataTool
if (pStrVoucherXML != "")
{
//pStrXMLResponse = oLibWebRequest.POSTWEBRequest("http://localhost:" + pStrTallyPort, pStrVoucherXML);
pStrXMLResponse = oLibTallySync.TallyVoucherSync(pStrVoucherXML, pStrTallyPort);
pStrXMLResponse = oLibTallySync.TallyVoucherSyncInventory(pStrVoucherXML, pStrTallyPort);
if (pStrXMLResponse.Contains("ERROR") == true && pStrXMLResponse.Contains("already exists!") == false)
{
pSWTallySyncLogs.WriteLine(dtExcelSource.Rows[i]["Supplier_InvoiceNo"] + "-" + pStrXMLResponse);
pSWTallySyncLogs.WriteLine(dtExcelSource.Rows[i]["docno"] + "-" + pStrXMLResponse);
}
@@ -474,7 +492,8 @@ namespace TallyDataTool
Application.DoEvents();
TransactionHeaderModel oPurchase = new TransactionHeaderModel();
List<TransactionLedgerDetailsModel> oLedgerDetails = new List<TransactionLedgerDetailsModel>();
List <TransactionInventoryDetailsModel> oInventoryDetails = new List<TransactionInventoryDetailsModel>();
pDblTotalAmount = 0;
if (TransType == "KTM")
{
@@ -482,7 +501,7 @@ namespace TallyDataTool
}
else
{
oPurchase.TransactionTypeName = "Purchase Spares- CTK";
oPurchase.TransactionTypeName = "Purchase Spares- Chetak";
}
oPurchase.TransactionNumber = dtExcelSource.Rows[i]["DocNo"].ToString();
@@ -491,9 +510,9 @@ namespace TallyDataTool
oPurchase.Narration = "";
oPurchase.VoucherMode = "Voucher";
//Party Ledger
if (double.Parse(dtExcelSource.Rows[i][""].ToString()) > 0)
if (double.Parse(dtExcelSource.Rows[i]["InvoiceAmount"].ToString()) > 0)
{
oPurchase.TransactionLedgerDetails.Add(new TransactionLedgerDetailsModel
oLedgerDetails.Add(new TransactionLedgerDetailsModel
{
LedgerName = dtExcelSource.Rows[i]["SupplierName"].ToString(),
IsDeemedPositive = "NO",
@@ -505,7 +524,7 @@ namespace TallyDataTool
//Purchase 18%
if (double.Parse(dtExcelSource.Rows[i]["Purchase18"].ToString()) > 0)
{
oPurchase.TransactionLedgerDetails.Add(new TransactionLedgerDetailsModel
oLedgerDetails.Add(new TransactionLedgerDetailsModel
{
LedgerName = "Purchase spare @18%",
IsDeemedPositive = "YES",
@@ -518,7 +537,7 @@ namespace TallyDataTool
//Purchase 28%
if (double.Parse(dtExcelSource.Rows[i]["Purchase28"].ToString()) > 0)
{
oPurchase.TransactionLedgerDetails.Add(new TransactionLedgerDetailsModel
oLedgerDetails.Add(new TransactionLedgerDetailsModel
{
LedgerName = "Purchase Spare @28%",
IsDeemedPositive = "YES",
@@ -528,10 +547,23 @@ namespace TallyDataTool
});
pDblTotalAmount = pDblTotalAmount + double.Parse(double.Parse(dtExcelSource.Rows[i]["Purchase28"].ToString()).ToString("0.00"));
}
//Purchase 5%
if (double.Parse(dtExcelSource.Rows[i]["Purchase5"].ToString()) > 0)
{
oLedgerDetails.Add(new TransactionLedgerDetailsModel
{
LedgerName = "Purchase Spare @5%",
IsDeemedPositive = "YES",
IsPartyLedger = "NO",
LedgerAmount = "-" + double.Parse(dtExcelSource.Rows[i]["Purchase5"].ToString()).ToString()
});
pDblTotalAmount = pDblTotalAmount + double.Parse(double.Parse(dtExcelSource.Rows[i]["Purchase5"].ToString()).ToString("0.00"));
}
//Disc
if (double.Parse(dtExcelSource.Rows[i]["Discount"].ToString()) > 0)
{
oPurchase.TransactionLedgerDetails.Add(new TransactionLedgerDetailsModel
oLedgerDetails.Add(new TransactionLedgerDetailsModel
{
LedgerName = "Discount",
IsDeemedPositive = "YES",
@@ -544,7 +576,7 @@ namespace TallyDataTool
//Freight Amount
if (double.Parse(dtExcelSource.Rows[i]["FreightAmount"].ToString()) > 0)
{
oPurchase.TransactionLedgerDetails.Add(new TransactionLedgerDetailsModel
oLedgerDetails.Add(new TransactionLedgerDetailsModel
{
LedgerName = "Freight Charges",
IsDeemedPositive = "YES",
@@ -555,21 +587,10 @@ namespace TallyDataTool
pDblTotalAmount = pDblTotalAmount + double.Parse(double.Parse(dtExcelSource.Rows[i]["FreightAmount"].ToString()).ToString("0.00"));
}
//
if (double.Parse(dtExcelSource.Rows[i]["FAMEAmount"].ToString()) > 0)
{
oPurchase.TransactionLedgerDetails.Add(new TransactionLedgerDetailsModel
{
LedgerName = "FAME Subsidy",
IsDeemedPositive = "YES",
IsPartyLedger = "NO",
LedgerAmount = double.Parse(dtExcelSource.Rows[i]["FAMEAmount"].ToString()).ToString()
});
pDblTotalAmount = pDblTotalAmount - double.Parse(double.Parse(dtExcelSource.Rows[i]["FAMEAmount"].ToString()).ToString("0.00"));
}
if (double.Parse(dtExcelSource.Rows[i]["IGST28"].ToString()) > 0)
{
oPurchase.TransactionLedgerDetails.Add(new TransactionLedgerDetailsModel
oLedgerDetails.Add(new TransactionLedgerDetailsModel
{
LedgerName = "IGST @28%",
IsDeemedPositive = "YES",
@@ -582,7 +603,7 @@ namespace TallyDataTool
if (double.Parse(dtExcelSource.Rows[i]["IGST18"].ToString()) > 0)
{
oPurchase.TransactionLedgerDetails.Add(new TransactionLedgerDetailsModel
oLedgerDetails.Add(new TransactionLedgerDetailsModel
{
LedgerName = "IGST @18%",
IsDeemedPositive = "YES",
@@ -593,6 +614,19 @@ namespace TallyDataTool
pDblTotalAmount = pDblTotalAmount + double.Parse(double.Parse(dtExcelSource.Rows[i]["IGST18"].ToString()).ToString("0.00"));
}
if (double.Parse(dtExcelSource.Rows[i]["IGST5"].ToString()) > 0)
{
oLedgerDetails.Add(new TransactionLedgerDetailsModel
{
LedgerName = "IGST @5%",
IsDeemedPositive = "YES",
IsPartyLedger = "NO",
LedgerAmount = "-" + double.Parse(dtExcelSource.Rows[i]["IGST5"].ToString()).ToString()
});
pDblTotalAmount = pDblTotalAmount + double.Parse(double.Parse(dtExcelSource.Rows[i]["IGST5"].ToString()).ToString("0.00"));
}
//Round off
@@ -601,50 +635,46 @@ namespace TallyDataTool
{
if (pDblRoundoff < 0)
{
oPurchase.TransactionLedgerDetails.Add(new TransactionLedgerDetailsModel
oLedgerDetails.Add(new TransactionLedgerDetailsModel
{
LedgerName = "Round off",
IsDeemedPositive = "NO",
IsPartyLedger = "NO",
LedgerAmount = (double.Parse(dtExcelSource.Rows[i]["Cess"].ToString()).ToString())
LedgerAmount = Math.Abs(double.Parse(pDblRoundoff.ToString())).ToString()
});
}
else
{
oPurchase.TransactionLedgerDetails.Add(new TransactionLedgerDetailsModel
oLedgerDetails.Add(new TransactionLedgerDetailsModel
{
LedgerName = "Round off",
IsDeemedPositive = "YES",
IsPartyLedger = "NO",
LedgerAmount = "-" + Math.Abs(double.Parse(dtExcelSource.Rows[i]["Cess"].ToString()))
LedgerAmount = "-" + Math.Abs(double.Parse(pDblRoundoff.ToString()))
});
}
}
oPurchase.TransactionLedgerDetails = oLedgerDetails;
oPurchase.TransactionInventoryDetails = oInventoryDetails;
//pStrVoucherXML = oLibTallyXML.TallyPurchaseInvoiceR3XMLV3(pStrVoucherHeader, pStrVoucherBody, pStrInventoryXML);
pStrVoucherXML = JsonConvert.SerializeObject(oPurchase);
if (pStrVoucherXML != "")
{
pStrXMLResponse = oLibWebRequest.POSTWEBRequest("http://localhost:" + pStrTallyPort, pStrVoucherXML);
pStrXMLResponse = oLibTallySync.TallyVoucherSyncBasic(pStrVoucherXML, pStrTallyPort);
if (pStrXMLResponse.Contains("ERROR") == true && pStrXMLResponse.Contains("already exists!") == false)
if (pStrXMLResponse.Contains("<ERRORS>1</ERRORS>") == true && pStrXMLResponse.Contains("already exists!") == false)
{
pSWTallySyncLogs.WriteLine(dtExcelSource.Rows[i]["Supplier_InvoiceNo"] + "-" + pStrXMLResponse);
pSWTallySyncLogs.WriteLine(dtExcelSource.Rows[i]["docno"] + "-" + pStrXMLResponse);
}
/*
if (pStrXMLResponse.ToString().Contains("<ERRORS>1</ERRORS>") == true)
{
pSWTallySyncLogs.WriteLine(pStrVoucherXML);
}
*/
pDblTotalAmount = 0;
}
}
@@ -673,7 +703,7 @@ namespace TallyDataTool
string pStrDataCols = "DocNo;DocDate;SupplierName;Discount;FreightAmount;FAMEAmount;IGST;Cess;InvoiceAmount";
dtExcelSource = oLibDbCommon.CreateTable(pStrDataCols);
pStrDataCols = "DocNo;ProductCode;Rate;Qty;Amount";
pStrDataCols = "DocNo;ProductCode;Qty;Rate;Amount";
dtPurchaseDetails = oLibDbCommon.CreateTable(pStrDataCols);
for (i = 0; i <= dtExcelData.Rows.Count - 1; i++)
@@ -733,7 +763,15 @@ namespace TallyDataTool
decimal pDecItemAmount = Convert.ToDecimal(string.IsNullOrEmpty(dtExcelData.Rows[i]["Rate"].ToString()) ? "0" : dtExcelData.Rows[i]["Rate"].ToString()); //- (Convert.ToDecimal(string.IsNullOrEmpty(dtExcelData.Rows[i][21].ToString()) ? "0" : dtExcelData.Rows[i][21].ToString()) + Convert.ToDecimal(string.IsNullOrEmpty(dtExcelData.Rows[i][22].ToString()) ? "0" : dtExcelData.Rows[i][22].ToString()));
pStrData = pStrInvNo;
if (dtExcelData.Columns.Contains("Vehicle Code"))
{
pStrData = pStrData + "|" + dtExcelData.Rows[i]["Vehicle Code"].ToString();
}
else
{
pStrData = pStrData + "|" + dtExcelData.Rows[i]["Model"].ToString();
}
pStrData = pStrData + "|" + "1";
pStrData = pStrData + "|" + pDecItemAmount;
pStrData = pStrData + "|" + pDecItemAmount;
@@ -819,6 +857,8 @@ namespace TallyDataTool
Application.DoEvents();
TransactionHeaderModel oPurchase = new TransactionHeaderModel();
List<TransactionLedgerDetailsModel> oLedgerDetails = new List<TransactionLedgerDetailsModel>();
List<TransactionInventoryDetailsModel> oInventoryDetails = new List<TransactionInventoryDetailsModel>();
pDblTotalAmount = 0;
if (TransType == "KTM")
@@ -827,7 +867,7 @@ namespace TallyDataTool
}
else
{
oPurchase.TransactionTypeName = "Sales - CTK";
oPurchase.TransactionTypeName = "Sales - Chetak";
}
oPurchase.TransactionNumber = dtExcelSource.Rows[i]["DocNo"].ToString();
@@ -838,7 +878,7 @@ namespace TallyDataTool
//Party Ledger
if (double.Parse(dtExcelSource.Rows[i][""].ToString()) > 0)
{
oPurchase.TransactionLedgerDetails.Add(new TransactionLedgerDetailsModel
oLedgerDetails.Add(new TransactionLedgerDetailsModel
{
LedgerName = dtExcelSource.Rows[i]["Customer_Name"].ToString(),
IsDeemedPositive = "YES",
@@ -851,7 +891,7 @@ namespace TallyDataTool
//
if (double.Parse(dtExcelSource.Rows[i]["FAMEAmount"].ToString()) > 0)
{
oPurchase.TransactionLedgerDetails.Add(new TransactionLedgerDetailsModel
oLedgerDetails.Add(new TransactionLedgerDetailsModel
{
LedgerName = "FAME Subsidy",
IsDeemedPositive = "NO",
@@ -863,7 +903,7 @@ namespace TallyDataTool
}
if (double.Parse(dtExcelSource.Rows[i]["Sales_CGST14"].ToString()) > 0)
{
oPurchase.TransactionLedgerDetails.Add(new TransactionLedgerDetailsModel
oLedgerDetails.Add(new TransactionLedgerDetailsModel
{
LedgerName = "CGST @14%",
IsDeemedPositive = "NO",
@@ -876,7 +916,7 @@ namespace TallyDataTool
if (double.Parse(dtExcelSource.Rows[i]["Sales_SGST14"].ToString()) > 0)
{
oPurchase.TransactionLedgerDetails.Add(new TransactionLedgerDetailsModel
oLedgerDetails.Add(new TransactionLedgerDetailsModel
{
LedgerName = "SGST @14%",
IsDeemedPositive = "NO",
@@ -890,7 +930,7 @@ namespace TallyDataTool
if (double.Parse(dtExcelSource.Rows[i]["Sales_CGST9"].ToString()) > 0)
{
oPurchase.TransactionLedgerDetails.Add(new TransactionLedgerDetailsModel
oLedgerDetails.Add(new TransactionLedgerDetailsModel
{
LedgerName = "SGST @2.5%",
IsDeemedPositive = "NO",
@@ -904,7 +944,7 @@ namespace TallyDataTool
if (double.Parse(dtExcelSource.Rows[i]["Sales_SGST9"].ToString()) > 0)
{
oPurchase.TransactionLedgerDetails.Add(new TransactionLedgerDetailsModel
oLedgerDetails.Add(new TransactionLedgerDetailsModel
{
LedgerName = "SGST @2.5%",
IsDeemedPositive = "NO",
@@ -932,13 +972,15 @@ namespace TallyDataTool
pStrInvLedgerName = "Sales Chetak";
}
oPurchase.TransactionInventoryDetails.Add(new TransactionInventoryDetailsModel
oInventoryDetails.Add(new TransactionInventoryDetailsModel
{
ItemName = drItemDetails[j]["ProductCode"].ToString(),
ItemQty = drItemDetails[j]["ProductQty"].ToString(),
ItemRate = drItemDetails[j]["ProductRate"].ToString(),
ItemAmount = drItemDetails[j]["ProductAmount"].ToString(),
InventortyLedgerName = pStrInvLedgerName
InventortyLedgerName = pStrInvLedgerName,
IsDeemedPositive = "No"
});
pDblINventoryTotal = pDblINventoryTotal + double.Parse(double.Parse(drItemDetails[j]["ProductAmount"].ToString()).ToString("0.00"));
@@ -951,18 +993,18 @@ namespace TallyDataTool
{
if (pDblRoundoff > 0)
{
oPurchase.TransactionLedgerDetails.Add(new TransactionLedgerDetailsModel
oLedgerDetails.Add(new TransactionLedgerDetailsModel
{
LedgerName = "Round off",
IsDeemedPositive = "NO",
IsPartyLedger = "NO",
LedgerAmount = (double.Parse(pDblRoundoff.ToString()).ToString())
LedgerAmount = Math.Abs(double.Parse(pDblRoundoff.ToString())).ToString()
});
}
else
{
oPurchase.TransactionLedgerDetails.Add(new TransactionLedgerDetailsModel
oLedgerDetails.Add(new TransactionLedgerDetailsModel
{
LedgerName = "Round off",
IsDeemedPositive = "YES",
@@ -974,27 +1016,22 @@ namespace TallyDataTool
}
}
oPurchase.TransactionLedgerDetails = oLedgerDetails;
oPurchase.TransactionInventoryDetails = oInventoryDetails;
//pStrVoucherXML = oLibTallyXML.TallyPurchaseInvoiceR3XMLV3(pStrVoucherHeader, pStrVoucherBody, pStrInventoryXML);
pStrVoucherXML = JsonConvert.SerializeObject(oPurchase);
if (pStrVoucherXML != "")
{
pStrXMLResponse = oLibWebRequest.POSTWEBRequest("http://localhost:" + pStrTallyPort, pStrVoucherXML);
pStrXMLResponse = oLibTallySync.TallyVoucherSyncBasic(pStrVoucherXML, pStrTallyPort);
if (pStrXMLResponse.Contains("ERROR") == true && pStrXMLResponse.Contains("already exists!") == false)
{
pSWTallySyncLogs.WriteLine(dtExcelSource.Rows[i]["Supplier_InvoiceNo"] + "-" + pStrXMLResponse);
pSWTallySyncLogs.WriteLine(dtExcelSource.Rows[i]["docno"] + "-" + pStrXMLResponse);
}
/*
if (pStrXMLResponse.ToString().Contains("<ERRORS>1</ERRORS>") == true)
{
pSWTallySyncLogs.WriteLine(pStrVoucherXML);
}
*/
pDblTotalAmount = 0;
}
}
@@ -1020,6 +1057,8 @@ namespace TallyDataTool
Application.DoEvents();
TransactionHeaderModel oPurchase = new TransactionHeaderModel();
List<TransactionLedgerDetailsModel> oLedgerDetails = new List<TransactionLedgerDetailsModel>();
List<TransactionInventoryDetailsModel> oInventoryDetails = new List<TransactionInventoryDetailsModel>();
pDblTotalAmount = 0;
if (TransType == "KTM")
@@ -1039,7 +1078,7 @@ namespace TallyDataTool
//Party Ledger
if (double.Parse(dtExcelSource.Rows[i]["Sale_TotalAmount"].ToString()) > 0)
{
oPurchase.TransactionLedgerDetails.Add(new TransactionLedgerDetailsModel
oLedgerDetails.Add(new TransactionLedgerDetailsModel
{
LedgerName = dtExcelSource.Rows[i]["Customer_Name"].ToString(),
IsDeemedPositive = "YES",
@@ -1053,7 +1092,7 @@ namespace TallyDataTool
if (double.Parse(dtExcelSource.Rows[i]["Sales14Amount"].ToString()) > 0)
{
oPurchase.TransactionLedgerDetails.Add(new TransactionLedgerDetailsModel
oLedgerDetails.Add(new TransactionLedgerDetailsModel
{
LedgerName = "Sales Spares @14%",
IsDeemedPositive = "NO",
@@ -1066,7 +1105,7 @@ namespace TallyDataTool
if (double.Parse(dtExcelSource.Rows[i]["Sales9Amount"].ToString()) > 0)
{
oPurchase.TransactionLedgerDetails.Add(new TransactionLedgerDetailsModel
oLedgerDetails.Add(new TransactionLedgerDetailsModel
{
LedgerName = "Sales Spares @9%",
IsDeemedPositive = "NO",
@@ -1080,7 +1119,7 @@ namespace TallyDataTool
if (double.Parse(dtExcelSource.Rows[i]["Sales_CGST14"].ToString()) > 0)
{
oPurchase.TransactionLedgerDetails.Add(new TransactionLedgerDetailsModel
oLedgerDetails.Add(new TransactionLedgerDetailsModel
{
LedgerName = "SGST @14%",
IsDeemedPositive = "NO",
@@ -1091,7 +1130,7 @@ namespace TallyDataTool
pDblTotalAmount = pDblTotalAmount + double.Parse(double.Parse(dtExcelSource.Rows[i]["Sales_SGST14"].ToString()).ToString("0.00"));
oPurchase.TransactionLedgerDetails.Add(new TransactionLedgerDetailsModel
oLedgerDetails.Add(new TransactionLedgerDetailsModel
{
LedgerName = "CGST @14%",
IsDeemedPositive = "NO",
@@ -1105,7 +1144,7 @@ namespace TallyDataTool
if (double.Parse(dtExcelSource.Rows[i]["Sales_CGST9"].ToString()) > 0)
{
oPurchase.TransactionLedgerDetails.Add(new TransactionLedgerDetailsModel
oLedgerDetails.Add(new TransactionLedgerDetailsModel
{
LedgerName = "SGST @9%",
IsDeemedPositive = "NO",
@@ -1115,7 +1154,7 @@ namespace TallyDataTool
});
pDblTotalAmount = pDblTotalAmount + double.Parse(double.Parse(dtExcelSource.Rows[i]["Sales_SGST9"].ToString()).ToString("0.00"));
oPurchase.TransactionLedgerDetails.Add(new TransactionLedgerDetailsModel
oLedgerDetails.Add(new TransactionLedgerDetailsModel
{
LedgerName = "CGST @9%",
IsDeemedPositive = "NO",
@@ -1134,7 +1173,7 @@ namespace TallyDataTool
{
if (pDblRoundoff > 0)
{
oPurchase.TransactionLedgerDetails.Add(new TransactionLedgerDetailsModel
oLedgerDetails.Add(new TransactionLedgerDetailsModel
{
LedgerName = "Round off",
IsDeemedPositive = "NO",
@@ -1145,7 +1184,7 @@ namespace TallyDataTool
}
else
{
oPurchase.TransactionLedgerDetails.Add(new TransactionLedgerDetailsModel
oLedgerDetails.Add(new TransactionLedgerDetailsModel
{
LedgerName = "Round off",
IsDeemedPositive = "YES",
@@ -1158,26 +1197,22 @@ namespace TallyDataTool
}
oPurchase.TransactionLedgerDetails = oLedgerDetails;
oPurchase.TransactionInventoryDetails = oInventoryDetails;
//pStrVoucherXML = oLibTallyXML.TallyPurchaseInvoiceR3XMLV3(pStrVoucherHeader, pStrVoucherBody, pStrInventoryXML);
pStrVoucherXML = JsonConvert.SerializeObject(oPurchase);
if (pStrVoucherXML != "")
{
pStrXMLResponse = oLibWebRequest.POSTWEBRequest("http://localhost:" + pStrTallyPort, pStrVoucherXML);
pStrXMLResponse = oLibTallySync.TallyVoucherSyncBasic(pStrVoucherXML, pStrTallyPort);
if (pStrXMLResponse.Contains("ERROR") == true && pStrXMLResponse.Contains("already exists!") == false)
{
pSWTallySyncLogs.WriteLine(dtExcelSource.Rows[i]["Supplier_InvoiceNo"] + "-" + pStrXMLResponse);
pSWTallySyncLogs.WriteLine(dtExcelSource.Rows[i]["docno"] + "-" + pStrXMLResponse);
}
/*
if (pStrXMLResponse.ToString().Contains("<ERRORS>1</ERRORS>") == true)
{
pSWTallySyncLogs.WriteLine(pStrVoucherXML);
}
*/
pDblTotalAmount = 0;
}
}
@@ -1204,6 +1239,8 @@ namespace TallyDataTool
Application.DoEvents();
TransactionHeaderModel oPurchase = new TransactionHeaderModel();
List<TransactionLedgerDetailsModel> oLedgerDetails = new List<TransactionLedgerDetailsModel>();
List<TransactionInventoryDetailsModel> oInventoryDetails = new List<TransactionInventoryDetailsModel>();
pDblTotalAmount = 0;
if (TransType == "KTM")
@@ -1212,7 +1249,7 @@ namespace TallyDataTool
}
else
{
oPurchase.TransactionTypeName = "Sales Service - CTK";
oPurchase.TransactionTypeName = "Sales Service - Chetak";
}
oPurchase.TransactionNumber = dtExcelSource.Rows[i]["DocNo"].ToString();
@@ -1225,7 +1262,7 @@ namespace TallyDataTool
if (double.Parse(dtExcelSource.Rows[i]["Sales14Amount"].ToString()) > 0)
{
oPurchase.TransactionLedgerDetails.Add(new TransactionLedgerDetailsModel
oLedgerDetails.Add(new TransactionLedgerDetailsModel
{
LedgerName = "Sales Spares @14%",
IsDeemedPositive = "NO",
@@ -1238,7 +1275,7 @@ namespace TallyDataTool
if (double.Parse(dtExcelSource.Rows[i]["Sales9Amount"].ToString()) > 0)
{
oPurchase.TransactionLedgerDetails.Add(new TransactionLedgerDetailsModel
oLedgerDetails.Add(new TransactionLedgerDetailsModel
{
LedgerName = "Sales Spares @9%",
IsDeemedPositive = "NO",
@@ -1252,7 +1289,7 @@ namespace TallyDataTool
if (double.Parse(dtExcelSource.Rows[i]["Sales_CGST14"].ToString()) > 0)
{
oPurchase.TransactionLedgerDetails.Add(new TransactionLedgerDetailsModel
oLedgerDetails.Add(new TransactionLedgerDetailsModel
{
LedgerName = "SGST @14%",
IsDeemedPositive = "NO",
@@ -1263,7 +1300,7 @@ namespace TallyDataTool
pDblTotalAmount = pDblTotalAmount + double.Parse(double.Parse(dtExcelSource.Rows[i]["Sales_SGST14"].ToString()).ToString("0.00"));
oPurchase.TransactionLedgerDetails.Add(new TransactionLedgerDetailsModel
oLedgerDetails.Add(new TransactionLedgerDetailsModel
{
LedgerName = "CGST @14%",
IsDeemedPositive = "NO",
@@ -1277,7 +1314,7 @@ namespace TallyDataTool
if (double.Parse(dtExcelSource.Rows[i]["Sales_CGST9"].ToString()) > 0)
{
oPurchase.TransactionLedgerDetails.Add(new TransactionLedgerDetailsModel
oLedgerDetails.Add(new TransactionLedgerDetailsModel
{
LedgerName = "SGST @9%",
IsDeemedPositive = "NO",
@@ -1287,7 +1324,7 @@ namespace TallyDataTool
});
pDblTotalAmount = pDblTotalAmount + double.Parse(double.Parse(dtExcelSource.Rows[i]["Sales_SGST9"].ToString()).ToString("0.00"));
oPurchase.TransactionLedgerDetails.Add(new TransactionLedgerDetailsModel
oLedgerDetails.Add(new TransactionLedgerDetailsModel
{
LedgerName = "CGST @9%",
IsDeemedPositive = "NO",
@@ -1305,7 +1342,7 @@ namespace TallyDataTool
{
if (pDblRoundoff > 0)
{
oPurchase.TransactionLedgerDetails.Add(new TransactionLedgerDetailsModel
oLedgerDetails.Add(new TransactionLedgerDetailsModel
{
LedgerName = "Round off",
IsDeemedPositive = "NO",
@@ -1316,7 +1353,7 @@ namespace TallyDataTool
}
else
{
oPurchase.TransactionLedgerDetails.Add(new TransactionLedgerDetailsModel
oLedgerDetails.Add(new TransactionLedgerDetailsModel
{
LedgerName = "Round off",
IsDeemedPositive = "YES",
@@ -1329,28 +1366,26 @@ namespace TallyDataTool
}
oPurchase.TransactionLedgerDetails = oLedgerDetails;
oPurchase.TransactionInventoryDetails = oInventoryDetails;
//pStrVoucherXML = oLibTallyXML.TallyPurchaseInvoiceR3XMLV3(pStrVoucherHeader, pStrVoucherBody, pStrInventoryXML);
pStrVoucherXML = JsonConvert.SerializeObject(oPurchase);
if (pStrVoucherXML != "")
{
pStrXMLResponse = oLibWebRequest.POSTWEBRequest("http://localhost:" + pStrTallyPort, pStrVoucherXML);
pStrXMLResponse = oLibTallySync.TallyVoucherSyncBasic(pStrVoucherXML, pStrTallyPort);
if (pStrXMLResponse.Contains("ERROR") == true && pStrXMLResponse.Contains("already exists!") == false)
{
pSWTallySyncLogs.WriteLine(dtExcelSource.Rows[i]["Supplier_InvoiceNo"] + "-" + pStrXMLResponse);
pSWTallySyncLogs.WriteLine(dtExcelSource.Rows[i]["docno"] + "-" + pStrXMLResponse);
}
/*
if (pStrXMLResponse.ToString().Contains("<ERRORS>1</ERRORS>") == true)
{
pSWTallySyncLogs.WriteLine(pStrVoucherXML);
}
*/
pDblTotalAmount = 0;
}
}
}
@@ -1373,6 +1408,11 @@ namespace TallyDataTool
Application.DoEvents();
TransactionHeaderModel oPurchase = new TransactionHeaderModel();
List<TransactionLedgerDetailsModel> oLedgerDetails = new List<TransactionLedgerDetailsModel>();
List<TransactionInventoryDetailsModel> oInventoryDetails = new List<TransactionInventoryDetailsModel>();
//DocNo;DocDate;BankAccount;CustomerAccount;Narration;DocAmount
if (TransType == "KTM")
@@ -1381,7 +1421,7 @@ namespace TallyDataTool
}
else
{
oPurchase.TransactionTypeName = "Receipt- CTK";
oPurchase.TransactionTypeName = "Receipt- Chetak";
}
oPurchase.TransactionNumber = dtExcelSource.Rows[i]["DocNo"].ToString();
@@ -1391,7 +1431,7 @@ namespace TallyDataTool
oPurchase.VoucherMode = "Voucher";
//Party Ledger
oPurchase.TransactionLedgerDetails.Add(new TransactionLedgerDetailsModel
oLedgerDetails.Add(new TransactionLedgerDetailsModel
{
LedgerName = dtExcelSource.Rows[i]["CustomerAccount"].ToString(),
IsDeemedPositive = "NO",
@@ -1402,7 +1442,7 @@ namespace TallyDataTool
//
oPurchase.TransactionLedgerDetails.Add(new TransactionLedgerDetailsModel
oLedgerDetails.Add(new TransactionLedgerDetailsModel
{
LedgerName = "Bank A/c",
IsDeemedPositive = "YES",
@@ -1412,26 +1452,18 @@ namespace TallyDataTool
});
//pStrVoucherXML = oLibTallyXML.TallyPurchaseInvoiceR3XMLV3(pStrVoucherHeader, pStrVoucherBody, pStrInventoryXML);
pStrVoucherXML = JsonConvert.SerializeObject(oPurchase);
if (pStrVoucherXML != "")
{
pStrXMLResponse = oLibWebRequest.POSTWEBRequest("http://localhost:" + pStrTallyPort, pStrVoucherXML);
pStrXMLResponse = oLibTallySync.TallyVoucherSyncBasic(pStrVoucherXML, pStrTallyPort);
if (pStrXMLResponse.Contains("ERROR") == true && pStrXMLResponse.Contains("already exists!") == false)
{
pSWTallySyncLogs.WriteLine(dtExcelSource.Rows[i]["Supplier_InvoiceNo"] + "-" + pStrXMLResponse);
pSWTallySyncLogs.WriteLine(dtExcelSource.Rows[i]["docno"] + "-" + pStrXMLResponse);
}
/*
if (pStrXMLResponse.ToString().Contains("<ERRORS>1</ERRORS>") == true)
{
pSWTallySyncLogs.WriteLine(pStrVoucherXML);
}
*/
}
}
}
@@ -1448,17 +1480,19 @@ namespace TallyDataTool
decimal pDecTotalAmount = 0,
pDecTotalIGST28 = 0,
pDecTotalIGST18 = 0,
pDecTotalIGST5=0,
pDecTotalPurchase18 = 0,
pDecTotalPurchase28 = 0,
pDecTotalPurchase5 = 0,
pDecTotalInBillDisc = 0,
pDecTotalFAMEAmt = 0,
pDecTotalDbMargin = 0;
int pIntErrorStatus = 0;
// 1 2 3 4 5 6 7 8 9 10 11 12 13
string pStrDataCols = "DocNo;DocDate;SupplierName;Discount;FreightAmount;Purchase18;Purchase28;IGST18;IGST28;InvoiceAmount";
string pStrDataCols = "DocNo;DocDate;SupplierName;Discount;FreightAmount;Purchase18;Purchase28;Purchase5;IGST18;IGST28;IGST5;InvoiceAmount";
dtExcelSource = oLibDbCommon.CreateTable(pStrDataCols);
@@ -1469,46 +1503,59 @@ namespace TallyDataTool
if (dtExcelData.Rows[i][0] == null || dtExcelData.Rows[i][0].ToString() == "")
{
pDecTotalAmount = pDecTotalAmount + pDecTotalPurchase18 + pDecTotalPurchase28 + pDecTotalIGST18 + pDecTotalIGST28 + pDecTotalDbMargin + pDecTotalFAMEAmt - (pDecTotalInBillDisc);
if (pIntErrorStatus == 0)
{
pDecTotalAmount = pDecTotalAmount + pDecTotalPurchase18 + pDecTotalPurchase28 + pDecTotalPurchase5+ pDecTotalIGST18 + pDecTotalIGST28 + pDecTotalIGST5 + pDecTotalDbMargin + pDecTotalFAMEAmt - (pDecTotalInBillDisc);
pStrData = pStrInvNo;
pStrData = pStrData + "|" + pStrInvDate;
pStrData = pStrData + "|" + pStrCustomerName;
pStrData = pStrData + "|" + pDecTotalInBillDisc.ToString();
pStrData = pStrData + "|" + pDecTotalDbMargin;
pStrData = pStrData + "|" + pDecTotalFAMEAmt;
pStrData = pStrData + "|" + pDecTotalPurchase18;
pStrData = pStrData + "|" + pDecTotalPurchase28;
pStrData = pStrData + "|" + pDecTotalPurchase5;
pStrData = pStrData + "|" + pDecTotalIGST18.ToString();
pStrData = pStrData + "|" + pDecTotalIGST28.ToString();
pStrData = pStrData + "|" + pDecTotalIGST5.ToString();
pStrData = pStrData + "|" + Math.Round(pDecTotalAmount, 0);
oLibDbCommon.AddRowToDataTable(dtExcelSource, pStrData);
}
break;
}
if (pStrInvNo != "" && pStrInvNo != dtExcelData.Rows[i][20].ToString())
if (pStrInvNo != "" && pStrInvNo != dtExcelData.Rows[i]["Supplier Invoice No"].ToString())
{
pDecTotalAmount = pDecTotalAmount + pDecTotalPurchase18 + pDecTotalPurchase28 + pDecTotalIGST18 + pDecTotalIGST28 + pDecTotalDbMargin + pDecTotalFAMEAmt - (pDecTotalInBillDisc);
if (pIntErrorStatus == 0)
{
pDecTotalAmount = pDecTotalAmount + pDecTotalPurchase18 + pDecTotalPurchase28 + pDecTotalPurchase5 + pDecTotalIGST18 + pDecTotalIGST28 + pDecTotalIGST5 + pDecTotalDbMargin + pDecTotalFAMEAmt - (pDecTotalInBillDisc);
pStrData = pStrInvNo;
pStrData = pStrData + "|" + pStrInvDate;
pStrData = pStrData + "|" + pStrCustomerName;
pStrData = pStrData + "|" + pDecTotalInBillDisc.ToString();
pStrData = pStrData + "|" + pDecTotalDbMargin;
pStrData = pStrData + "|" + pDecTotalFAMEAmt;
pStrData = pStrData + "|" + pDecTotalPurchase18;
pStrData = pStrData + "|" + pDecTotalPurchase28;
pStrData = pStrData + "|" + pDecTotalPurchase5;
pStrData = pStrData + "|" + pDecTotalIGST18.ToString();
pStrData = pStrData + "|" + pDecTotalIGST28.ToString();
pStrData = pStrData + "|" + pDecTotalIGST5.ToString();
pStrData = pStrData + "|" + Math.Round(pDecTotalAmount, 0);
oLibDbCommon.AddRowToDataTable(dtExcelSource, pStrData);
}
pIntErrorStatus = 0;
pDecTotalAmount = 0;
pDecTotalIGST18 = 0;
pDecTotalIGST28 = 0;
pDecTotalIGST5 = 0;
pDecTotalPurchase18 = 0;
pDecTotalPurchase28 = 0;
pDecTotalPurchase5 = 0;
pDecTotalInBillDisc = 0;
pDecTotalDbMargin = 0;
@@ -1521,74 +1568,42 @@ namespace TallyDataTool
pStrCustomerName = dtExcelData.Rows[i]["Supplier"].ToString();
decimal pDecItemAmount = Convert.ToDecimal(string.IsNullOrEmpty(dtExcelData.Rows[i]["Amount"].ToString()) ? "0" : dtExcelData.Rows[i]["Amount"].ToString());
decimal pdecItemGST = Convert.ToDecimal(string.IsNullOrEmpty(dtExcelData.Rows[i]["IGST"].ToString()) ? "0" : dtExcelData.Rows[i]["IGST"].ToString());
decimal pDecGSTPer = Math.Round(pdecItemGST / pDecItemAmount, 2);
decimal pDecItemAmount = Convert.ToDecimal(string.IsNullOrEmpty(dtExcelData.Rows[i]["Total Amount"].ToString()) ? "0" : dtExcelData.Rows[i]["Total Amount"].ToString());
decimal pdecItemBasic = Convert.ToDecimal(string.IsNullOrEmpty(dtExcelData.Rows[i]["Amount"].ToString()) ? "0" : dtExcelData.Rows[i]["Amount"].ToString());
decimal pdecItemGST = pDecItemAmount - pdecItemBasic;
decimal pDecGSTPer = Math.Round(pdecItemGST / pdecItemBasic, 2);
//Discount
if (dtExcelData.Columns.Contains("Discount") == true)
{
if (decimal.Parse(string.IsNullOrEmpty(dtExcelData.Rows[i]["Discount"].ToString()) ? "0" : dtExcelData.Rows[i]["Discount"].ToString()) > 0)
{
pDecTotalInBillDisc = pDecTotalInBillDisc + decimal.Parse(dtExcelData.Rows[i]["Discount"].ToString());
}
}
//DB Margin = Freight
if (dtExcelData.Columns.Contains("Freight Amount") == true)
{
if (decimal.Parse(string.IsNullOrEmpty(dtExcelData.Rows[i]["Freight Amount"].ToString()) ? "0" : dtExcelData.Rows[i]["Freight Amount"].ToString()) > 0)
{
pDecTotalDbMargin = pDecTotalDbMargin + decimal.Parse(dtExcelData.Rows[i]["Freight Amount"].ToString());
}
}
if (dtExcelData.Columns.Contains("CESS") == true)
{
if (Convert.ToDecimal(dtExcelData.Rows[i]["CESS"] = string.IsNullOrEmpty(dtExcelData.Rows[i]["CESS"].ToString()) ? "0" : dtExcelData.Rows[i]["CESS"].ToString()) > 0)
{
pDecTotalIGST18 = pDecTotalIGST18 + Convert.ToDecimal(string.IsNullOrEmpty(dtExcelData.Rows[i]["CESS"].ToString()) ? "0" : dtExcelData.Rows[i]["CESS"].ToString());
//pDecTotalAmount = pDecTotalAmount +Convert.ToDecimal(string.IsNullOrEmpty(dtExcelData.Rows[i][35].ToString()) ? "0" : dtExcelData.Rows[i][35].ToString());
}
}
if (pDecGSTPer == decimal.Parse("0.18"))
{
if (dtExcelData.Columns.Contains("IGST") == true)
{
pDecTotalIGST18 = pDecTotalIGST18 + pdecItemGST;
pDecTotalPurchase18 = pDecTotalPurchase18 + pdecItemBasic;
if (Convert.ToDecimal(dtExcelData.Rows[i]["IGST"] = string.IsNullOrEmpty(dtExcelData.Rows[i]["IGST"].ToString()) ? "0" : dtExcelData.Rows[i]["IGST"].ToString()) > 0)
{
pDecTotalIGST18 = pDecTotalIGST18 + Convert.ToDecimal(string.IsNullOrEmpty(dtExcelData.Rows[i]["IGST"].ToString()) ? "0" : dtExcelData.Rows[i]["IGST"].ToString());
pDecTotalPurchase18 = pDecTotalPurchase18 + Convert.ToDecimal(string.IsNullOrEmpty(dtExcelData.Rows[i]["Amount"].ToString()) ? "0" : dtExcelData.Rows[i]["Amount"].ToString());
}
}
}
else if (pDecGSTPer == decimal.Parse("0.28"))
{
if (dtExcelData.Columns.Contains("IGST") == true)
pDecTotalIGST28 = pDecTotalIGST28 + pdecItemGST;
pDecTotalPurchase28 = pDecTotalPurchase28 + pdecItemBasic;
}
else if (pDecGSTPer == decimal.Parse("0.05"))
{
pDecTotalIGST5 = pDecTotalIGST5 + pdecItemGST;
pDecTotalPurchase5 = pDecTotalPurchase5 + pdecItemBasic;
if (Convert.ToDecimal(dtExcelData.Rows[i]["IGST"] = string.IsNullOrEmpty(dtExcelData.Rows[i]["IGST"].ToString()) ? "0" : dtExcelData.Rows[i]["IGST"].ToString()) > 0)
}
else
{
pDecTotalIGST28 = pDecTotalIGST28 + Convert.ToDecimal(string.IsNullOrEmpty(dtExcelData.Rows[i]["IGST"].ToString()) ? "0" : dtExcelData.Rows[i]["IGST"].ToString());
pDecTotalPurchase28 = pDecTotalPurchase28 + Convert.ToDecimal(string.IsNullOrEmpty(dtExcelData.Rows[i]["Amount"].ToString()) ? "0" : dtExcelData.Rows[i]["Amount"].ToString());
}
}
string pStrErrorMessage = "GST Calculation Mismatch Inv No-" + pStrInvNo + "Item - " + dtExcelData.Rows[i]["Part"].ToString() + " | " + dtExcelData.Rows[i]["Part Name"].ToString();
pIntErrorStatus = 1;
MessageBox.Show(pStrErrorMessage);
pSWTallySyncLogs.WriteLine(pStrErrorMessage);
}
oLibDbCommon.AddRowToDataTable(dtPurchaseDetails, pStrData);
//oLibDbCommon.AddRowToDataTable(dtPurchaseDetails, pStrData);
}
}
}
+1 -1
View File
@@ -34,7 +34,7 @@ namespace TallyDataTool.Models
public string ItemRate { get; set; }
public string ItemAmount { get; set; }
public string InventortyLedgerName { get; set; }
public string IsDeemedPositive { get; set; }
}
+3 -3
View File
@@ -8,7 +8,7 @@ using System.Runtime.InteropServices;
[assembly: AssemblyTitle("TallyDataTool")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Beta Release -R2023-05-03")]
[assembly: AssemblyCompany("Beta Release -R2023-05-05")]
[assembly: AssemblyProduct("TallyDataTool")]
[assembly: AssemblyCopyright("Copyright © 2023")]
[assembly: AssemblyTrademark("")]
@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2.1.0.3")]
[assembly: AssemblyFileVersion("2.1.0.3")]
[assembly: AssemblyVersion("2.1.0.4")]
[assembly: AssemblyFileVersion("2.1.0.4")]
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.