Здравствуйте, ребята!
На работе на сервере крутится web-сервис, написанный лет 12 назад сторонней фирмой, исходников соответственно нет. Если что нужно поправить, то приходится искать нужную библиотеку, декомпилить её и править.
Появилась потребность в доработке одно отчета, который вызывается следующим http-запросом:
(подозрительная ссылка!) http://10.1.48.69/estateorenburg/Forms/EstateRent/EstateDebitorsListBySubRgnNew.aspx .
Зашел на сервер, отыскал эту директорию и нашел там файл "EstateDebitorsListBySubRgnNew.aspx.cs". В нем вроде бы как весь код, который мне нужно поправить. Скорректировал его код, сохранил и запускаю снова данный отчет - результат 0-ой, ничего не поменялось. Думал может просто изменения неудачно внес и поменял просто заголовок, что бы проверить применяются ли изменения вообще - ничего не поменялось.
Пробовал перезапускать IIS - не помогло.
В чем делом не пойму (
Вот код файла "EstateDebitorsListBySubRgnNew.aspx.cs"
1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14. 15. 16. 17. 18. 19. 20. 21. 22. 23. 24. 25. 26. 27. 28. 29. 30. 31. 32. 33. 34. 35. 36. 37. 38. 39. 40. 41. 42. 43. 44. 45. 46. 47. 48. 49. 50. 51. 52. 53. 54. 55. 56. 57. 58. 59. 60. 61. 62. 63. 64. 65. 66. 67. 68. 69. 70. 71. 72. 73. 74. 75. 76. 77. 78. 79. 80. 81. 82. 83. 84. 85. 86. 87. 88. 89. 90. 91. 92. 93. 94. 95. 96. 97. 98. 99. 100. 101. 102. 103. 104. 105. 106. 107. 108. 109. 110. 111. 112. 113. 114. 115. 116. 117. 118. 119. 120. 121. 122. 123. 124. 125. 126. 127. 128. 129. 130. 131. 132. 133. 134. 135. 136. 137. 138. 139. 140. 141. 142. 143. 144. 145. 146. 147. 148. 149. 150. 151. 152. 153. 154. 155. 156. 157. 158. 159. 160. 161. 162. 163. 164. 165. 166. 167. 168. 169. 170. 171. 172. 173. 174. 175. 176. 177. 178. 179. 180. 181. 182. 183. 184. 185. 186. 187. 188. 189. 190. 191. 192. 193. 194. 195. 196. 197. 198. 199. 200. 201. 202. 203. 204. 205. 206. 207. 208. 209. 210. 211. 212. 213. 214. 215. 216. 217. 218. 219. 220. 221. 222. 223. 224. 225. 226. 227. 228. 229. 230. 231. 232. 233. 234. 235. 236. 237. 238. 239. 240. 241. 242. 243. 244. 245. 246. 247. 248. 249. 250. 251. 252. 253. 254. 255. 256. 257. 258. 259. 260. 261. 262. 263. 264. 265. 266. 267. 268. 269. 270. 271. 272. 273. 274. 275. 276. 277. 278. 279. 280. 281. 282. 283. 284. 285. 286. 287. 288. 289. 290. 291. 292. 293. 294. 295. 296. 297. 298. 299. 300. 301. 302. 303. 304. 305. 306. 307. 308. 309. 310. 311. 312. 313. 314. 315. 316. 317. 318. 319. 320. 321. 322. 323. 324. 325. 326. 327. 328. 329. 330. 331. 332. 333. 334. 335. 336. 337. 338. 339. 340. 341. 342. 343. 344. 345. 346. 347. 348. 349. 350. 351. 352. 353. 354. 355. 356. 357. 358. 359. 360. 361. 362. 363. 364. 365. 366. 367. 368. 369. 370. 371. 372. 373. 374. 375. 376. 377. 378. 379. 380. 381. 382. 383. 384. 385. 386. 387. 388. 389. 390. 391. 392. 393. 394. 395. 396. 397. 398. 399. 400. 401. 402. 403. 404. 405. 406. 407. 408. 409. 410. 411. 412. 413. 414. 415. 416. 417. 418. 419. 420. 421. 422. 423. 424. 425. 426. 427. 428. 429. 430. 431. 432. 433. 434. 435. 436. 437. 438. 439. 440. 441. 442. 443. 444. 445. 446. 447. 448. 449. 450. 451. 452. 453. 454. 455. 456. 457. 458. 459. 460. 461. 462. 463. 464. 465. 466. 467. 468. 469. 470. 471. 472. 473. 474. 475. 476. 477. 478. 479. 480. 481. 482. 483. 484. 485. 486. 487. 488. 489. 490. 491. 492. 493. 494. 495. 496. 497. 498. 499. 500. 501. 502. 503. 504. 505. 506. 507. 508. 509. 510. 511. 512. 513. 514. 515. 516. 517. 518. 519. 520. 521. 522. 523. 524. 525. 526. 527. 528. 529. 530. 531. 532. 533. 534. 535. 536. 537. 538. 539. 540. 541. 542. 543. 544. 545. 546. 547. 548. 549. 550. 551. 552. 553. 554. 555. 556. 557. 558. 559. 560. 561. 562. 563. 564. 565. 566. 567. 568. 569. 570. 571. 572. 573. 574. 575. 576. 577. 578. 579. 580. 581. 582. 583. 584. 585. 586. 587. 588. 589. 590. 591. 592. 593. 594. 595. 596. 597. 598. 599. 600. 601. 602. 603. 604. 605. 606. 607. 608. 609. 610. 611. 612. 613. 614. 615. 616. 617. 618. 619. 620. 621. 622. 623. 624. 625. 626. 627. 628. 629. 630. 631. 632. 633. 634. 635. 636. 637. 638. 639. 640. 641. 642. 643. 644. 645. 646. 647. 648. 649. 650. 651. 652. 653. 654. 655. 656. 657. 658. 659. 660. 661. 662. 663. 664. 665. 666. 667. 668. 669. 670. 671. 672. 673. 674. 675. 676. 677. 678. 679. 680. 681. 682. 683. 684. 685. 686. 687. 688. 689. 690. 691. 692. 693. 694. 695. 696. 697. 698. 699. 700. 701. 702. 703. 704. 705. 706. 707. 708. 709. 710. 711. 712. 713. 714. 715. 716. 717. 718. 719. 720. 721. 722. 723. 724. 725. 726. 727. 728. 729. 730. 731. 732. 733. 734. 735. 736. 737. 738. 739. 740. 741. 742. 743. 744. 745. 746. 747. 748. 749. 750. 751. 752. 753. 754. 755. 756. 757. 758. 759. 760. 761. 762. 763. 764.
using System;
using System.Collections;
using System.Web.UI.WebControls;
using ErrorBuilder;
using InMeta.Comparer.Estate;
using Integro.InMeta.Estate.Forms.EstateRent;
using Integro.InMeta.Runtime;
using Integro.InMeta.Web;
using Integro.MyTableRender;
public partial class EstateDebitorsListBySubRgnNew : WebPage
{
private class ItogByAllContract
{
public int DebitContractCount = 0;
public int CreditContractCount = 0;
public decimal DebitSum = 0;
public decimal CreditSum = 0;
public decimal FixedDebitSum = 0;
public decimal FixedCreditSum = 0;
}
private readonly ItogByAllContract itogsByAllContract = new ItogByAllContract();
private string SubRgnName
{
get{
string result;
if (ddSubRgnList.SelectedValue == "all"){
result = "по всем районам";
}
else{
result = string.Format("в {0} районе", ddSubRgnList.SelectedItem.Text.Replace("ий", "ом"));
}
return result;
}
}
private string ContractStateKindText
{
get { return ddContractStateKindList.SelectedItem.Text; }
}
private double FSumArea = 0;
private decimal FSumMonthPayment = 0;
private decimal FSumPaymentCharge = 0;
private decimal FSumPayment = 0;
private decimal FSumWriteOff = 0;
private decimal FSumTransfer = 0;
private decimal FSumBalance = 0;
private decimal FSumPenlaty = 0;
private decimal FSumPaymentTransferPrevPeriods = 0;
private int FDebtMonthCount = 0;
private decimal FDebtSum = 0;
private DateTime FCurrentDate;
private DateTime FStartDate = new DateTime(2008, 01,01);
private decimal FLastBalanceValue = 0;
private decimal FCorrectionBalanceValue = 0;
private int FActiveContract = 0;
private int FContractWithoutCharges = 0;
private decimal FSumPenaltyCharges = 0;
private decimal FSumPenaltyPayments = 0;
private decimal FSumPenaltyWriteOff = 0;
private decimal FSumPenaltyStartBalance = 0;
decimal FSumPenaltyStartBalancePrevSums = 0;
private decimal FSumPenaltyTransfered = 0;
private decimal FSumPaymentPenaltyTransferPrevPeriods = 0;
protected void Page_Load(object sender, EventArgs e)
{
ReportPanel.Visible = false;
PolicyFailedInfoPanel.Visible = false;
if (!Session.IsPolicyEnabled("UseEstateChargesAndPaymentsReports")){
PolicyFailedInfoPanel.Visible = true;
return;
}
ReportPanel.Visible = true;
if (IsPostBack){
FStartDate = new DateTime(Convert.ToDateTime(DateEditor.Text).Year, 01, 01);
}
else{
DateEditor.Text = DateTime.Today.ToShortDateString();
string RegionID = Session.Application.Settings.GetLocalSettings("RegionID", "00018019E1C5");
DataObjectList subRgnList = Session["General/SubRgn"].Query("<Name/>", "Region = '" + RegionID + "'");
foreach (DataObject subRgn in subRgnList){
ListItem item = new ListItem(subRgn.GetString("Name"), subRgn.Id.ToString());
ddSubRgnList.Items.Add(item);
}
}
}
protected void OKBtn_Click(object sender, EventArgs e)
{
FCurrentDate = Convert.ToDateTime(DateEditor.Text);
if (!ParamsFillIsCorrect()){
Response.Write("Неверно введен один из параметров");
return;
}
if (EdtMonthCount.Text != ""){
FDebtMonthCount = Convert.ToInt32(EdtMonthCount.Text);
}
if (EdtDebtSum.Text != ""){
FDebtSum = Convert.ToDecimal(EdtDebtSum.Text);
}
string SubRgnConditions = "";
if (ddSubRgnList.SelectedValue != "all"){
SubRgnConditions = " and BuildingID.General_PostAddr.SubRgn = '" + ddSubRgnList.SelectedValue+"'";
}
DataObjectList processList = Session[EstateRentClasses.Process].Query(
"<RentContractProcessKind>" +
"<Abbreviation/>" +
"</RentContractProcessKind>" +
"<Estate_RentContract>" +
"<ContractNo/>" +
"<ContractCode/>" +
"</Estate_RentContract>" +
"<Estate_RentPretender>" +
"<Subject>" +
"<query-view name='PostAddrView'/>" +
"<Inn/>"+
"</Subject>" +
"</Estate_RentPretender>" +
"<Estate_RentObject>" +
"<RentArea/>" +
"</Estate_RentObject>" +
"<Estate_RentCalculation>" +
"<RentCalculatedPayment/>" +
"</Estate_RentCalculation>" +
"<Estate_RentPayment>" +
"<RentPaymentValue/>" +
"</Estate_RentPayment>" +
"<Estate_RentPaymentCharge>" +
"<OwnerPayment/>" +
"</Estate_RentPaymentCharge>" +
"<BuildingID>" +
"<General_PostAddr>" +
"<SubRgn/>" +
"</General_PostAddr>" +
"</BuildingID>",
"RentContractProcessKind.Abbreviation = 'ДА' " + SubRgnConditions);
if (processList.Count == 0){
Response.Write("<font color='red'>По данному району договоров не найдено</font>");
return;
}
TableRender table = new TableRender(holder, "<h5>Список дебиторов по " + ContractStateKindText +
" договорам аренды помещений, расположенных " + SubRgnName + " г. Оренбурга по состоянию на " +
FCurrentDate.ToShortDateString() + "</h5>");
ReportErrorsBuilder errorsBuilder = new ReportErrorsBuilder("EstateDebitorsListBySubRgnNew");
FormingHeaderDataTable(table);
FormingDataTable(processList, table, errorsBuilder);
FillItogInformation(table);
FormingErrors(errorsBuilder);
btnExportToExcel.Enabled = true;
btnExportToWord.Enabled = true;
}
private void FormingErrors(ReportErrorsBuilder errorsBuilder)
{
if(errorsBuilder.ErrorIsExist) {
LblErrorCaption.Visible = true;
HyperLinkError.Visible = true;
string logfilePath = errorsBuilder.CreateErrorTableFile();
LblErrorCaption.Text = "<font color='red'>При формировании отчета возникли ошибки</font>";
HyperLinkError.Text = "Просмотреть ошибки";
HyperLinkError.NavigateUrl = logfilePath;
LblErrorCaption.Visible = true;
HyperLinkError.Visible = true;
}
}
private void FormingDataTable(DataObjectList processList, TableRender table, ReportErrorsBuilder errorsBuilder)
{
Hashtable ProcessBySubRgnList = new Hashtable();
SortProcessBySubRgn(processList, ProcessBySubRgnList);
foreach (string subRgnId in ProcessBySubRgnList.Keys){
ArrayList groupingProcessList = (ArrayList)ProcessBySubRgnList[subRgnId];
GetSubRgnNameAndFillRow(subRgnId, table);
groupingProcessList.Sort(new ContractNoComparer());
foreach (DataObject lastDsvi in groupingProcessList){
DataObject process = !lastDsvi["RootRCP"].IsNull ? lastDsvi.GetLink("RootRCP") : lastDsvi;
try{
FCorrectionBalanceValue = 0;
BalanceInfoForProcess infoByRCP = FormingData(process);
if (!ProcessIsRightConditions(lastDsvi, infoByRCP)) continue;
SummationItog(infoByRCP);
FillDataTable(table, process, lastDsvi, infoByRCP);
}
catch (Exception ex){
FLastBalanceValue -= FCorrectionBalanceValue;
errorsBuilder.AddError(ex.Message, process);
}
}
}
}
private void GetSubRgnNameAndFillRow(string subRgnId, TableRender table)
{
if (ddSubRgnList.SelectedValue == "all"){
if (subRgnId != "000000000001"){
DataObject subRgn = Session["General/SubRgn"].GetObject(new DataId(subRgnId));
SetSubRgnRow(table, subRgn.GetString("Name"));
}
else{
SetSubRgnRow(table, "Район не задан");
}
}
}
private void SortProcessBySubRgn(DataObjectList processList, Hashtable ProcessBySubRgnList)
{
foreach (DataObject process in processList){
DataObject lastProcessInHierarchy = WorkUtils.GetEstateLastDSVI(process);
if (!ContractStateKindIsCorrect(lastProcessInHierarchy)){
continue;
}
SortingProcessBySubRgn(lastProcessInHierarchy, ProcessBySubRgnList);
}
}
private BalanceInfoForProcess FormingData(DataObject process)
{
BalanceInfoForProcess infoByRCP = FinishBalanceInfoCalculator.GetCalculatedBalance(process, FStartDate, FCurrentDate);
return infoByRCP;
}
private void SummationItog(BalanceInfoForProcess infoByRCP)
{
FLastBalanceValue += infoByRCP.LastRentBalance;
FSumPaymentCharge += infoByRCP.SumPaymentCharge;
FSumPayment += infoByRCP.SumPayment;
FSumWriteOff += infoByRCP.SumWriteOff;
FSumBalance += infoByRCP.FinishBalanceValue;
FSumPenlaty += infoByRCP.FinishBalancePenaltyValue;
FSumPaymentTransferPrevPeriods += infoByRCP.TransferSumByDebtForPrevPeriods;
FSumPenaltyCharges += infoByRCP.SumChargesForPenalty;
FSumPenaltyPayments += infoByRCP.SumPaymentForPenalty;
FSumPenaltyWriteOff += infoByRCP.SumWriteOffForPenalty;
FSumPenaltyStartBalance += infoByRCP.LastPenaltyBalance;
FSumPenaltyStartBalancePrevSums += infoByRCP.PenaltyValueOnStartPeriod;
FSumPenaltyTransfered += GetPenaltyTransferedSum(infoByRCP);
FSumPaymentPenaltyTransferPrevPeriods += infoByRCP.TransferSumByPenaltyForPrevPeriods;
}
private decimal GetPenaltyTransferedSum(BalanceInfoForProcess infoByRCP)
{
decimal penaltyTransferSum = 0;
foreach (TransferSumInfo transferSumInfo in infoByRCP.TransferSumInfos)
{
if (!transferSumInfo.IsPenalty) continue;
penaltyTransferSum += GetTransferSumByPayment(transferSumInfo);
penaltyTransferSum += GetTransferSumByDebt(transferSumInfo);
}
return penaltyTransferSum;
}
private decimal GetTransferSumByDebt(TransferSumInfo transferSumInfo)
{
decimal transferSum = 0;
if (transferSumInfo.TransferSumKind == TransferSumKind.Debt)
{
if (transferSumInfo.TransferSumLocation == TransferSumLocation.FromContract)
{
transferSum += transferSumInfo.TransferSum;
}
if (transferSumInfo.TransferSumLocation == TransferSumLocation.ToContract)
{
transferSum += transferSumInfo.TransferSum * -1;
}
}
return transferSum;
}
private decimal GetTransferSumByPayment(TransferSumInfo transferSumInfo)
{
decimal transferSum = 0;
if (transferSumInfo.TransferSumKind == TransferSumKind.Payment)
{
if (transferSumInfo.TransferSumLocation == TransferSumLocation.FromContract){
transferSum += transferSumInfo.TransferSum * -1;
}
if (transferSumInfo.TransferSumLocation == TransferSumLocation.ToContract){
transferSum += transferSumInfo.TransferSum;
}
}
return transferSum;
}
private void SetSubRgnRow(TableRender table, string subRgnName)
{
TableRow row = new TableRow();
table.AddReportCell(row, "<b>" + subRgnName + " район</b>", 13, HorizontalAlign.Center);
table.TableReport.Rows.Add(row);
}
private void SortingProcessBySubRgn(DataObject lastDsvi, Hashtable ProcessBySubRgnList)
{
DataObject building = lastDsvi.GetLink("BuildingID");
DataObject buildingAddr = building.GetChilds(EstateRentClasses.PostAddr).First;
string subRgnId;
if (!buildingAddr["SubRgn"].IsNull){
subRgnId = buildingAddr.GetLink("SubRgn").Id.ToString();
}
else{
subRgnId = "000000000001";
}
if (ProcessBySubRgnList.ContainsKey(subRgnId)){
ArrayList processList = (ArrayList)ProcessBySubRgnList[subRgnId];
processList.Add(lastDsvi);
}
else{
ArrayList processList = new ArrayList();
processList.Add(lastDsvi);
ProcessBySubRgnList.Add(subRgnId, processList);
}
}
private bool ParamsFillIsCorrect()
{
bool result = true;
if (EdtMonthCount.Text != ""){
try{
Convert.ToInt32(EdtMonthCount.Text);
}
catch { result = false; }
}
if (EdtDebtSum.Text != ""){
try{
Convert.ToDecimal(EdtDebtSum.Text);
}
catch { result = false; }
}
return result;
}
private bool ProcessIsRightConditions(DataObject process, BalanceInfoForProcess infoByRCP)
{
bool result = true;
if (ddDebtKindList.SelectedValue != "all"){
if (ddDebtKindList.SelectedValue == "debt" && infoByRCP.FinishBalanceValue <= 0){
result = false;
}
if ((ddDebtKindList.SelectedValue == "credit") && (infoByRCP.FinishBalanceValue >= 0)){
result = false;
}
}
if (FDebtMonthCount > 0 && FDebtMonthCount > GetMonthCountDebt(process, infoByRCP)){
result = false;
}
if (FDebtSum > 0 && FDebtSum > infoByRCP.FinishBalanceValue){
result = false;
}
return result;
}
private void FillItogInformation(TableRender table)
{
TableRow itogRow = new TableRow();
table.AddReportCell(itogRow, "<b>Итого договоров = " + FActiveContract + ", без начислений = " + FContractWithoutCharges + "</b>", 4);
table.AddReportCell(itogRow, "<b>" + Math.Round(FSumArea) + "</b>");
table.AddReportCell(itogRow, "<b>" + Math.Round(FSumMonthPayment) + "</b>");
table.AddReportCell(itogRow, "<b>" + Math.Round(FLastBalanceValue, 2) + "</b>");
table.AddReportCell(itogRow, "<b>" + Math.Round(FSumPaymentCharge) + "</b>");
table.AddReportCell(itogRow, "<b>" + Math.Round(FSumPayment, 2) + "</b>");
table.AddReportCell(itogRow, "<b>" + Math.Round(FSumWriteOff) + "</b>");
table.AddReportCell(itogRow, "<b>" + Math.Round(FSumPaymentTransferPrevPeriods, 2) + "</b>");
table.AddReportCell(itogRow, "<b>" + Math.Round(FSumTransfer, 2) + "</b>");
table.AddReportCell(itogRow, "<b>" + Math.Round(FSumBalance, 2) + "</b>");
table.AddReportCell(itogRow, "<b>" + Math.Round(FSumPenlaty, 2) + "</b>");
//table.AddReportCell(itogRow, "<b>" + Math.Round(FSumArea) + "</b>");
//table.AddReportCell(itogRow, "<b>" + Math.Round(FSumMonthPayment) + "</b>");
//table.AddReportCell(itogRow, "<b>" + FLastBalanceValue + "</b>");
//table.AddReportCell(itogRow, "<b>" + FSumPaymentCharge + "</b>");
//table.AddReportCell(itogRow, "<b>" + FSumPayment + "</b>");
//table.AddReportCell(itogRow, "<b>" + FSumWriteOff + "</b>");
//table.AddReportCell(itogRow, "<b>" + FSumTransfer + "</b>");
//table.AddReportCell(itogRow, "<b>" + FSumBalance + "</b>");
//table.AddReportCell(itogRow, "<b>" + Math.Round(FSumPenlaty, 2) + "</b>");
table.AddReportCell(itogRow, "");
table.TableReport.Rows.Add(itogRow);
TableRow itogByDebtContractRow = new TableRow();
table.AddReportCell(itogByDebtContractRow,
"<b>Количество договоров с задолжностью: " + itogsByAllContract.DebitContractCount +
", cумма задолжности: " + Math.Round(itogsByAllContract.DebitSum, 2)
+ "</b>", 15, HorizontalAlign.Left);
table.TableReport.Rows.Add(itogByDebtContractRow);
TableRow itogByCreditContractRow = new TableRow();
table.AddReportCell(itogByCreditContractRow,
"<b>Количество договоров с переплатой: " + itogsByAllContract.CreditContractCount +
", cумма переплаты: " + Math.Abs(Math.Round(itogsByAllContract.CreditSum, 2))
+ "</b>", 15, HorizontalAlign.Left);
table.TableReport.Rows.Add(itogByCreditContractRow);
TableRow itogByFixedBalanceRow = new TableRow();
table.AddReportCell(itogByFixedBalanceRow,
"<b>Сумма задолжности по установленному сальдо: " +
Math.Round(itogsByAllContract.FixedDebitSum, 2) +"</b><br/>" +
"<b>Сумма переплаты по установленному сальдо: " +
Math.Abs(Math.Round(itogsByAllContract.FixedCreditSum, 2)) + "</b>",
15, HorizontalAlign.Left);
table.TableReport.Rows.Add(itogByFixedBalanceRow);
TableRow itogByPenaltyRow = new TableRow();
table.AddReportCell(itogByPenaltyRow,
"<b>Пени по начальному сальдо: " +
Math.Round(FSumPenaltyStartBalance, 2) + "</b><br/>" +
"<b>Пени на остаток начала периода: " +
Math.Round(FSumPenaltyStartBalancePrevSums, 2) + "</b><br/>" +
"<b>Пени начислено: " +
Math.Abs(Math.Round(FSumPenaltyCharges)) + "</b><br/>"+
"<b>Пени Списано: " +
Math.Round(FSumPenaltyWriteOff) + "</b><br/>" +
"<b>Пени оплачено: " +
Math.Round(FSumPenaltyPayments, 2) + "</b><br/>" +
"<b>Пени переведено с прошлых периодов: " +
Math.Round(FSumPaymentPenaltyTransferPrevPeriods, 2) + "</b><br/>" +
"<b>Пени переведено: " +
Math.Round(FSumPenaltyTransfered) + "</b><br/>",
15, HorizontalAlign.Left);
table.TableReport.Rows.Add(itogByPenaltyRow);
}
private void FillDataTable(TableRender table, DataObject process, DataObject lastDsvi, BalanceInfoForProcess infoByRCP)
{
FActiveContract++;
TableRow dataRow = new TableRow();
table.AddReportCell(dataRow, GetContractNo(process));
table.AddReportCell(dataRow, GetContractCode(process));
table.AddReportCell(dataRow, GetPretenderName(lastDsvi));
// By ///////////////////////////////////////////
table.AddReportCell(dataRow, GetPretenderINN(lastDsvi));
/////////////////////////////////////////////////////////
table.AddReportCell(dataRow, GetPretenderName(lastDsvi));
table.AddReportCell(dataRow, GetApartmentAddr(lastDsvi));
table.AddReportCell(dataRow, GetRentArea(lastDsvi));
table.AddReportCell(dataRow, GetMonthPaymentInStr(lastDsvi));
table.AddReportCell(dataRow, GetLastRentBalance(infoByRCP));
table.AddReportCell(dataRow, GetSumPaymentCharges(infoByRCP));
table.AddReportCell(dataRow, GetSumPayments(infoByRCP));
table.AddReportCell(dataRow, GetSumWriteOffs(infoByRCP));
table.AddReportCell(dataRow, GetSumTransferPaymentPrevPeriods(infoByRCP));
table.AddReportCell(dataRow, GetSumTransfer(infoByRCP));
table.AddReportCell(dataRow, GetCalculatedBalanceValue(infoByRCP));
table.AddReportCell(dataRow, GetPenaltyValue(infoByRCP));
table.AddReportCell(dataRow, Math.Round(GetMonthCountDebt(lastDsvi, infoByRCP), 2).ToString());
table.TableReport.Rows.Add(dataRow);
}
private string GetSumTransferPaymentPrevPeriods(BalanceInfoForProcess infoByRCP)
{
return Math.Round(infoByRCP.TransferSumByDebtForPrevPeriods, 2).ToString();
}
private string GetSumTransfer(BalanceInfoForProcess infoByRCP)
{
string result = string.Empty;
foreach (TransferSumInfo transferSumInfo in infoByRCP.TransferSumInfos)
{
if(transferSumInfo.IsPenalty) continue;
if(TransfersCountMoreThanOne(infoByRCP))
{
if(result != string.Empty)
{
result += "<br/>";
}
}
result = GetTransferSumInStringByPayment(result, transferSumInfo);
result = GetTransferSumInStringByDebt(result, transferSumInfo);
}
return result;
}
private bool TransfersCountMoreThanOne(BalanceInfoForProcess infoByRCP)
{
int transferInfoByRentCount = 0;
foreach (TransferSumInfo transferSumInfo in infoByRCP.TransferSumInfos)
{
if(transferSumInfo.IsPenalty) continue;
transferInfoByRentCount++;
}
return transferInfoByRentCount > 1;
}
private string GetTransferSumInStringByDebt(string result, TransferSumInfo transferSumInfo)
{
if (transferSumInfo.TransferSumKind == TransferSumKind.Debt)
{
if (transferSumInfo.TransferSumLocation == TransferSumLocation.FromContract)
{
result += Math.Round(transferSumInfo.TransferSum, 2).ToString();
FSumTransfer += transferSumInfo.TransferSum;
}
if (transferSumInfo.TransferSumLocation == TransferSumLocation.ToContract)
{
result += Math.Round(transferSumInfo.TransferSum * -1, 2).ToString();
FSumTransfer += transferSumInfo.TransferSum * -1;
}
}
return result;
}
private string GetTransferSumInStringByPayment(string result, TransferSumInfo transferSumInfo)
{
if(transferSumInfo.TransferSumKind == TransferSumKind.Payment)
{
if(transferSumInfo.TransferSumLocation == TransferSumLocation.FromContract)
{
result += Math.Round(transferSumInfo.TransferSum * -1, 2).ToString();
FSumTransfer += transferSumInfo.TransferSum * -1;
}
if (transferSumInfo.TransferSumLocation == TransferSumLocation.ToContract)
{
result += Math.Round(transferSumInfo.TransferSum, 2).ToString();
FSumTransfer += transferSumInfo.TransferSum;
}
}
return result;
}
private string GetSumWriteOffs(BalanceInfoForProcess infoByRCP)
{
decimal WriteOffSum = infoByRCP.SumWriteOff;
return Math.Round(WriteOffSum, 2).ToString();
}
private string GetCalculatedBalanceValue(BalanceInfoForProcess infoByRCP)
{
if (infoByRCP.FinishBalanceValue > 0){
itogsByAllContract.DebitContractCount++;
itogsByAllContract.DebitSum += infoByRCP.FinishBalanceValue;
}
else if (infoByRCP.FinishBalanceValue < 0){
itogsByAllContract.CreditContractCount++;
itogsByAllContract.CreditSum += infoByRCP.FinishBalanceValue;
}
return Math.Round(infoByRCP.FinishBalanceValue, 2).ToString();
}
private string GetLastRentBalance(BalanceInfoForProcess infoByRCP)
{
if (infoByRCP.LastRentBalance > 0){
itogsByAllContract.FixedDebitSum += infoByRCP.LastRentBalance;
}
else{
itogsByAllContract.FixedCreditSum += infoByRCP.LastRentBalance;
}
return infoByRCP.StartBalanceText;
}
private decimal GetMonthCountDebt(DataObject process, BalanceInfoForProcess infoByRCP)
{
decimal MonthPayment = GetMonthPayment(process);
if (MonthPayment <= 0) return 0;
return infoByRCP.FinishBalanceValue / MonthPayment;
}
private string GetPenaltyValue(BalanceInfoForProcess infoByRCP)
{
return Math.Round(infoByRCP.FinishBalancePenaltyValue, 2).ToString();
}
private string GetSumPayments(BalanceInfoForProcess infoByRCP)
{
decimal PaymentSum = infoByRCP.SumPayment;
return Math.Round(PaymentSum, 2).ToString();
}
private string GetSumPaymentCharges(BalanceInfoForProcess infoByRCP)
{
decimal PaymentChargesSum = infoByRCP.SumPaymentCharge;
if (PaymentChargesSum <= 0) FContractWithoutCharges++;
return Math.Round(PaymentChargesSum).ToString();
}
private decimal GetMonthPayment(DataObject process)
{
DataObject lastCalculation = EstateUtils.GetLastCalculation(process);
return lastCalculation.GetDecimal("RentCalculatedPayment", 0);
}
private string GetMonthPaymentInStr(DataObject process)
{
decimal MonthPayment = GetMonthPayment(process);
FSumMonthPayment += MonthPayment;
return Math.Round(MonthPayment).ToString();
}
private string GetRentArea(DataObject process)
{
double Area = 0;
foreach (DataObject rentObject in process.GetChilds(EstateRentClasses.RentObject)){
Area += rentObject.GetDouble("RentArea",0);
}
FSumArea += Area;
return WorkUtils.FormatingNumber(Area);
}
private string GetApartmentAddr(DataObject process)
{
if (process["BuildingID"].IsNull){
return string.Empty;
}
DataObject building = process.GetLink("BuildingID");
DataObjectChildList postAddrChildList = building.GetChilds(EstateRentClasses.PostAddr);
if(postAddrChildList.Count == 0){
return string.Empty;
}
return postAddrChildList.First.GetViewHtml("WithoutIndex");
}
private string GetPretenderName(DataObject process)
{
DataObjectChildList pretenderChildList = process.GetChilds(EstateRentClasses.Pretender);
if(pretenderChildList.Count == 0){
return string.Empty;
}
DataObject pretender = pretenderChildList.First;
if (pretender["Subject"].IsNull){
return string.Empty;
}
return pretender.GetLink("Subject").GetViewHtml("PostAddrView");
}
// By /////////////////////////////////////////////////////////////////////////////////
private string GetPretenderINN(DataObject process)
{
DataObjectChildList pretenderChildList = process.GetChilds(EstateRentClasses.Pretender);
if (pretenderChildList.Count == 0)
{
return string.Empty;
}
DataObject pretender = pretenderChildList.First;
if (pretender["Inn"].IsNull)
{
return string.Empty;
}
DataObject childPretender=pretender.GetLink("Subject")[0];
childPretender.GetString("Inn", string.Empty);
return childPretender.Inn;
}
//////////////////////////////////////////////////////////////////////////////////////////////////
private string GetContractCode(DataObject process)
{
if(!process["RootRCP"].IsNull) {
process = process.GetLink("RootRCP");
}
return EstateUtils.GetContract(process).GetString("ContractCode", string.Empty);
}
private string GetContractNo(DataObject process)
{
if (!process["RootRCP"].IsNull){
process = process.GetLink("RootRCP");
}
return EstateUtils.GetContract(process).GetString("ContractNo", string.Empty);
}
private void FormingHeaderDataTable(TableRender table)
{
TableRow row = new TableRow();
table.AddReportCell(row, "<b>Номер договора</b>");
table.AddReportCell(row, "<b>Шифр</b>");
table.AddReportCell(row, "<b>Арендатор</b>");
// By /////////////////////////////////////////////////////////////
table.AddReportCell(row, "<b>ИНН арендатора</b>");
///////////////////////////////////////////////////////////////////////////
table.AddReportCell(row, "<b>Адрес помещения</b>");
table.AddReportCell(row, "<b>Общая площадь(кв.м.)</b>");
table.AddReportCell(row, "<b>Арендная плата в месяц(руб.)</b>");
table.AddReportCell(row, "<b>Установленное сальдо(руб.)</b>");
table.AddReportCell(row, "<b>Начислено всего (руб.)</b>");
table.AddReportCell(row, "<b>Поступило всего (руб.)</b>");
table.AddReportCell(row, "<b>Списано всего (руб.)</b>");
table.AddReportCell(row, "<b>Перевод платежей прошлых периодов (руб.)</b>");
table.AddReportCell(row, "<b>Перевод долга/платежей (руб.)</b>");
table.AddReportCell(row, "<b>Сальдо (руб.)</b>");
table.AddReportCell(row, "<b>Пеня сальдо (руб.)</b>");
table.AddReportCell(row, "<b>Кол.мес.</b>");
table.TableReport.Rows.Add(row);
}
private bool ContractStateKindIsCorrect(DataObject process)
{
ProcessStateKind processStateKind = EstateUtils.GetProcessState(process, FCurrentDate);
if (ddContractStateKindList.SelectedItem.Value == "Active")
{
if(processStateKind == ProcessStateKind.Действует){
return true;
}
}
if (ddContractStateKindList.SelectedItem.Value == "Break")
{
if(processStateKind == ProcessStateKind.Расторгнут){
return true;
}
}
if (ddContractStateKindList.SelectedItem.Value == "All")
{
if(processStateKind != ProcessStateKind.Оформляется){
return true;
}
}
return false;
}
}
Тут ещё код класса объекта, который он использует для запроса данных:
1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14. 15. 16. 17. 18. 19. 20. 21. 22. 23. 24. 25. 26. 27. 28. 29. 30. 31. 32. 33. 34. 35. 36. 37. 38. 39. 40. 41. 42. 43. 44. 45. 46. 47. 48. 49. 50. 51. 52. 53. 54. 55. 56. 57. 58. 59. 60. 61. 62. 63. 64. 65. 66. 67. 68. 69. 70. 71. 72. 73. 74. 75. 76. 77. 78. 79. 80. 81. 82. 83. 84. 85. 86. 87. 88. 89. 90. 91. 92. 93. 94. 95. 96. 97. 98. 99. 100. 101. 102. 103.
namespace Integro.InMeta.Estate.Forms.EstateRent
{
public class RentClasses
{
public const string Payment = "Estate/RentPayment";
public const string RentBalance = "Estate/RentBalance";
// public const string BalanceTrasfer = "Estate/RentBalanceTransfer";
public const string PostAddr = "General/PostAddr";
public const string ObjectState = "General/ObjectState";
public const string StateKind = "General/ObjectStateKind";
public const string PaymentCharge = "Estate/RentPaymentCharge";
public const string RentSPAPaymentLink = "Estate/RentSPAPaymentLink";
public const string PaymentStep = "Estate/RentPaymentStep";
}
public class LandRentClasses : RentClasses
{
public const string Process = "Land/RentContractProcess";
public const string Contract = "Land/RentContract";
public const string RentObject = "Land/RentObject";
public const string Pretender = "Land/RentPretender";
public const string Calculation = "Land/RentCalculation";
public const string Lessor = "Land/RentLessor";
public const string ProcessKind = "Land/RentContractProcessKind";
public const string LotGroundCategory = "Land/LotGroundCategory";
public const string CalculationObjectManual = "Land/RentCalculationObjectManual";
public const string ContractRegistration = "Land/RentContractRegistration";
public const string RentAgreementCanceled = "Land/RentAgreementCanceled";
public const string BalanceTrasfer = "Land/RentBalanceTransfer";
}
public class LandFactUsingClasses
{
public const string Process = "Land/FactUsingProcess";
public const string Contract = "Land/FactUsingContract";
public const string RentObject = "Land/FactUsingObject";
public const string Pretender = "Land/FactUsingPretender";
public const string Calculation = "Land/FactUsingCalculation";
public const string Lessor = "Land/FactUsingLessor";
public const string ProcessKind = "Land/RentContractProcessKind";
public const string LotGroundCategory = "Land/LotGroundCategory";
public const string CalculationObjectManual = "Land/FactUsingCalculationObjectManual";
public const string RentAgreementCanceled = "Land/RentAgreementCanceled";
}
public class EstateRentClasses: RentClasses
{
public const string Process = "Estate/RentContractProcess";
public const string Contract = "Estate/RentContract";
public const string RentObject = "Estate/RentObject";
public const string Pretender = "Estate/RentPretender";
public const string Calculation = "Estate/RentCalculation";
public const string Lessor = "Estate/RentLessor";
public const string ProcessKind = "Estate/RentContractProcessKind";
public const string BalanceHolder = "Estate/RentBalanceHolder";
public const string BalanceTrasfer = "Estate/RentBalanceTransfer";
}
public class PersonalAccountClasses
{
public const string AccountProcessLink = "Estate/PersonalAccountProcessLink";
public const string PersonalAccount = "Estate/PersonalAccount";
}
public class ActionAtLawClasses
{
public const string Bargain = "Estate/BargainForActionAtLaw";
public const string Percent = "Estate/Percent";
public const string Payment = "Estate/Payment";
public const string Calculation = "Estate/ActionAtLawCalculation";
public const string CalculationObjectManual = "Estate/ActionAtLawCalculationObjectManual";
public const string ObjectOfActionAtLaw = "Estate/ObjectOfActionAtLaw";
public const string Respondent = "Estate/Respondent";
public const string ActionAtLaw = "Estate/ActionAtLaw";
public const string LawCase = "Estate/LawCase";
public const string CourtDecision = "Estate/CourtDecision";
public const string Appeal = "Estate/Appeal";
public const string Cassation = "Estate/Cassation";
}
public class ConstrClasess
{
public const string Apartment = "Constr/Apartment";
public const string Building= "Constr/Building";
}
public class SubjectClasess
{
public const string Org = "Subject/Org";
public const string Person = "Subject/Person";
public const string OrgStat = "Subject/OrgStat";
public const string Activity = "Subject/Activity";
}
public class EstateSaleClasses
{
public const string Process = "Estate/PurchaseSaleProcess";
public const string SaleObject = "Estate/PurchaseSaleObject";
public const string Contract = "Estate/PurchaseSaleContract";
public const string Purchaser = "Estate/PurchaseSaleProcessPurchaser";
public const string Calculation = "Estate/SaleCalculation";
}
}
|