static void
importFinanaceAnalysis(Args _args)
{
#AviFiles
FormRun
formRun;
SysExcelApplication
application;
SysExcelWorkbooks workbooks;
SysExcelWorkbook workbook;
SysExcelWorksheets
worksheets;
SysExcelWorksheet worksheet;
SysExcelCells cells;
COMVariantType type;
int row = 1,i;
Dialog lDialog = new Dialog("Import
Finance Analysis...");
DialogField lDialogField,lDialogField1;
ITLLNFinAnalysisPartC
ITLLNFinAnalysisPartC;
ITLLNFinAnalysisPartA
ITLLNFinAnalysisPartA;
ITLLNFinAnalysisPartB
ITLLNFinAnalysisPartB;
ITLLNFinAnalysisPartDE
ITLLNFinAnalysisPartDE;
custtable custtable;
ITLLNAuditStatus
ITLLNAuditStatus;
NumberSeq _NumberSeq;
SysOperationProgress progress =
new SysOperationProgress();
;
lDialogField1 = lDialog.addField(extendedTypeStr(CustAccount));
lDialogField1.mandatory_RU(true);
lDialogField = lDialog.addField(extendedTypeStr("filenameopen"));
if(lDialog.run())
{
application = SysExcelApplication::construct();
workbooks = application.workbooks();
try
{
workbooks.open(lDialogField.value());
}
catch (Exception::Error)
{
throw error("File
not found");
}
workbook = workbooks.item(1);
worksheets = workbook.worksheets();
worksheet = worksheets.itemFromName("General
details");
cells = worksheet.cells();
progress.setCaption("Importing Finanace
Analysis Data...");
progress.setAnimation(#AviUpdate);
progress.setTotal(10);
for (i = 1;
i <= 10; i++)
{
// progress.setText(strfmt("The value of i is
%1", i));
ttsBegin;
//Code For general Details & Part A .
_NumberSeq = NumberSeq::newGetNum(ITLLNParameters::numRefFinCtrlNo(),true);
ITLLNFinAnalysisPartA.FinCtrlNo
= _NumberSeq.num();//cells.item(4,3).value().bStr();
ITLLNFinAnalysisPartA.CustAccount
= lDialogField1.value(); //
cells.item(4,3).value().bStr();
ITLLNFinAnalysisPartA.CustName
= CustTable::find(lDialogField1.value()).name();
//cells.item(4,3).value().bStr();
ITLLNFinAnalysisPartA.AuditStatus
= str2enum(ITLLNAuditStatus,cells.item(6,3).value().bStr());
ITLLNFinAnalysisPartA.Year =
cells.item(5,3).value().bStr();
ITLLNFinAnalysisPartA.NOOfDays
= cells.item(10,6).value().double();
ITLLNFinAnalysisPartA.ProcurementDCS=
cells.item(12,4).value().double();
ITLLNFinAnalysisPartA.ProcurementBulk=
cells.item(13,4).value().double();
ITLLNFinAnalysisPartA.MilkFrmCommodites= cells.item(14,4).value().double();
ITLLNFinAnalysisPartA.MilkSale
= cells.item(16,4).value().double();
ITLLNFinAnalysisPartA.BulkMilkSale
= cells.item(17,4).value().double();
ITLLNFinAnalysisPartA.MilkDisposed
= cells.item(18,4).value().double();
ITLLNFinAnalysisPartA.State
= CustTable::find(ITLLNFinAnalysisPartA.CustAccount).stateName();
progress.setText("Part-A Data is
Importing.");
workbook = workbooks.item(1);
worksheets = workbook.worksheets();
worksheet = worksheets.itemFromName("Part-A");
cells = worksheet.cells();
i++;
// New work Sheet.
ITLLNFinAnalysisPartA.CreditSales
= cells.item(91,5).value().double();
ITLLNFinAnalysisPartA.CashSales
= cells.item(92,5).value().double();
ITLLNFinAnalysisPartA.CommentOnAnalysis = cells.item(94,2).value().bStr();
//Code ends For Part A.
//CODE FOR PART B
/* workbook = workbooks.item(1);
worksheets = workbook.worksheets();
worksheet =
worksheets.itemFromName("Part-B");
cells =
worksheet.cells();
i++;
ITLLNFinAnalysisPartB.CommentOnAnalysis =
cells.item(61,2).value().bStr(); */
// END OF PART B
workbook = workbooks.item(1);
worksheets = workbook.worksheets();
worksheet = worksheets.itemFromName("Part-C");
cells
= worksheet.cells();
i++;
//
select * from ITLLNFinAnalysisPartC where
ITLLNFinAnalysisPartC.FinCtrlNo == ITLLNFinAnalysisPartA.FinCtrlNo;
// Code For Part C.
ITLLNFinAnalysisPartC.FinCtrlNo
= ITLLNFinAnalysisPartA.FinCtrlNo;
ITLLNFinAnalysisPartC.ProcOpeningLiquidMilk = cells.item(14,8).value().double();
ITLLNFinAnalysisPartC.ProcOpeningSMP =
cells.item(16,8).value().double();
ITLLNFinAnalysisPartC.ProcOpeningButter =
cells.item(17,8).value().double();
ITLLNFinAnalysisPartC.ProcOpeningGhee =
cells.item(18,8).value().double();
ITLLNFinAnalysisPartC.ProcOpeningButterMilk = cells.item(19,8).value().double();
ITLLNFinAnalysisPartC.ProcOpeningCurd =
cells.item(20,8).value().double();
ITLLNFinAnalysisPartC.ProcOpeningFlavouredMilk= cells.item(21,8).value().double();
ITLLNFinAnalysisPartC.ProcOpeningPeda =
cells.item(22,8).value().double();
ITLLNFinAnalysisPartC.ProcOpeningCheese =
cells.item(23,8).value().double();
ITLLNFinAnalysisPartC.ProcOpeningOtherMilkProduct =
cells.item(24,8).value().double();
ITLLNFinAnalysisPartC.ProcOpeningOther =
cells.item(26,8).value().double();
i++;
ITLLNFinAnalysisPartC.ProcPurchLiquidMilk =
cells.item(30,8).value().double();
ITLLNFinAnalysisPartC.ProcPurchSMP =
cells.item(32,8).value().double();
ITLLNFinAnalysisPartC.ProcPurchButter =
cells.item(33,8).value().double();
ITLLNFinAnalysisPartC.ProcPurchGhee =
cells.item(34,8).value().double();
ITLLNFinAnalysisPartC.ProcPurchButterMilk =
cells.item(35,8).value().double();
ITLLNFinAnalysisPartC.ProcPurchCurd =
cells.item(36,8).value().double();
ITLLNFinAnalysisPartC.ProcPurchFlavouredMilk= cells.item(37,8).value().double();
ITLLNFinAnalysisPartC.ProcPurchPeda =
cells.item(38,8).value().double();
ITLLNFinAnalysisPartC.ProcPurchCheese =
cells.item(39,8).value().double();
ITLLNFinAnalysisPartC.ProcPurchOtherMilkProduct=cells.item(40,8).value().double();
ITLLNFinAnalysisPartC.ProcPurchOpeningOther = cells.item(42,8).value().double();
i++;
ITLLNFinAnalysisPartC.ProcClosingLiquidMilk = cells.item(46,8).value().double();
ITLLNFinAnalysisPartC.ProcClosingSMP =
cells.item(48,8).value().double();
ITLLNFinAnalysisPartC.ProcClosingButter =
cells.item(49,8).value().double();
ITLLNFinAnalysisPartC.ProcClosingGhee =
cells.item(50,8).value().double();
ITLLNFinAnalysisPartC.ProcClosingButterMilk = cells.item(51,8).value().double();
ITLLNFinAnalysisPartC.ProcClosingCurd =
cells.item(52,8).value().double();
ITLLNFinAnalysisPartC.ProcClosingFlavouredMilk= cells.item(53,8).value().double();
ITLLNFinAnalysisPartC.ProcClosingPeda =
cells.item(54,8).value().double();
ITLLNFinAnalysisPartC.ProcClosingCheese =
cells.item(55,8).value().double();
ITLLNFinAnalysisPartC.ProcClosingOtherMilkProduct = cells.item(56,8).value().double();
ITLLNFinAnalysisPartC.ProcClosingOther =
cells.item(58,8).value().double();
i++;
ITLLNFinAnalysisPartC.ProcDCS = cells.item(64,8).value().double();
ITLLNFinAnalysisPartC.ProcMilkOutside =
cells.item(65,8).value().double();
ITLLNFinAnalysisPartC.ProcOtherCost =
cells.item(66,8).value().double();
ITLLNFinAnalysisPartC.ProcCommisionDCS
= cells.item(69,8).value().double();
ITLLNFinAnalysisPartC.PEOpeningAIAHService =
cells.item(79,8).value().double();
ITLLNFinAnalysisPartC.PEOpeningFodderSeeds =
cells.item(80,8).value().double();
ITLLNFinAnalysisPartC.PEOpeningCattleFeed =
cells.item(81,8).value().double();
ITLLNFinAnalysisPartC.PEOpeningDCSMaterial =
cells.item(82,8).value().double();
ITLLNFinAnalysisPartC.PEOpeningothers =
cells.item(83,8).value().double();
i++;
ITLLNFinAnalysisPartC.PEPurchAIAHService =
cells.item(86,8).value().double();
ITLLNFinAnalysisPartC.PEPurchFodderSeeds =
cells.item(87,8).value().double();
ITLLNFinAnalysisPartC.PEPurchCattleFeed =
cells.item(88,8).value().double();
ITLLNFinAnalysisPartC.PEPurchDCSMaterial =
cells.item(89,8).value().double();
ITLLNFinAnalysisPartC.PEPurchothers =
cells.item(90,8).value().double();
ITLLNFinAnalysisPartC.PEClosningAIAHService = cells.item(93,8).value().double();
ITLLNFinAnalysisPartC.PEClosingFodderSeeds =
cells.item(94,8).value().double();
ITLLNFinAnalysisPartC.PEClosingCattleFeed =
cells.item(95,8).value().double();
ITLLNFinAnalysisPartC.PEClosingDCSMaterial =
cells.item(96,8).value().double();
ITLLNFinAnalysisPartC.PEClosingothers =
cells.item(97,8).value().double();
ITLLNFinAnalysisPartC.PEPlExpenditure =
cells.item(101,8).value().double();
ITLLNFinAnalysisPartC.PEAIAHExpenditure =
cells.item(102,8).value().double();
ITLLNFinAnalysisPartC.PETraining =
cells.item(103,8).value().double();
ITLLNFinAnalysisPartC.PEDCSExpenditure =
cells.item(104,8).value().double();
ITLLNFinAnalysisPartC.PEFreightExpenses =
cells.item(105,8).value().double();
ITLLNFinAnalysisPartC.PEFeedExpenses =
cells.item(106,8).value().double();
ITLLNFinAnalysisPartC.PEOthers = cells.item(107,8).value().double();
i++;
ITLLNFinAnalysisPartC.PEFPOpeningCattleFeed = cells.item(113,8).value().double();
ITLLNFinAnalysisPartC.PEFPOpeningMineralMixture= cells.item(114,8).value().double();
ITLLNFinAnalysisPartC.PEFPOpeningOthers = cells.item(115,8).value().double();
ITLLNFinAnalysisPartC.PEFPPurchCattleFeed =
cells.item(118,8).value().double();
ITLLNFinAnalysisPartC.PEFPPurchMineralMixture =
cells.item(119,8).value().double();
ITLLNFinAnalysisPartC.PEFPPurchOthers =
cells.item(120,8).value().double();
ITLLNFinAnalysisPartC.PEFPClosingCattleFeed =
cells.item(123,8).value().double();
ITLLNFinAnalysisPartC.PEFPClosingMineralMixture = cells.item(124,8).value().double();
ITLLNFinAnalysisPartC.PEFPClosingOther =
cells.item(125,8).value().double();
ITLLNFinAnalysisPartC.PEFPTransport =
cells.item(130,8).value().double();
ITLLNFinAnalysisPartC.PEFPPacking =
cells.item(131,8).value().double();
ITLLNFinAnalysisPartC.PEFPPower =
cells.item(132,8).value().double();
ITLLNFinAnalysisPartC.PEFPAdminExpenses =
cells.item(133,8).value().double();
ITLLNFinAnalysisPartC.PEFPRepair =
cells.item(134,8).value().double();
ITLLNFinAnalysisPartC.PEFPDepriciation =
cells.item(135,8).value().double();
ITLLNFinAnalysisPartC.PEFPMKTExpenses =
cells.item(136,8).value().double();
ITLLNFinAnalysisPartC.PRCLaborCost =
cells.item(146,8).value().double();
ITLLNFinAnalysisPartC.PRCBMCChillingCost =
cells.item(148,8).value().double();
ITLLNFinAnalysisPartC.PRCCCChillingCost =
cells.item(149,8).value().double();
ITLLNFinAnalysisPartC.PRCFuelCost =
cells.item(150,8).value().double();
ITLLNFinAnalysisPartC.PRCPower = cells.item(151,8).value().double();
ITLLNFinAnalysisPartC.PRCWater = cells.item(152,8).value().double();
ITLLNFinAnalysisPartC.PRCConsumable =
cells.item(153,8).value().double();
ITLLNFinAnalysisPartC.PRCConversion =
cells.item(154,8).value().double();
ITLLNFinAnalysisPartC.PRCCustomPacking =
cells.item(155,8).value().double();
ITLLNFinAnalysisPartC.PRCLabExpenses =
cells.item(156,8).value().double();
ITLLNFinAnalysisPartC.PRCStorage =
cells.item(157,8).value().double();
ITLLNFinAnalysisPartC.PRCOtherCost =
cells.item(158,8).value().double();
ITLLNFinAnalysisPartC.PRCRepair =
cells.item(162,8).value().double();
ITLLNFinAnalysisPartC.PRCDepreciation =
cells.item(163,8).value().double();
ITLLNFinAnalysisPartC.PRCFreight =
cells.item(164,8).value().double();
ITLLNFinAnalysisPartC.PRCOthers =
cells.item(165,8).value().double();
ITLLNFinAnalysisPartC.PKGMilk = cells.item(173,8).value().double();
ITLLNFinAnalysisPartC.PKGMilkProduct =
cells.item(174,8).value().double();
ITLLNFinAnalysisPartC.PKGOther = cells.item(175,8).value().double();
ITLLNFinAnalysisPartC.ADMSalaries =
cells.item(180,8).value().double();
ITLLNFinAnalysisPartC.ADMrent = cells.item(182,8).value().double();
ITLLNFinAnalysisPartC.ADMInsurance =
cells.item(183,8).value().double();
ITLLNFinAnalysisPartC.ADMPostage =
cells.item(184,8).value().double();
ITLLNFinAnalysisPartC.ADMPrint = cells.item(185,8).value().double();
ITLLNFinAnalysisPartC.ADMBoard = cells.item(186,8).value().double();
ITLLNFinAnalysisPartC.ADMAudit = cells.item(187,8).value().double();
ITLLNFinAnalysisPartC.ADMLegal = cells.item(188,8).value().double();
ITLLNFinAnalysisPartC.ADMTravel =
cells.item(189,8).value().double();
ITLLNFinAnalysisPartC.ADMSecurity =
cells.item(190,8).value().double();
ITLLNFinAnalysisPartC.ADMGenExpenses =
cells.item(191,8).value().double();
ITLLNFinAnalysisPartC.ADMDepreciation =
cells.item(192,8).value().double();
ITLLNFinAnalysisPartC.ADMOther = cells.item(193,8).value().double();
ITLLNFinAnalysisPartC.ADMRepair =
cells.item(195,8).value().double();
ITLLNFinAnalysisPartC.MKTAdvstCost =
cells.item(201,8).value().double();
ITLLNFinAnalysisPartC.MKTTransportcost =
cells.item(203,8).value().double();
ITLLNFinAnalysisPartC.MKTBulkTransportcost = cells.item(204,8).value().double();
ITLLNFinAnalysisPartC.MKTCommission =
cells.item(205,8).value().double();
ITLLNFinAnalysisPartC.MKTOther = cells.item(206,8).value().double();
ITLLNFinAnalysisPartC.FINInterestLT =
cells.item(213,8).value().double();
ITLLNFinAnalysisPartC.FINInterestSTL =
cells.item(214,8).value().double();
ITLLNFinAnalysisPartC.FINOther = cells.item(215,8).value().double();
ITLLNFinAnalysisPartC.SaleLiquidMilk =
cells.item(223,8).value().double();
ITLLNFinAnalysisPartC.SaleStocktransfer =
cells.item(224,8).value().double();
ITLLNFinAnalysisPartC.SalesSMP = cells.item(226,8).value().double();
ITLLNFinAnalysisPartC.SaleButter =
cells.item(227,8).value().double();
ITLLNFinAnalysisPartC.SaleGhee = cells.item(228,8).value().double();
ITLLNFinAnalysisPartC.SaleButterMilk =
cells.item(229,8).value().double();
ITLLNFinAnalysisPartC.SaleCurd = cells.item(230,8).value().double();
ITLLNFinAnalysisPartC.SaleFlavouredMilk =
cells.item(231,8).value().double();
ITLLNFinAnalysisPartC.SalePeda = cells.item(232,8).value().double();
ITLLNFinAnalysisPartC.SaleCheese =
cells.item(233,8).value().double();
ITLLNFinAnalysisPartC.SaleOtherMilkProduct =
cells.item(234,8).value().double();
ITLLNFinAnalysisPartC.SaleFeedOperation =
cells.item(237,8).value().double();
ITLLNFinAnalysisPartC.SaleAIOperation =
cells.item(238,8).value().double();
ITLLNFinAnalysisPartC.SaleDCS = cells.item(239,8).value().double();
ITLLNFinAnalysisPartC.SaleFodder =
cells.item(240,8).value().double();
ITLLNFinAnalysisPartC.SaleCattleFeed =
cells.item(243,8).value().double();
ITLLNFinAnalysisPartC.SaleMineralMixture =
cells.item(244,8).value().double();
ITLLNFinAnalysisPartC.SaleOther = cells.item(245,8).value().double();
i++;
ITLLNFinAnalysisPartC.SaleVat = cells.item(249,8).value().double();
ITLLNFinAnalysisPartC.IncomeConversion =
cells.item(253,8).value().double();
ITLLNFinAnalysisPartC.IncomeCustompacking =
cells.item(254,8).value().double();
ITLLNFinAnalysisPartC.IncomeOthers =
cells.item(255,8).value().double();
ITLLNFinAnalysisPartC.OtherIncomeGrants =
cells.item(259,8).value().double();
ITLLNFinAnalysisPartC.OtherIncomeInterest =
cells.item(260,8).value().double();
ITLLNFinAnalysisPartC.OtherIncomeScrap =
cells.item(261,8).value().double();
ITLLNFinAnalysisPartC.OtherIncomeOthers =
cells.item(262,8).value().double();
ITLLNFinAnalysisPartC.Exceptionalitems
= cells.item(270,8).value().double();
ITLLNFinAnalysisPartC.IncomeTax =
cells.item(274,8).value().double();
ITLLNFinAnalysisPartC.RepPrincipaldue =
cells.item(293,8).value().double();
ITLLNFinAnalysisPartC.RepUnpaiddue =
cells.item(294,8).value().double();
i++;
progress.setText("Part-C Data is Importing.");
//Code For Part C ends.
//Code For Part D.
workbook = workbooks.item(1);
worksheets = workbook.worksheets();
worksheet = worksheets.itemFromName("Part-D
E");
cells = worksheet.cells();
select * from
ITLLNFinAnalysisPartDE where
ITLLNFinAnalysisPartDe.FinCtrlNo == ITLLNFinAnalysisPartA.FinCtrlNo;
ITLLNFinAnalysisPartDE.Government =
cells.item(13,5).value().double();
ITLLNFinAnalysisPartDE.Members = cells.item(14,5).value().double();
ITLLNFinAnalysisPartDE.AccumulatedProfitLoss= cells.item(18,5).value().double();
ITLLNFinAnalysisPartDE.GeneralReserve =
cells.item(19,5).value().double();
ITLLNFinAnalysisPartDE.ShareSuspense =
cells.item(20,5).value().double();
ITLLNFinAnalysisPartDE.Grants = cells.item(23,6).value().double();
ITLLNFinAnalysisPartDE.CapitalReserves =
cells.item(25,6).value().double();
ITLLNFinAnalysisPartDE.OtherReserve =
cells.item(26,6).value().double();
ITLLNFinAnalysisPartDE.SecuredLoanNddb =
cells.item(28,5).value().double();
ITLLNFinAnalysisPartDE.SecuredLoanOther =
cells.item(29,5).value().double();
// added by Ravi
ITLLNFinAnalysisPartDE.FinCtrlNoPrevious =
cells.item(8,5).value().bStr();
// end
ITLLNFinAnalysisPartDE.UnpaidInterestSec =
cells.item(31,5).value().double();
ITLLNFinAnalysisPartDE.UnSecuredLoanNddb =
cells.item(34,5).value().double();
ITLLNFinAnalysisPartDE.UnSecuredLoanOther =
cells.item(35,5).value().double();
ITLLNFinAnalysisPartDE.UnpaidInterestUnsec =
cells.item(37,6).value().double();
ITLLNFinAnalysisPartDE.Redeemable =
cells.item(42,5).value().double();
ITLLNFinAnalysisPartDE.Irredeemable =
cells.item(43,5).value().double();
ITLLNFinAnalysisPartDE.LongtTermProvision =
cells.item(45,6).value().double();
ITLLNFinAnalysisPartDE.GrossBlock =
cells.item(52,5).value().double();
ITLLNFinAnalysisPartDE.AccDepreciation =
cells.item(53,5).value().double();
ITLLNFinAnalysisPartDE.CapitalWIP =
cells.item(55,6).value().double();
ITLLNFinAnalysisPartDE.Investment =
cells.item(56,6).value().double();
ITLLNFinAnalysisPartDE.CashBankBalance =
cells.item(58,6).value().double();
ITLLNFinAnalysisPartDE.InvRawMaterial =
cells.item(60,5).value().double();
ITLLNFinAnalysisPartDE.InvWIP = cells.item(61,5).value().double();
ITLLNFinAnalysisPartDE.InvFinishedProducts =
cells.item(62,5).value().double();
ITLLNFinAnalysisPartDE.InvCFP = cells.item(63,5).value().double();
ITLLNFinAnalysisPartDE.InvOther = cells.item(64,5).value().double();
ITLLNFinAnalysisPartDE.SundryDairy =
cells.item(67,5).value().double();
ITLLNFinAnalysisPartDE.SundryOther =
cells.item(68,5).value().double();
ITLLNFinAnalysisPartDE.ShortTermDeposit =
cells.item(70,6).value().double();
ITLLNFinAnalysisPartDE.Advances =
cells.item(71,6).value().double();
ITLLNFinAnalysisPartDE.OherCurrAsset =
cells.item(72,6).value().double();
ITLLNFinAnalysisPartDE.DueDCS = cells.item(77,5).value().double();
ITLLNFinAnalysisPartDE.DueOthers =
cells.item(78,5).value().double();
ITLLNFinAnalysisPartDE.CrediterforExpenses =
cells.item(79,5).value().double();
ITLLNFinAnalysisPartDE.OtherCreditor =
cells.item(80,5).value().double();
ITLLNFinAnalysisPartDE.DepositAdvances =
cells.item(82,6).value().double();
ITLLNFinAnalysisPartDE.Provisions =
cells.item(83,6).value().double();
ITLLNFinAnalysisPartDE.CashCredit =
cells.item(84,6).value().double();
ITLLNFinAnalysisPartDE.OtherCL = cells.item(85,6).value().double();
ITLLNFinAnalysisPartDE.DeferredExpenses =
cells.item(88,6).value().double();
ITLLNFinAnalysisPartDE.InstallCapacity =
cells.item(122,6).value().double();
ITLLNFinAnalysisPartDE.FinCtrlNo =
ITLLNFinAnalysisPartA.FinCtrlNo;
ITLLNFinAnalysisPartDE.ReportOnAnalysis =
cells.item(154,2).value().bStr();
progress.setText("Part-DE Data is
Importing.");
ITLLNFinAnalysisPartA.insert();
ITLLNFinAnalysisPartC.insert();
ITLLNFinAnalysisPartDE.insert();
// ITLLNFinAnalysisPartB.insert();
//Code Ends.
progress.setCount(i, 1);
}
ttsCommit;
}
application.quit();
info("Finance Analysis Data is Imported.");
//new MenuFunction(menuitemActionStr(FinAnalImport),
MenuItemType::Action).run();
//new MenuFunction(menuitemActionStr(FinAnalImport),
MenuItemType::Action).run();
//new MenuFunction(menuitemActionStr(FinAnalImport),
MenuItemType::Action).run();
}
No comments:
Post a Comment