Merge lp:cbadmin into lp:cbadmin/release

Proposed by McSeem
Status: Approved
Approved by: McSeem
Approved revision: 116
Proposed branch: lp:cbadmin
Merge into: lp:cbadmin/release
Diff against target: 28955 lines (+13612/-5443)
174 files modified
nbproject/build-impl.xml (+202/-55)
nbproject/genfiles.properties (+5/-2)
nbproject/private/private.properties (+2/-2)
nbproject/private/private.xml (+94/-50)
nbproject/private/profiler/configurations.xml (+141/-0)
nbproject/project.properties (+3/-1)
src/backupscripts/mysqlbackup (+1/-1)
src/backupscripts/mysqlrestore (+4/-1)
src/build-info.properties (+4/-2)
src/build.number (+2/-2)
src/cayenne.xml (+6/-3)
src/cbadmin.map.xml (+71/-48)
src/cbadmin.properties (+15/-1)
src/cbadmin/business/Money.java (+334/-0)
src/cbadmin/business/PaymentVendorInterface.java (+52/-0)
src/cbadmin/business/Price.java (+100/-0)
src/cbadmin/business/PriceInterface.java (+62/-0)
src/cbadmin/business/PriceVendorDefault.java (+161/-0)
src/cbadmin/business/PriceVendorFlight.java (+237/-0)
src/cbadmin/business/PriceVendorInterface.java (+54/-0)
src/cbadmin/business/PriceVendorProto.java (+92/-0)
src/cbadmin/business/ReporterInterface.java (+49/-0)
src/cbadmin/business/xlsbuilder.java (+572/-0)
src/cbadmin/entity2/Block.java (+143/-28)
src/cbadmin/entity2/Client.java (+24/-3)
src/cbadmin/entity2/Flight.java (+61/-4)
src/cbadmin/entity2/FlightProgram.java (+13/-1)
src/cbadmin/entity2/FlightProgramPeriods.java (+17/-2)
src/cbadmin/entity2/ListAge.java (+14/-5)
src/cbadmin/entity2/ListAirline.java (+17/-0)
src/cbadmin/entity2/ListClass.java (+7/-0)
src/cbadmin/entity2/ListEmail.java (+7/-0)
src/cbadmin/entity2/ListPayMethod.java (+31/-0)
src/cbadmin/entity2/Passenger.java (+18/-28)
src/cbadmin/entity2/Payment.java (+56/-29)
src/cbadmin/entity2/Reservation.java (+274/-41)
src/cbadmin/entity2/ReservationUl.java (+1/-0)
src/cbadmin/entity2/Service.java (+11/-1)
src/cbadmin/entity2/ServicePrice.java (+19/-1)
src/cbadmin/entity2/auto/_Block.java (+14/-3)
src/cbadmin/entity2/auto/_Client.java (+8/-0)
src/cbadmin/entity2/auto/_ClientFl.java (+8/-0)
src/cbadmin/entity2/auto/_ClientUl.java (+8/-0)
src/cbadmin/entity2/auto/_FlightProgram.java (+19/-8)
src/cbadmin/entity2/auto/_ListAge.java (+20/-15)
src/cbadmin/entity2/auto/_ListCountry.java (+11/-0)
src/cbadmin/entity2/auto/_ListEmail.java (+67/-0)
src/cbadmin/entity2/auto/_ListPayMethod.java (+33/-0)
src/cbadmin/entity2/auto/_Passenger.java (+8/-0)
src/cbadmin/entity2/auto/_Payment.java (+11/-0)
src/cbadmin/entity2/auto/_Reservation.java (+40/-24)
src/cbadmin/entity2/auto/_ReservationFl.java (+8/-0)
src/cbadmin/entity2/auto/_ReservationUl.java (+16/-0)
src/cbadmin/entity2/auto/_Service.java (+8/-0)
src/cbadmin/entity2/db_interface.java (+90/-20)
src/cbadmin/gui/PanelReservationFlight.form (+57/-70)
src/cbadmin/gui/PanelReservationFlight.java (+257/-111)
src/cbadmin/gui/PanelReservationInterface.java (+47/-0)
src/cbadmin/gui/PanelReservationServices.form (+45/-69)
src/cbadmin/gui/PanelReservationServices.java (+267/-156)
src/cbadmin/gui/dic_ClientFl.form (+40/-72)
src/cbadmin/gui/dic_ClientFl.java (+41/-46)
src/cbadmin/gui/dic_ClientUl.form (+195/-199)
src/cbadmin/gui/dic_ClientUl.java (+150/-130)
src/cbadmin/gui/dic_ListAirline.form (+4/-14)
src/cbadmin/gui/dic_ListAirline.java (+6/-16)
src/cbadmin/gui/dic_ListAirport.java (+2/-2)
src/cbadmin/gui/dic_ListCity.java (+3/-3)
src/cbadmin/gui/dic_ListEmail.form (+299/-0)
src/cbadmin/gui/dic_ListEmail.java (+335/-0)
src/cbadmin/gui/dic_ListFl.java (+0/-6)
src/cbadmin/gui/dic_ListPayMethod.form (+262/-0)
src/cbadmin/gui/dic_ListPayMethod.java (+309/-11)
src/cbadmin/gui/dic_ListUl.form (+27/-17)
src/cbadmin/gui/dic_ListUl.java (+29/-15)
src/cbadmin/gui/dic_PreferredVendor.java (+2/-2)
src/cbadmin/gui/dic_helper.java (+221/-34)
src/cbadmin/gui/dic_userrole.java (+2/-1)
src/cbadmin/gui/main.form (+12/-0)
src/cbadmin/gui/main.java (+34/-26)
src/cbadmin/gui/support/JTextFieldNumber.java (+174/-0)
src/cbadmin/gui/support/PanelDictionaryCombo.java (+134/-43)
src/cbadmin/gui/support/PanelMultiValue.java (+16/-15)
src/cbadmin/gui/support/PriceFieldsHelper.java (+93/-0)
src/cbadmin/gui/support/SettingsMgr.java (+22/-3)
src/cbadmin/gui/support/proto2.java (+124/-19)
src/cbadmin/gui/win_flight.form (+52/-84)
src/cbadmin/gui/win_flight.java (+223/-235)
src/cbadmin/gui/win_flight_add.form (+45/-59)
src/cbadmin/gui/win_flight_add.java (+78/-59)
src/cbadmin/gui/win_flight_block_add.form (+20/-66)
src/cbadmin/gui/win_flight_block_add.java (+30/-59)
src/cbadmin/gui/win_flight_program_add.form (+32/-54)
src/cbadmin/gui/win_flight_program_add.java (+95/-44)
src/cbadmin/gui/win_flight_program_period_add.java (+23/-27)
src/cbadmin/gui/win_flight_report.java (+2/-2)
src/cbadmin/gui/win_flightload.form (+9/-16)
src/cbadmin/gui/win_flightload.java (+169/-150)
src/cbadmin/gui/win_flightload_passenger_details.form (+123/-0)
src/cbadmin/gui/win_flightload_passenger_details.java (+228/-0)
src/cbadmin/gui/win_offer.form (+4/-2)
src/cbadmin/gui/win_offer.java (+5/-3)
src/cbadmin/gui/win_payment_add.java (+27/-12)
src/cbadmin/gui/win_payment_add_income.form (+472/-0)
src/cbadmin/gui/win_payment_add_income.java (+903/-0)
src/cbadmin/gui/win_payment_block.java (+2/-2)
src/cbadmin/gui/win_payment_reservation.form (+7/-30)
src/cbadmin/gui/win_payment_reservation.java (+298/-114)
src/cbadmin/gui/win_payment_service.form (+28/-58)
src/cbadmin/gui/win_payment_service.java (+257/-202)
src/cbadmin/gui/win_price.java (+1/-1)
src/cbadmin/gui/win_reservations.form (+224/-138)
src/cbadmin/gui/win_reservations.java (+726/-501)
src/cbadmin/gui/win_reservations_dependent.form (+2/-2)
src/cbadmin/gui/win_reservations_dependent.java (+3/-9)
src/cbadmin/gui/win_reservations_set_accdate.form (+107/-0)
src/cbadmin/gui/win_reservations_set_accdate.java (+167/-0)
src/cbadmin/gui/win_reservations_set_billdate.form (+107/-0)
src/cbadmin/gui/win_reservations_set_billdate.java (+181/-0)
src/cbadmin/gui/win_reservations_set_billldate.form (+0/-107)
src/cbadmin/gui/win_reservations_set_billldate.java (+0/-181)
src/cbadmin/gui/win_statuscheck.form (+18/-18)
src/cbadmin/gui/win_statuscheck.java (+19/-19)
src/cbadmin/gui/win_statuscheck_past.form (+133/-60)
src/cbadmin/gui/win_statuscheck_past.java (+177/-87)
src/cbadmin/util/CommandLineMgr.java (+44/-0)
src/cbadmin/util/CurrencyMgr.java (+9/-3)
src/cbadmin/util/CustomSMTPAppender.java (+85/-0)
src/cbadmin/util/EmailMgr.java (+139/-0)
src/cbadmin/util/InstallMgr.java (+47/-21)
src/cbadmin/util/JasperReporter.java (+48/-0)
src/cbadmin/util/Logger.java (+7/-21)
src/cbadmin/util/PaymentMgr.java (+56/-0)
src/cbadmin/util/PluginMgr.java (+72/-62)
src/cbadmin/util/PriceMgr.java (+64/-6)
src/cbadmin/util/PriceVendorDefault.java (+0/-266)
src/cbadmin/util/PriceVendorFlight.java (+0/-229)
src/cbadmin/util/PriceVendorInterface.java (+0/-43)
src/cbadmin/util/PropertiesMgr.java (+18/-1)
src/cbadmin/util/ReporterInterface.java (+0/-49)
src/cbadmin/util/ReservationMgr.java (+36/-1)
src/cbadmin/util/UpdateMgr.java (+101/-27)
src/cbadmin/util/email.java (+0/-71)
src/cbadmin/util/utils.java (+198/-23)
src/cbadmin/util/xlsbuilder.java (+0/-512)
src/cbadminExportPnlPlugin.map.xml (+2/-0)
src/cbadminNode.driver.xml (+2/-2)
src/cbadminPluginDeposit.map.xml (+60/-0)
src/cbadminPluginDocpack.map.xml (+4/-2)
src/cbadminPluginHotel.map.xml (+212/-4)
src/cbadminPluginPayrequest.map.xml (+0/-8)
src/cbadminPluginRcc.map.xml (+190/-0)
src/cbadminPluginTour.map.xml (+40/-13)
src/cbadminPluginWeb.map.xml (+137/-12)
src/di.config (+3/-0)
src/local.properties (+176/-122)
src/log4j.xml (+22/-9)
src/plugins.docpack.cbadmin.properties (+0/-2)
src/plugins.loadcurrency.cbadmin.properties (+1/-0)
src/plugins/BlockListenerPlugin.java (+23/-0)
src/plugins/ReservationPlugin.java (+7/-0)
src/plugins/core/impl/CorePluginImpl.java (+81/-70)
src/plugins/core/impl/updates/11.sql (+9/-0)
src/plugins/core/impl/updates/12.sql (+2/-0)
src/plugins/core/impl/updates/13.sql (+14/-0)
src/plugins/core/impl/updates/14.sql (+11/-0)
src/plugins/core/impl/updates/15.h2.sql (+19/-0)
src/plugins/core/impl/updates/15.mysql.sql (+19/-0)
src/plugins/core/impl/updates/15.sql (+11/-0)
src/plugins/core/impl/updates/16.sql (+48/-0)
src/plugins/core/impl/updates/17.sql (+22/-0)
src/plugins/core/impl/updates/18.sql (+12/-0)
src/plugins/core/impl/updates/7.sql (+1/-1)
src/readme.txt (+9/-1)
To merge this branch: bzr merge lp:cbadmin
Reviewer Review Type Date Requested Status
McSeem Approve
Review via email: mp+50558@code.launchpad.net

Description of the change

изменения со времени последнего релиза

To post a comment you must log in.
Revision history for this message
McSeem (mcseemz) wrote :

я же автор

review: Approve
lp:cbadmin updated
117. By McSeem

множественные изменения

118. By McSeem

новая система конфигурации плагинов через dependenci injection
настраиваемый тайминг при печати в картинку
устранение ошибок

119. By McSeem

мелкие исправления
в контекст EmailMgr добавлен dateFormat
переход на netbeans 7
попытки интеграции JasperReports

Unmerged revisions

119. By McSeem

мелкие исправления
в контекст EmailMgr добавлен dateFormat
переход на netbeans 7
попытки интеграции JasperReports

118. By McSeem

новая система конфигурации плагинов через dependenci injection
настраиваемый тайминг при печати в картинку
устранение ошибок

117. By McSeem

множественные изменения

116. By McSeem

ошибка при отсутствии курса валюты при занесении оплаты - теперь визуальное предупреждение, а не фатальный сбой
ошибка в новой несохраненной заявке, если при этом работать со справочником городов
добавлено бизнес правило: нельзя аннулировать заявки, если по некоторым услугам проведены оплаты поставщикам. Даже если впоследставии оплаты удалены
Исправлены ошибки при переводе заявки в недоступный статус. После предупреждения о невозможности позволял сохранить заявку в новом статусе.
мелкие правки

115. By McSeem

Взаимозависимые заявки - поправлена шапка окна
#704334 Добавить столбец "Комиссия" на закладку поиска
Оплаты по заявкам - в два раза ускорен поиск и отображение оплат
Отправка письма в случае ошибки - теперь включает информацию о машине и пользователе

114. By McSeem

автоматическая отправка отправка текста ошибки при ошибке - настройки log4j
переход на log4j 1.2.16
Заявки - ошибка инициализации городов вылета и прилёта.

#701498 Important: неверная привязка пассажиров к блокам в подтверждении
Заявки/перелеты - Ошибка при обновлении списка городов на возврат при изменении его в справочнике при открытой заявке

Заявки - в новой заявке дата оплаты = +3 рабочих дня
Заявки - в новой заявке не сбрасывался комментарий
Заявки - смена страны корректно отрабатывается закладками

Заявки/перелеты - косметика закладки, теперь выделение не сбрасывается при сохранении, обновляются услуги перелета на закладке услуг
Оплаты по блокам/услугам - не сохранялась оплата из-за отсутсвия значения "комиссия посреднику".
Оплаты по услугам - на закладке оплат поля с датами зависели от галок на закладке услуг
Оплаты/добавление оплаты - поле "рубли +%" теперь показывает остаток к оплате с учетом процентов
Справочники - исправлено задвоение данных в талицах сложных справочников
Заявки/услуги - при сохранении балун появлялся не у той кнопки
Заявки/услуги - в дропдауне пассажиров показывались только имена

113. By McSeem

Исправлена ошибка при добавлении первой записи в пустой справочник
Исправлена ошибка при отрисовке таблицы поиска в заявках
Изменение справочника мультипанели сбрасывало значения не из справочников
Ошибка при открытии заявки, если в рейсе вылета/возврата не прописано время
Добавление рейса - авиакомпанию можно добавлять из окна
Добавление рейса - Исправление ошибки при сохранении, если не выбрана авиакомпания
Заявки - закладка услуг - обновление пассажиров на ходу, косметика
Заявки - закладка услуг - обновление списка услуг на ходу, например, при сохранении перелета
Справочники - исправлена ситуация, при которой кнопка "Удалить" не переименовывалась в "Восстановить"
Справочники - исправление ошибки с задвоением строки при изменении/удалении
Сообщения об ошибках при обновлении форматируются так, чтобы помещаться на экран
исправлена ошибка в закладке услуг, при которой не обновлялись услуги, если ни одной не было выделено
Исправление ошибки в комбопанели, при которой она самостоятельно переключалась в enabled после обновления содержимого

112. By McSeem

Мелкие доработки по замечаниям
заявки - перелеты - список зависимы
заявки - заявка - название заказчика
флаг flightProgramOnly в cbadmin.properties, который скрывает кнопку добавления рейсов в заявках-перелетах
Заявки-перелеты - перенос кнопку сохранения
переделана работа с хранением и поиском цен
#673376 В заявках не показывается время вылета
#680546 В заявке на вкладке рассадки не показывается блок вылета
#677517 Не удается удалить рейс
#677514 Не заменяются данные в справочнике ЮЛ
#617430 проставление "+%" = 0 в оплате при выборе валюты заявки
ошибка, в окне добавления оплат светилась служебная валюта "---", выбор которой рушил окно.

Недавно! - стобец "дата оплаты"
Недавно - фильтр по номеру документа
Скоро! - после переименования остается в меню окон
Рейсы-блоки - переименовать кнопки
заявки: поиск по имени/фамилии туриста
Название авиакомпании включает код теперь
#683199 переделать закладку комментария в заявке
#683226 В отчетах сумма оплат - за минусом комиссии
#683225 Калькулятор в оплате
Скорость отчетов должна повыситься на 30%
Справочник оплат: флаг "оплата по курсу даты подтверждения"
Оплаты: блокировка даты оплаты
Оплаты: рубли - остаток по курсу даты оплаты
#683201 комментарии и зависимости на вкладке "Туристы"
Добавление оплаты. Добавить поле "ЦБ+%" для справки
Исправление ошибки при загрузке курсов
Недавно - итого по валютам в таблицу снизу
Разграничение доступа к полю "скидка"
поиск в физ-юрлицах - по Ctrl-F на таблице
радикально увеличена скорость загрузки справочников физ-юрлиц
резервирование/восстановлеие теперь привязано к текущему имени базы данных, а не к каноническому

111. By McSeem

payments modification

110. By McSeem

Заявки-перелеты - перенос кнопку сохранения
переделана работа с хранением и поиском цен

#673376 В заявках не показывается время вылета
#680546 В заявке на вкладке рассадки не показывается блок вылета
#677517 Не удается удалить рейс
#677514 Не заменяются данные в справочнике ЮЛ
#617430 проставление "+%" = 0 в оплате при выборе валюты заявки

ошибка, в окне добавления оплат светилась служебная валюта "---", выбор которой рушил окно.

Недавно! - стобец "дата оплаты"
Недавно - фильтр по номеру документа
Скоро! - после переименования остается в меню окон
Рейсы-блоки - переименовать кнопки

CB: депозиты - окно занесения
Оплаты - комиссия посреднику

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'docs/model4.mwb'
2Binary files docs/model4.mwb 2010-11-14 22:58:19 +0000 and docs/model4.mwb 2011-04-25 18:28:30 +0000 differ
3=== modified file 'docs/model4.mwb.bak'
4Binary files docs/model4.mwb.bak 2010-11-14 22:58:19 +0000 and docs/model4.mwb.bak 2011-04-25 18:28:30 +0000 differ
5=== modified file 'nbproject/build-impl.xml'
6--- nbproject/build-impl.xml 2010-11-18 09:20:32 +0000
7+++ nbproject/build-impl.xml 2011-04-25 18:28:30 +0000
8@@ -81,7 +81,14 @@
9 </target>
10 <target depends="-pre-init,-init-private,-init-libraries,-init-user,-init-project,-init-macrodef-property" name="-do-init">
11 <available file="${manifest.file}" property="manifest.available"/>
12- <available file="${application.splash}" property="splashscreen.available"/>
13+ <condition property="splashscreen.available">
14+ <and>
15+ <not>
16+ <equals arg1="${application.splash}" arg2="" trim="true"/>
17+ </not>
18+ <available file="${application.splash}"/>
19+ </and>
20+ </condition>
21 <condition property="main.class.available">
22 <and>
23 <isset property="main.class"/>
24@@ -96,8 +103,14 @@
25 <isset property="main.class.available"/>
26 </and>
27 </condition>
28+ <condition property="do.archive">
29+ <not>
30+ <istrue value="${jar.archive.disabled}"/>
31+ </not>
32+ </condition>
33 <condition property="do.mkdist">
34 <and>
35+ <isset property="do.archive"/>
36 <isset property="libs.CopyLibs.classpath"/>
37 <not>
38 <istrue value="${mkdist.disabled}"/>
39@@ -110,40 +123,41 @@
40 <isset property="do.mkdist"/>
41 </and>
42 </condition>
43- <condition property="manifest.available+main.class+mkdist.available+splashscreen.available">
44- <and>
45- <istrue value="${manifest.available+main.class+mkdist.available}"/>
46- <istrue value="${splashscreen.available}"/>
47- </and>
48- </condition>
49- <condition property="do.archive">
50- <not>
51- <istrue value="${jar.archive.disabled}"/>
52- </not>
53- </condition>
54 <condition property="do.archive+manifest.available">
55 <and>
56 <isset property="manifest.available"/>
57 <istrue value="${do.archive}"/>
58 </and>
59 </condition>
60+ <condition property="do.archive+main.class.available">
61+ <and>
62+ <isset property="main.class.available"/>
63+ <istrue value="${do.archive}"/>
64+ </and>
65+ </condition>
66+ <condition property="do.archive+splashscreen.available">
67+ <and>
68+ <isset property="splashscreen.available"/>
69+ <istrue value="${do.archive}"/>
70+ </and>
71+ </condition>
72 <condition property="do.archive+manifest.available+main.class">
73 <and>
74 <istrue value="${manifest.available+main.class}"/>
75 <istrue value="${do.archive}"/>
76 </and>
77 </condition>
78- <condition property="do.archive+manifest.available+main.class+mkdist.available">
79- <and>
80- <istrue value="${manifest.available+main.class+mkdist.available}"/>
81- <istrue value="${do.archive}"/>
82- </and>
83+ <condition property="manifest.available-mkdist.available">
84+ <or>
85+ <istrue value="${manifest.available}"/>
86+ <isset property="do.mkdist"/>
87+ </or>
88 </condition>
89- <condition property="do.archive+manifest.available+main.class+mkdist.available+splashscreen.available">
90- <and>
91- <istrue value="${manifest.available+main.class+mkdist.available+splashscreen.available}"/>
92- <istrue value="${do.archive}"/>
93- </and>
94+ <condition property="manifest.available+main.class-mkdist.available">
95+ <or>
96+ <istrue value="${manifest.available+main.class}"/>
97+ <isset property="do.mkdist"/>
98+ </or>
99 </condition>
100 <condition property="have.tests">
101 <or>
102@@ -199,8 +213,17 @@
103 <condition else="" property="endorsed.classpath.cmd.line.arg" value="-Xbootclasspath/p:'${toString:endorsed.classpath.path}'">
104 <length length="0" string="${endorsed.classpath}" when="greater"/>
105 </condition>
106- <property name="javac.fork" value="false"/>
107+ <condition else="false" property="jdkBug6558476">
108+ <and>
109+ <matches pattern="1\.[56]" string="${java.specification.version}"/>
110+ <not>
111+ <os family="unix"/>
112+ </not>
113+ </and>
114+ </condition>
115+ <property name="javac.fork" value="${jdkBug6558476}"/>
116 <property name="jar.index" value="false"/>
117+ <property name="jar.index.metainf" value="${jar.index}"/>
118 <available file="${meta.inf.dir}/persistence.xml" property="has.persistence.xml"/>
119 </target>
120 <target name="-post-init">
121@@ -328,7 +351,9 @@
122 <delete>
123 <files includesfile="${javac.includesfile.binary}"/>
124 </delete>
125- <delete file="${javac.includesfile.binary}"/>
126+ <delete>
127+ <fileset file="${javac.includesfile.binary}"/>
128+ </delete>
129 </sequential>
130 </macrodef>
131 </target>
132@@ -338,7 +363,8 @@
133 <attribute default="${excludes}" name="excludes"/>
134 <attribute default="**" name="testincludes"/>
135 <sequential>
136- <junit dir="${work.dir}" errorproperty="tests.failed" failureproperty="tests.failed" fork="true" showoutput="true" tempdir="${build.dir}">
137+ <property name="junit.forkmode" value="perTest"/>
138+ <junit dir="${work.dir}" errorproperty="tests.failed" failureproperty="tests.failed" fork="true" forkmode="${junit.forkmode}" showoutput="true" tempdir="${build.dir}">
139 <batchtest todir="${build.test.results.dir}">
140 <fileset dir="${test.src.dir}" excludes="@{excludes},${excludes}" includes="@{includes}">
141 <filename name="@{testincludes}"/>
142@@ -354,11 +380,56 @@
143 <formatter type="brief" usefile="false"/>
144 <formatter type="xml"/>
145 <jvmarg line="${endorsed.classpath.cmd.line.arg}"/>
146+ <jvmarg value="-ea"/>
147 <jvmarg line="${run.jvmargs}"/>
148 </junit>
149 </sequential>
150 </macrodef>
151 </target>
152+ <target depends="-profile-pre-init, init, -profile-post-init, -profile-init-macrodef-profile, -profile-init-check" name="profile-init"/>
153+ <target name="-profile-pre-init">
154+ <!-- Empty placeholder for easier customization. -->
155+ <!-- You can override this target in the ../build.xml file. -->
156+ </target>
157+ <target name="-profile-post-init">
158+ <!-- Empty placeholder for easier customization. -->
159+ <!-- You can override this target in the ../build.xml file. -->
160+ </target>
161+ <target name="-profile-init-macrodef-profile">
162+ <macrodef name="resolve">
163+ <attribute name="name"/>
164+ <attribute name="value"/>
165+ <sequential>
166+ <property name="@{name}" value="${env.@{value}}"/>
167+ </sequential>
168+ </macrodef>
169+ <macrodef name="profile">
170+ <attribute default="${main.class}" name="classname"/>
171+ <element name="customize" optional="true"/>
172+ <sequential>
173+ <property environment="env"/>
174+ <resolve name="profiler.current.path" value="${profiler.info.pathvar}"/>
175+ <java classname="@{classname}" dir="${profiler.info.dir}" fork="true" jvm="${profiler.info.jvm}">
176+ <jvmarg value="${profiler.info.jvmargs.agent}"/>
177+ <jvmarg line="${profiler.info.jvmargs}"/>
178+ <env key="${profiler.info.pathvar}" path="${profiler.info.agentpath}:${profiler.current.path}"/>
179+ <arg line="${application.args}"/>
180+ <classpath>
181+ <path path="${run.classpath}"/>
182+ </classpath>
183+ <syspropertyset>
184+ <propertyref prefix="run-sys-prop."/>
185+ <mapper from="run-sys-prop.*" to="*" type="glob"/>
186+ </syspropertyset>
187+ <customize/>
188+ </java>
189+ </sequential>
190+ </macrodef>
191+ </target>
192+ <target depends="-profile-pre-init, init, -profile-post-init, -profile-init-macrodef-profile" name="-profile-init-check">
193+ <fail unless="profiler.info.jvm">Must set JVM to use for profiling in profiler.info.jvm</fail>
194+ <fail unless="profiler.info.jvmargs.agent">Must set profiler agent JVM arguments in profiler.info.jvmargs.agent</fail>
195+ </target>
196 <target depends="-init-debug-args" name="-init-macrodef-nbjpda">
197 <macrodef name="nbjpdastart" uri="http://www.netbeans.org/ns/j2se-project/1">
198 <attribute default="${main.class}" name="name"/>
199@@ -453,6 +524,7 @@
200 </target>
201 <target name="-init-macrodef-copylibs">
202 <macrodef name="copylibs" uri="http://www.netbeans.org/ns/j2se-project/3">
203+ <attribute default="${manifest.file}" name="manifest"/>
204 <element name="customize" optional="true"/>
205 <sequential>
206 <property location="${build.classes.dir}" name="build.classes.dir.resolved"/>
207@@ -468,7 +540,7 @@
208 </chainedmapper>
209 </pathconvert>
210 <taskdef classname="org.netbeans.modules.java.j2seproject.copylibstask.CopyLibs" classpath="${libs.CopyLibs.classpath}" name="copylibs"/>
211- <copylibs compress="${jar.compress}" index="${jar.index}" jarfile="${dist.jar}" manifest="${manifest.file}" runtimeclasspath="${run.classpath.without.build.classes.dir}">
212+ <copylibs compress="${jar.compress}" index="${jar.index}" indexMetaInf="${jar.index.metainf}" jarfile="${dist.jar}" manifest="@{manifest}" runtimeclasspath="${run.classpath.without.build.classes.dir}">
213 <fileset dir="${build.classes.dir}"/>
214 <manifest>
215 <attribute name="Class-Path" value="${jar.classpath}"/>
216@@ -597,10 +669,10 @@
217 <!-- Empty placeholder for easier customization. -->
218 <!-- You can override this target in the ../build.xml file. -->
219 </target>
220- <target depends="init,compile,-pre-pre-jar,-pre-jar" if="do.archive" name="-do-jar-without-manifest" unless="manifest.available">
221+ <target depends="init,compile,-pre-pre-jar,-pre-jar" if="do.archive" name="-do-jar-without-manifest" unless="manifest.available-mkdist.available">
222 <j2seproject1:jar/>
223 </target>
224- <target depends="init,compile,-pre-pre-jar,-pre-jar" if="do.archive+manifest.available" name="-do-jar-with-manifest" unless="manifest.available+main.class">
225+ <target depends="init,compile,-pre-pre-jar,-pre-jar" if="do.archive+manifest.available" name="-do-jar-with-manifest" unless="manifest.available+main.class-mkdist.available">
226 <j2seproject1:jar manifest="${manifest.file}"/>
227 </target>
228 <target depends="init,compile,-pre-pre-jar,-pre-jar" if="do.archive+manifest.available+main.class" name="-do-jar-with-mainclass" unless="manifest.available+main.class+mkdist.available">
229@@ -609,44 +681,53 @@
230 <j2seproject1:attribute name="Main-Class" value="${main.class}"/>
231 </j2seproject1:manifest>
232 </j2seproject1:jar>
233- <echo>To run this application from the command line without Ant, try:</echo>
234+ <echo level="info">To run this application from the command line without Ant, try:</echo>
235 <property location="${build.classes.dir}" name="build.classes.dir.resolved"/>
236 <property location="${dist.jar}" name="dist.jar.resolved"/>
237 <pathconvert property="run.classpath.with.dist.jar">
238 <path path="${run.classpath}"/>
239 <map from="${build.classes.dir.resolved}" to="${dist.jar.resolved}"/>
240 </pathconvert>
241- <echo>java -cp "${run.classpath.with.dist.jar}" ${main.class}</echo>
242- </target>
243- <target depends="init,compile,-pre-pre-jar,-pre-jar,-init-macrodef-copylibs" if="do.archive+manifest.available+main.class+mkdist.available+splashscreen.available" name="-do-jar-with-libraries-and-splashscreen">
244+ <echo level="info">java -cp "${run.classpath.with.dist.jar}" ${main.class}</echo>
245+ </target>
246+ <target depends="init" if="do.archive" name="-do-jar-with-libraries-create-manifest" unless="manifest.available">
247+ <tempfile deleteonexit="true" destdir="${build.dir}" property="tmp.manifest.file"/>
248+ <touch file="${tmp.manifest.file}" verbose="false"/>
249+ </target>
250+ <target depends="init" if="do.archive+manifest.available" name="-do-jar-with-libraries-copy-manifest">
251+ <tempfile deleteonexit="true" destdir="${build.dir}" property="tmp.manifest.file"/>
252+ <copy file="${manifest.file}" tofile="${tmp.manifest.file}"/>
253+ </target>
254+ <target depends="init,-do-jar-with-libraries-create-manifest,-do-jar-with-libraries-copy-manifest" if="do.archive+main.class.available" name="-do-jar-with-libraries-set-main">
255+ <manifest file="${tmp.manifest.file}" mode="update">
256+ <attribute name="Main-Class" value="${main.class}"/>
257+ </manifest>
258+ </target>
259+ <target depends="init,-do-jar-with-libraries-create-manifest,-do-jar-with-libraries-copy-manifest" if="do.archive+splashscreen.available" name="-do-jar-with-libraries-set-splashscreen">
260 <basename file="${application.splash}" property="splashscreen.basename"/>
261 <mkdir dir="${build.classes.dir}/META-INF"/>
262 <copy failonerror="false" file="${application.splash}" todir="${build.classes.dir}/META-INF"/>
263- <j2seproject3:copylibs>
264- <customize>
265- <attribute name="Main-Class" value="${main.class}"/>
266- <attribute name="SplashScreen-Image" value="META-INF/${splashscreen.basename}"/>
267- </customize>
268- </j2seproject3:copylibs>
269- <echo>To run this application from the command line without Ant, try:</echo>
270- <property location="${dist.jar}" name="dist.jar.resolved"/>
271- <echo>java -jar "${dist.jar.resolved}"</echo>
272- </target>
273- <target depends="init,compile,-pre-pre-jar,-pre-jar,-init-macrodef-copylibs" if="do.archive+manifest.available+main.class+mkdist.available" name="-do-jar-with-libraries" unless="splashscreen.available">
274- <j2seproject3:copylibs>
275- <customize>
276- <attribute name="Main-Class" value="${main.class}"/>
277- </customize>
278- </j2seproject3:copylibs>
279- <echo>To run this application from the command line without Ant, try:</echo>
280- <property location="${dist.jar}" name="dist.jar.resolved"/>
281- <echo>java -jar "${dist.jar.resolved}"</echo>
282- </target>
283+ <manifest file="${tmp.manifest.file}" mode="update">
284+ <attribute name="SplashScreen-Image" value="META-INF/${splashscreen.basename}"/>
285+ </manifest>
286+ </target>
287+ <target depends="init,-init-macrodef-copylibs,compile,-pre-pre-jar,-pre-jar,-do-jar-with-libraries-create-manifest,-do-jar-with-libraries-copy-manifest,-do-jar-with-libraries-set-main,-do-jar-with-libraries-set-splashscreen" if="do.mkdist" name="-do-jar-with-libraries-pack">
288+ <j2seproject3:copylibs manifest="${tmp.manifest.file}"/>
289+ <echo level="info">To run this application from the command line without Ant, try:</echo>
290+ <property location="${dist.jar}" name="dist.jar.resolved"/>
291+ <echo level="info">java -jar "${dist.jar.resolved}"</echo>
292+ </target>
293+ <target depends="-do-jar-with-libraries-pack" if="do.archive" name="-do-jar-with-libraries-delete-manifest">
294+ <delete>
295+ <fileset file="${tmp.manifest.file}"/>
296+ </delete>
297+ </target>
298+ <target depends="init,compile,-pre-pre-jar,-pre-jar,-do-jar-with-libraries-create-manifest,-do-jar-with-libraries-copy-manifest,-do-jar-with-libraries-set-main,-do-jar-with-libraries-set-splashscreen,-do-jar-with-libraries-pack,-do-jar-with-libraries-delete-manifest" name="-do-jar-with-libraries"/>
299 <target name="-post-jar">
300 <!-- Empty placeholder for easier customization. -->
301 <!-- You can override this target in the ../build.xml file. -->
302 </target>
303- <target depends="init,compile,-pre-jar,-do-jar-with-manifest,-do-jar-without-manifest,-do-jar-with-mainclass,-do-jar-with-libraries-and-splashscreen,-do-jar-with-libraries,-post-jar,jnlp" description="Build JAR." name="jar"/>
304+ <target depends="init,compile,-pre-jar,-do-jar-with-manifest,-do-jar-without-manifest,-do-jar-with-mainclass,-do-jar-with-libraries,-post-jar,jnlp" description="Build JAR." name="jar"/>
305 <!--
306 =================
307 EXECUTION SECTION
308@@ -712,6 +793,72 @@
309 </target>
310 <target depends="init,-pre-debug-fix,-do-debug-fix" if="netbeans.home" name="debug-fix"/>
311 <!--
312+ =================
313+ PROFILING SECTION
314+ =================
315+ -->
316+ <target depends="profile-init,compile" description="Profile a project in the IDE." if="netbeans.home" name="profile">
317+ <nbprofiledirect>
318+ <classpath>
319+ <path path="${run.classpath}"/>
320+ </classpath>
321+ </nbprofiledirect>
322+ <profile/>
323+ </target>
324+ <target depends="profile-init,compile-single" description="Profile a selected class in the IDE." if="netbeans.home" name="profile-single">
325+ <fail unless="profile.class">Must select one file in the IDE or set profile.class</fail>
326+ <nbprofiledirect>
327+ <classpath>
328+ <path path="${run.classpath}"/>
329+ </classpath>
330+ </nbprofiledirect>
331+ <profile classname="${profile.class}"/>
332+ </target>
333+ <!--
334+ =========================
335+ APPLET PROFILING SECTION
336+ =========================
337+ -->
338+ <target depends="profile-init,compile-single" if="netbeans.home" name="profile-applet">
339+ <nbprofiledirect>
340+ <classpath>
341+ <path path="${run.classpath}"/>
342+ </classpath>
343+ </nbprofiledirect>
344+ <profile classname="sun.applet.AppletViewer">
345+ <customize>
346+ <arg value="${applet.url}"/>
347+ </customize>
348+ </profile>
349+ </target>
350+ <!--
351+ =========================
352+ TESTS PROFILING SECTION
353+ =========================
354+ -->
355+ <target depends="profile-init,compile-test-single" if="netbeans.home" name="profile-test-single">
356+ <nbprofiledirect>
357+ <classpath>
358+ <path path="${run.test.classpath}"/>
359+ </classpath>
360+ </nbprofiledirect>
361+ <junit dir="${profiler.info.dir}" errorproperty="tests.failed" failureproperty="tests.failed" fork="true" jvm="${profiler.info.jvm}" showoutput="true">
362+ <env key="${profiler.info.pathvar}" path="${profiler.info.agentpath}:${profiler.current.path}"/>
363+ <jvmarg value="${profiler.info.jvmargs.agent}"/>
364+ <jvmarg line="${profiler.info.jvmargs}"/>
365+ <test name="${profile.class}"/>
366+ <classpath>
367+ <path path="${run.test.classpath}"/>
368+ </classpath>
369+ <syspropertyset>
370+ <propertyref prefix="test-sys-prop."/>
371+ <mapper from="test-sys-prop.*" to="*" type="glob"/>
372+ </syspropertyset>
373+ <formatter type="brief" usefile="false"/>
374+ <formatter type="xml"/>
375+ </junit>
376+ </target>
377+ <!--
378 ===============
379 JAVADOC SECTION
380 ===============
381@@ -757,7 +904,7 @@
382 <target if="do.depend.true" name="-compile-test-depend">
383 <j2seproject3:depend classpath="${javac.test.classpath}" destdir="${build.test.classes.dir}" srcdir="${test.src.dir}"/>
384 </target>
385- <target depends="init,compile,-pre-pre-compile-test,-pre-compile-test,-compile-test-depend" if="have.tests" name="-do-compile-test">
386+ <target depends="init,deps-jar,compile,-pre-pre-compile-test,-pre-compile-test,-compile-test-depend" if="have.tests" name="-do-compile-test">
387 <j2seproject3:javac apgeneratedsrcdir="${build.test.classes.dir}" classpath="${javac.test.classpath}" debug="true" destdir="${build.test.classes.dir}" processorpath="${javac.test.processorpath}" srcdir="${test.src.dir}"/>
388 <copy todir="${build.test.classes.dir}">
389 <fileset dir="${test.src.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
390@@ -772,7 +919,7 @@
391 <!-- Empty placeholder for easier customization. -->
392 <!-- You can override this target in the ../build.xml file. -->
393 </target>
394- <target depends="init,compile,-pre-pre-compile-test,-pre-compile-test-single" if="have.tests" name="-do-compile-test-single">
395+ <target depends="init,deps-jar,compile,-pre-pre-compile-test,-pre-compile-test-single" if="have.tests" name="-do-compile-test-single">
396 <fail unless="javac.includes">Must select some files in the IDE or set javac.includes</fail>
397 <j2seproject3:force-recompile destdir="${build.test.classes.dir}"/>
398 <j2seproject3:javac apgeneratedsrcdir="${build.test.classes.dir}" classpath="${javac.test.classpath}" debug="true" destdir="${build.test.classes.dir}" excludes="" includes="${javac.includes}" processorpath="${javac.test.processorpath}" sourcepath="${test.src.dir}" srcdir="${test.src.dir}"/>
399
400=== modified file 'nbproject/genfiles.properties'
401--- nbproject/genfiles.properties 2010-11-18 09:20:32 +0000
402+++ nbproject/genfiles.properties 2011-04-25 18:28:30 +0000
403@@ -4,5 +4,8 @@
404 # This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
405 # Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
406 nbproject/build-impl.xml.data.CRC32=5d2382f7
407-nbproject/build-impl.xml.script.CRC32=b7e0b772
408-nbproject/build-impl.xml.stylesheet.CRC32=229523de@1.38.3.45
409+nbproject/build-impl.xml.script.CRC32=aba842bd
410+nbproject/build-impl.xml.stylesheet.CRC32=0c01fd8e@1.43.1.45
411+nbproject/profiler-build-impl.xml.data.CRC32=5d2382f7
412+nbproject/profiler-build-impl.xml.script.CRC32=abda56ed
413+nbproject/profiler-build-impl.xml.stylesheet.CRC32=f10cf54c@1.11.1
414
415=== modified file 'nbproject/private/private.properties'
416--- nbproject/private/private.properties 2010-10-16 07:11:43 +0000
417+++ nbproject/private/private.properties 2011-04-25 18:28:30 +0000
418@@ -1,9 +1,9 @@
419-compile.on.save=true
420+compile.on.save=false
421 do.depend=false
422 do.jar=true
423 file.reference.poi-3.2-FINAL-20081019.jar=/home/mcseem/projects/charterbilet/build/lib/poi-3.6-20091214.jar
424 javac.debug=true
425 javadoc.preview=true
426 jaxbwiz.endorsed.dirs=/home/mcseem/soft/netbeans-6.8/ide12/modules/ext/jaxb/api
427-user.properties.file=/home/mcseem/.netbeans/6.9/build.properties
428+user.properties.file=/home/mcseem/.netbeans/7.0/build.properties
429 work.dir=/home/mcseem/projects/charterbilet/build/cbadmin/src
430
431=== modified file 'nbproject/private/private.xml'
432--- nbproject/private/private.xml 2010-11-20 09:27:56 +0000
433+++ nbproject/private/private.xml 2011-04-25 18:28:30 +0000
434@@ -3,87 +3,131 @@
435 <editor-bookmarks xmlns="http://www.netbeans.org/ns/editor-bookmarks/1">
436 <file>
437 <url>src/cbadmin/gui/win_offer.java</url>
438- <line>914</line>
439+ <line>916</line>
440 </file>
441 <file>
442 <url>src/cbadmin/gui/win_reservations.java</url>
443- <line>2229</line>
444- <line>2288</line>
445- <line>2354</line>
446- <line>2525</line>
447- <line>2832</line>
448+ <line>251</line>
449+ <line>2324</line>
450+ <line>2366</line>
451+ <line>2619</line>
452+ <line>2914</line>
453+ <line>3265</line>
454+ </file>
455+ <file>
456+ <url>src/cbadmin/gui/support/PriceFieldsHelper.java</url>
457+ <line>78</line>
458 </file>
459 <file>
460 <url>src/cbadmin/util/UpdateMgr.java</url>
461- <line>294</line>
462- <line>623</line>
463- </file>
464- <file>
465- <url>src/cbadmin/gui/win_flight.java</url>
466- <line>2194</line>
467- <line>2633</line>
468- <line>2642</line>
469+ <line>203</line>
470 </file>
471 <file>
472 <url>src/cbadmin/gui/win_flight_add.java</url>
473- <line>95</line>
474- <line>822</line>
475- <line>840</line>
476- </file>
477- <file>
478- <url>src/cbadmin/gui/win_offer_copy.java</url>
479- <line>335</line>
480- </file>
481- <file>
482- <url>src/cbadmin/gui/win_flight_block_change_multi.java</url>
483- <line>622</line>
484+ <line>85</line>
485+ <line>829</line>
486+ <line>847</line>
487+ </file>
488+ <file>
489+ <url>src/cbadmin/gui/PanelReservationServices.java</url>
490+ <line>662</line>
491+ </file>
492+ <file>
493+ <url>src/cbadmin/entity2/Block.java</url>
494+ <line>392</line>
495+ </file>
496+ <file>
497+ <url>src/cbadmin/entity2/Reservation.java</url>
498+ <line>174</line>
499+ <line>956</line>
500 </file>
501 <file>
502 <url>src/cbadmin/gui/win_statuscheck.java</url>
503 <line>1330</line>
504 </file>
505 <file>
506- <url>src/cbadmin/gui/win_payment_block.java</url>
507- <line>845</line>
508- <line>916</line>
509+ <url>src/cbadmin/gui/win_statuscheck_past.java</url>
510+ <line>712</line>
511 </file>
512 <file>
513 <url>src/cbadmin/gui/main.java</url>
514- <line>704</line>
515- </file>
516- <file>
517- <url>src/cbadmin/gui/win_statuscheck_past.java</url>
518- <line>684</line>
519- </file>
520- <file>
521- <url>src/cbadmin/gui/PanelReservationFlight.java</url>
522- <line>681</line>
523- <line>1376</line>
524- <line>1484</line>
525+ <line>718</line>
526+ <line>991</line>
527 </file>
528 <file>
529 <url>src/cbadmin/gui/support/PanelDictionaryComboBeanInfo.java</url>
530 <line>290</line>
531 </file>
532 <file>
533+ <url>src/cbadmin/gui/win_payment_reservation.java</url>
534+ <line>208</line>
535+ <line>865</line>
536+ <line>987</line>
537+ </file>
538+ <file>
539 <url>src/cbadmin/gui/win_payment_add.java</url>
540- <line>358</line>
541- <line>441</line>
542- <line>585</line>
543- </file>
544- <file>
545- <url>src/cbadmin/gui/win_payment_reservation.java</url>
546- <line>770</line>
547+ <line>359</line>
548+ <line>442</line>
549+ <line>587</line>
550+ </file>
551+ <file>
552+ <url>src/cbadmin/gui/win_flight.java</url>
553+ <line>2166</line>
554+ <line>2606</line>
555+ </file>
556+ <file>
557+ <url>src/cbadmin/gui/win_offer_copy.java</url>
558+ <line>335</line>
559+ </file>
560+ <file>
561+ <url>src/cbadmin/gui/win_payment_service.java</url>
562+ <line>632</line>
563+ <line>1169</line>
564+ </file>
565+ <file>
566+ <url>src/cbadmin/gui/dic_ClientUl.java</url>
567+ <line>805</line>
568+ </file>
569+ <file>
570+ <url>src/cbadmin/gui/win_payment_block.java</url>
571+ <line>845</line>
572+ <line>916</line>
573+ </file>
574+ <file>
575+ <url>src/cbadmin/gui/win_flight_block_change_multi.java</url>
576+ <line>622</line>
577+ </file>
578+ <file>
579+ <url>src/cbadmin/business/PriceVendorDefault.java</url>
580+ <line>55</line>
581+ </file>
582+ <file>
583+ <url>src/cbadmin/entity2/db_interface.java</url>
584+ <line>187</line>
585+ </file>
586+ <file>
587+ <url>src/cbadmin/gui/PanelReservationFlight.java</url>
588+ <line>717</line>
589+ <line>1177</line>
590+ <line>1275</line>
591+ </file>
592+ <file>
593+ <url>src/cbadmin/gui/dic_helper.java</url>
594+ <line>127</line>
595 </file>
596 <file>
597 <url>src/cbadmin/gui/win_flight_block_add.java</url>
598- <line>157</line>
599- <line>547</line>
600+ <line>145</line>
601+ <line>517</line>
602 </file>
603 <file>
604 <url>src/cbadmin/gui/win_flightload.java</url>
605- <line>1669</line>
606- <line>2214</line>
607+ <line>2137</line>
608+ <line>2212</line>
609+ </file>
610+ <file>
611+ <url>src/cbadmin/gui/win_payment_add_income.java</url>
612+ <line>589</line>
613 </file>
614 <file>
615 <url>src/cbadmin/gui/win_flight_program_period_add.java</url>
616
617=== added directory 'nbproject/private/profiler'
618=== added file 'nbproject/private/profiler/configurations.xml'
619--- nbproject/private/profiler/configurations.xml 1970-01-01 00:00:00 +0000
620+++ nbproject/private/profiler/configurations.xml 2011-04-25 18:28:30 +0000
621@@ -0,0 +1,141 @@
622+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
623+<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd">
624+<properties>
625+<entry key="2_profiler.settings.code.region.cpu.res.buf.size">1000</entry>
626+<entry key="2_profiler.settings.sort.results.by.thread.cpu.time">false</entry>
627+<entry key="0_profiler.settings.instrumentation.filter.selectedprofiler.filter.type">profiler.simple.filter</entry>
628+<entry key="0_profiler.settings.instrument.empty.methods">false</entry>
629+<entry key="3_profiler.settings.override.jvm.args"/>
630+<entry key="0_profiler.settings.instrumentation.filter.selectedprofiler.simple.filter.name"/>
631+<entry key="1_profiler.settings.profiling.type">8</entry>
632+<entry key="0_profiler.settings.cpu.exclude.wait.time">true</entry>
633+<entry key="0_profiler.settings.override.working.dir"/>
634+<entry key="3_profiler.settings.instrument.empty.methods">false</entry>
635+<entry key="1_profiler.settings.thread.cpu.timer.on">false</entry>
636+<entry key="1_profiler.settings.instrumentation.root.methods.size">0</entry>
637+<entry key="3_profiler.settings.obj.alloc.stack.sampling.depth">0</entry>
638+<entry key="2_profiler.settings.override">false</entry>
639+<entry key="profiler.settings.lastselected">2</entry>
640+<entry key="2_profiler.settings.instrument.spawned.threads">true</entry>
641+<entry key="0_profiler.settings.threads.monitoring.enabled">false</entry>
642+<entry key="0_profiler.settings.istrument.getter.setter.methods">false</entry>
643+<entry key="3_profiler.settings.cpu.quick.filterprofiler.simple.filter.value"/>
644+<entry key="2_profiler.settings.instrumentation.filter.selectedprofiler.filter.type">profiler.filter.set</entry>
645+<entry key="3_profiler.settings.cpu.quick.filterprofiler.simple.filter.type">1</entry>
646+<entry key="2_profiler.settings.n.profiled.threads.limit">40</entry>
647+<entry key="3_profiler.settings.instr.scheme">1</entry>
648+<entry key="1_profiler.settings.sort.results.by.thread.cpu.time">false</entry>
649+<entry key="2_profiler.settings.instr.scheme">3</entry>
650+<entry key="1_profiler.settings.instrument.method.invoke">true</entry>
651+<entry key="3_profiler.settings.profilingpoints.enabled">true</entry>
652+<entry key="1_profiler.settings.instr.scheme">3</entry>
653+<entry key="2_profiler.settings.sampling.interval">10</entry>
654+<entry key="0_profiler.settings.instr.scheme">1</entry>
655+<entry key="1_profiler.settings.run.gc.on.get.results.in.memory.profiling">true</entry>
656+<entry key="2_profiler.settings.settings.name">cbadmin CPU Analysis</entry>
657+<entry key="0_profiler.settings.sort.results.by.thread.cpu.time">false</entry>
658+<entry key="0_profiler.settings.profiling.type">1</entry>
659+<entry key="1_profiler.settings.cpu.exclude.wait.time">true</entry>
660+<entry key="3_profiler.settings.cpu.quick.filterprofiler.simple.filter.name">Quick filter...</entry>
661+<entry key="2_profiler.settings.obj.alloc.stack.sampling.interval">10</entry>
662+<entry key="3_profiler.settings.instrumentation.filter.selectedprofiler.simple.filter.type">0</entry>
663+<entry key="3_profiler.settings.override">false</entry>
664+<entry key="1_profiler.settings.obj.alloc.stack.sampling.depth">0</entry>
665+<entry key="1_profiler.settings.cpu.quick.filterprofiler.filter.type">profiler.simple.filter</entry>
666+<entry key="1_profiler.settings.instrumentation.marker.methods.size">0</entry>
667+<entry key="2_profiler.settings.thread.cpu.timer.on">false</entry>
668+<entry key="0_profiler.settigns.ispreset">true</entry>
669+<entry key="0_profiler.settings.instrumentation.filter.selectedprofiler.simple.filter.value"/>
670+<entry key="3_profiler.settings.instrumentation.filter.selectedprofiler.simple.filter.name"/>
671+<entry key="2_profiler.settings.override.working.dir"/>
672+<entry key="0_profiler.settings.cpu.quick.filterprofiler.simple.filter.type">1</entry>
673+<entry key="2_profiler.settings.cpu.quick.filterprofiler.simple.filter.value"/>
674+<entry key="2_profiler.settings.override.jvm.args"/>
675+<entry key="0_profiler.settings.profile.underlying.framework">false</entry>
676+<entry key="2_profiler.settings.profile.underlying.framework">true</entry>
677+<entry key="3_profiler.settings.thread.cpu.timer.on">false</entry>
678+<entry key="2_profiler.settings.cpu.exclude.wait.time">true</entry>
679+<entry key="2_profiler.settings.threads.monitoring.enabled">false</entry>
680+<entry key="1_profiler.settings.instrumentation.filter.selectedFilterSet-type">false</entry>
681+<entry key="1_profiler.settings.instrument.spawned.threads">false</entry>
682+<entry key="1_profiler.settings.n.profiled.threads.limit">32</entry>
683+<entry key="0_profiler.settings.cpu.quick.filterprofiler.simple.filter.name">Quick filter...</entry>
684+<entry key="2_profiler.settings.instrumentation.root.methods.size">0</entry>
685+<entry key="2_profiler.settings.instrument.empty.methods">false</entry>
686+<entry key="3_profiler.settings.cpu.profiling.type">0</entry>
687+<entry key="3_profiler.settings.cpu.quick.filterprofiler.filter.type">profiler.simple.filter</entry>
688+<entry key="1_profiler.settings.instrumentation.filter.selectedFilterSet-name">Exclude Java core classes</entry>
689+<entry key="1_profiler.settings.sampling.interval">10</entry>
690+<entry key="2_profiler.settings.cpu.profiling.type">0</entry>
691+<entry key="0_profiler.settings.run.gc.on.get.results.in.memory.profiling">true</entry>
692+<entry key="1_profiler.settigns.ispreset">true</entry>
693+<entry key="0_profiler.settings.instrument.method.invoke">true</entry>
694+<entry key="0_profiler.settings.obj.alloc.stack.sampling.interval">10</entry>
695+<entry key="3_profiler.settings.cpu.exclude.wait.time">true</entry>
696+<entry key="1_profiler.settings.cpu.quick.filterprofiler.simple.filter.value"/>
697+<entry key="1_profiler.settings.code.region.cpu.res.buf.size">1000</entry>
698+<entry key="3_profiler.settings.instrumentation.marker.methods.size">0</entry>
699+<entry key="3_profiler.settings.instrument.method.invoke">true</entry>
700+<entry key="3_profiler.settings.code.region.cpu.res.buf.size">1000</entry>
701+<entry key="0_profiler.settings.instrumentation.marker.methods.size">0</entry>
702+<entry key="1_profiler.settings.instrumentation.filter.selectedprofiler.filter.type">profiler.filter.set</entry>
703+<entry key="0_profiler.settings.override">false</entry>
704+<entry key="3_profiler.settings.obj.alloc.stack.sampling.interval">10</entry>
705+<entry key="1_profiler.settings.settings.name">Analyze Performance</entry>
706+<entry key="1_profiler.settings.cpu.quick.filterprofiler.simple.filter.type">1</entry>
707+<entry key="1_profiler.settings.cpu.profiling.type">0</entry>
708+<entry key="1_profiler.settings.override.jvm.args"/>
709+<entry key="2_profiler.settings.obj.alloc.stack.sampling.depth">0</entry>
710+<entry key="1_profiler.settings.instrument.empty.methods">false</entry>
711+<entry key="0_profiler.settings.cpu.quick.filterprofiler.filter.type">profiler.simple.filter</entry>
712+<entry key="3_profiler.settings.run.gc.on.get.results.in.memory.profiling">true</entry>
713+<entry key="1_profiler.settings.cpu.quick.filterprofiler.simple.filter.name">Quick filter...</entry>
714+<entry key="3_profiler.settings.instrument.spawned.threads">false</entry>
715+<entry key="2_profiler.settigns.ispreset">false</entry>
716+<entry key="1_profiler.settings.threads.monitoring.enabled">false</entry>
717+<entry key="0_profiler.settings.instrumentation.root.methods.size">0</entry>
718+<entry key="2_profiler.settings.instrumentation.filter.selectedFilterSet-active_filter-0">Java Core Classes</entry>
719+<entry key="3_profiler.settings.instrumentation.filter.selectedprofiler.simple.filter.value"/>
720+<entry key="2_profiler.settings.instrumentation.filter.selectedFilterSet-type">false</entry>
721+<entry key="1_profiler.settings.override.working.dir"/>
722+<entry key="3_profiler.settings.istrument.getter.setter.methods">false</entry>
723+<entry key="0_profiler.settings.n.profiled.threads.limit">32</entry>
724+<entry key="0_profiler.settings.cpu.quick.filterprofiler.simple.filter.value"/>
725+<entry key="3_profiler.settings.instrumentation.root.methods.size">0</entry>
726+<entry key="3_profiler.settings.n.profiled.threads.limit">32</entry>
727+<entry key="0_profiler.settings.cpu.profiling.type">0</entry>
728+<entry key="3_profiler.settings.instrumentation.filter.selectedprofiler.filter.type">profiler.simple.filter</entry>
729+<entry key="3_profiler.settings.settings.name">Analyze Memory</entry>
730+<entry key="3_profiler.settings.profiling.type">2</entry>
731+<entry key="0_profiler.settings.instrument.spawned.threads">false</entry>
732+<entry key="2_profiler.settings.instrumentation.filter.selectedFilterSet-name">Exclude Java core classes</entry>
733+<entry key="2_profiler.settings.instrumentation.marker.methods.size">0</entry>
734+<entry key="0_profiler.settings.obj.alloc.stack.sampling.depth">0</entry>
735+<entry key="3_profiler.settings.sampling.interval">10</entry>
736+<entry key="2_profiler.settings.cpu.quick.filterprofiler.filter.type">profiler.simple.filter</entry>
737+<entry key="0_profiler.settings.profilingpoints.enabled">true</entry>
738+<entry key="2_profiler.settings.cpu.quick.filterprofiler.simple.filter.type">1</entry>
739+<entry key="3_profiler.settigns.ispreset">true</entry>
740+<entry key="1_profiler.settings.override">false</entry>
741+<entry key="1_profiler.settings.obj.alloc.stack.sampling.interval">10</entry>
742+<entry key="1_profiler.settings.instrumentation.filter.selectedFilterSet-active_filter-0">Java Core Classes</entry>
743+<entry key="3_profiler.settings.override.working.dir"/>
744+<entry key="2_profiler.settings.istrument.getter.setter.methods">true</entry>
745+<entry key="0_profiler.settings.sampling.interval">10</entry>
746+<entry key="1_profiler.settings.profile.underlying.framework">false</entry>
747+<entry key="2_profiler.settings.instrument.method.invoke">true</entry>
748+<entry key="3_profiler.settings.profile.underlying.framework">false</entry>
749+<entry key="1_profiler.settings.profilingpoints.enabled">false</entry>
750+<entry key="1_profiler.settings.istrument.getter.setter.methods">false</entry>
751+<entry key="2_profiler.settings.cpu.quick.filterprofiler.simple.filter.name">Quick filter...</entry>
752+<entry key="0_profiler.settings.instrumentation.filter.selectedprofiler.simple.filter.type">0</entry>
753+<entry key="3_profiler.settings.sort.results.by.thread.cpu.time">false</entry>
754+<entry key="0_profiler.settings.thread.cpu.timer.on">false</entry>
755+<entry key="0_profiler.settings.override.jvm.args"/>
756+<entry key="3_profiler.settings.threads.monitoring.enabled">false</entry>
757+<entry key="2_profiler.settings.profiling.type">8</entry>
758+<entry key="0_profiler.settings.settings.name">Monitor Application</entry>
759+<entry key="0_profiler.settings.code.region.cpu.res.buf.size">1000</entry>
760+<entry key="2_profiler.settings.profilingpoints.enabled">false</entry>
761+<entry key="2_profiler.settings.run.gc.on.get.results.in.memory.profiling">true</entry>
762+</properties>
763
764=== modified file 'nbproject/project.properties'
765--- nbproject/project.properties 2010-10-30 14:08:17 +0000
766+++ nbproject/project.properties 2011-04-25 18:28:30 +0000
767@@ -38,7 +38,8 @@
768 ${libs.ApacheCayenne.classpath}:\
769 ${libs.CopyLibs.classpath}:\
770 ${libs.ApacheCommons.classpath}:\
771- ${libs.jXLS.classpath}
772+ ${libs.jXLS.classpath}:\
773+ ${libs.cbadminJasper.classpath}
774 # Space-separated list of extra javac options
775 javac.compilerargs=
776 javac.deprecation=false
777@@ -71,6 +72,7 @@
778 main.class=cbadmin.gui.main
779 manifest.file=manifest.mf
780 meta.inf.dir=${src.dir}/META-INF
781+mkdist.disabled=false
782 platform.active=default_platform
783 run.classpath=\
784 ${javac.classpath}:\
785
786=== modified file 'src/backupscripts/h2backup' (properties changed: +x to -x)
787=== modified file 'src/backupscripts/h2restore' (properties changed: +x to -x)
788=== modified file 'src/backupscripts/mysqlbackup' (properties changed: +x to -x)
789--- src/backupscripts/mysqlbackup 2010-06-29 08:30:00 +0000
790+++ src/backupscripts/mysqlbackup 2011-04-25 18:28:30 +0000
791@@ -1,2 +1,2 @@
792 mkdir ./backup
793-mysqldump u170323_test --user=u170323 --password=unpallyan7dip --result-file=./backup/mysqlbackup.sql
794\ No newline at end of file
795+mysqldump %%database%% --user=%%user%% --password=%%password%% --host=%%server%% --result-file=./backup/%%database%%backup.sql
796\ No newline at end of file
797
798=== modified file 'src/backupscripts/mysqlrestore' (properties changed: +x to -x)
799--- src/backupscripts/mysqlrestore 2010-06-29 08:30:00 +0000
800+++ src/backupscripts/mysqlrestore 2011-04-25 18:28:30 +0000
801@@ -1,1 +1,4 @@
802-mysql --user=u170323 --password=unpallyan7dip --database=u170323_test -e '\. ./backup/mysqlbackup.sql'
803+mysql --user=%%user%% --password=%%password%% --database=%%database%% --host=%%server%% --skip-column-names --execute="SELECT concat('DROP TABLE ',table_name,';') FROM information_schema.TABLES WHERE TABLE_SCHEMA='u170323_test';" > ./backup/drop.sql
804+mysql --user=%%user%% --password=%%password%% --database=%%database%% --host=%%server%% --execute="Set foreign_key_checks=off;source ./backup/drop.sql;"
805+
806+mysql --user=%%user%% --password=%%password%% --database=%%database%% --host=%%server%% --default-character-set=cp1251 -e '\. ./backup/%%database%%backup.sql'
807
808=== modified file 'src/build-info.properties'
809--- src/build-info.properties 2010-11-20 09:27:56 +0000
810+++ src/build-info.properties 2011-04-25 18:28:30 +0000
811@@ -1,5 +1,7 @@
812 #This file is automatically generated - DO NOT EDIT
813-#Fri, 19 Nov 2010 15:24:11 +0300
814+#Mon, 25 Apr 2011 13:38:48 +0400
815
816 Built-By=mcseem
817-Build-Version=324
818+Build-Version=1479
819+
820+Build-Date=25.04.2011 13\:38
821
822=== modified file 'src/build.number'
823--- src/build.number 2010-11-20 09:27:56 +0000
824+++ src/build.number 2011-04-25 18:28:30 +0000
825@@ -1,3 +1,3 @@
826 #Build Number for ANT. Do not edit!
827-#Fri Nov 19 15:24:11 MSK 2010
828-build.number=325
829+#Mon Apr 25 13:38:48 MSD 2011
830+build.number=1480
831
832=== modified file 'src/cayenne.xml'
833--- src/cayenne.xml 2010-10-16 07:11:43 +0000
834+++ src/cayenne.xml 2011-04-25 18:28:30 +0000
835@@ -1,13 +1,15 @@
836 <?xml version="1.0" encoding="utf-8"?>
837 <domains project-version="3.0.0.1">
838 <domain name="cbadmin">
839- <property name="cayenne.DataRowStore.remote.notify" value="true"/>
840+ <property name="cayenne.DataRowStore.snapshot.size" value="1"/>
841+ <property name="cayenne.DataDomain.sharedCache" value="false"/>
842
843 <map name="cbadmin" location="cbadmin.map.xml"/>
844 <map name="cbadminExportPnlPlugin" location="cbadminExportPnlPlugin.map.xml"/>
845+ <map name="cbadminPluginDeposit" location="cbadminPluginDeposit.map.xml"/>
846 <map name="cbadminPluginDocpack" location="cbadminPluginDocpack.map.xml"/>
847 <map name="cbadminPluginHotel" location="cbadminPluginHotel.map.xml"/>
848- <map name="cbadminPluginPayrequest" location="cbadminPluginPayrequest.map.xml"/>
849+ <map name="cbadminPluginRcc" location="cbadminPluginRcc.map.xml"/>
850 <map name="cbadminPluginTour" location="cbadminPluginTour.map.xml"/>
851 <map name="cbadminPluginWeb" location="cbadminPluginWeb.map.xml"/>
852
853@@ -15,10 +17,11 @@
854 datasource="cbadminNode.driver.xml"
855 factory="org.apache.cayenne.conf.DriverDataSourceFactory"
856 schema-update-strategy="org.apache.cayenne.access.dbsync.CreateIfNoSchemaStrategy">
857+ <map-ref name="cbadminPluginRcc"/>
858 <map-ref name="cbadminPluginTour"/>
859 <map-ref name="cbadminPluginHotel"/>
860 <map-ref name="cbadmin"/>
861- <map-ref name="cbadminPluginPayrequest"/>
862+ <map-ref name="cbadminPluginDeposit"/>
863 <map-ref name="cbadminPluginDocpack"/>
864 <map-ref name="cbadminPluginWeb"/>
865 <map-ref name="cbadminExportPnlPlugin"/>
866
867=== modified file 'src/cbadmin.map.xml'
868--- src/cbadmin.map.xml 2010-11-04 23:24:26 +0000
869+++ src/cbadmin.map.xml 2011-04-25 18:28:30 +0000
870@@ -30,6 +30,7 @@
871 </db-entity>
872 <db-entity name="block" catalog="u170323_test">
873 <db-attribute name="capacity" type="SMALLINT" isMandatory="true" length="5"/>
874+ <db-attribute name="deletedate" type="TIMESTAMP" length="19"/>
875 <db-attribute name="id" type="BIGINT" isPrimaryKey="true" isGenerated="true" isMandatory="true" length="10"/>
876 <db-attribute name="id_class" type="BIGINT" isMandatory="true" length="10"/>
877 <db-attribute name="id_currency" type="BIGINT" isMandatory="true" length="10"/>
878@@ -41,7 +42,7 @@
879 <db-attribute name="ICQ" type="VARCHAR" length="20"/>
880 <db-attribute name="agent_type" type="TINYINT" isMandatory="true"/>
881 <db-attribute name="cl_type" type="BIGINT" isMandatory="true" length="10"/>
882- <db-attribute name="created" type="TIMESTAMP" isMandatory="true" length="19"/>
883+ <db-attribute name="created" type="TIMESTAMP" length="19"/>
884 <db-attribute name="deletedate" type="TIMESTAMP" length="19"/>
885 <db-attribute name="delivery_address" type="VARCHAR" length="255"/>
886 <db-attribute name="discount" type="REAL" isMandatory="true" length="12"/>
887@@ -82,6 +83,7 @@
888 <db-attribute name="uname" type="VARCHAR" isMandatory="true" length="50"/>
889 </db-entity>
890 <db-entity name="client_ul" catalog="u170323_test">
891+ <db-attribute name="gendir" type="VARCHAR" length="100"/>
892 <db-attribute name="id_client" type="BIGINT" isPrimaryKey="true" isMandatory="true" length="10"/>
893 <db-attribute name="orgagree_date" type="DATE" length="10"/>
894 <db-attribute name="orgagree_end" type="DATE" length="10"/>
895@@ -127,6 +129,7 @@
896 <db-attribute name="id_airline" type="BIGINT" isMandatory="true" length="10"/>
897 <db-attribute name="id_airport_from" type="BIGINT" isMandatory="true" length="10"/>
898 <db-attribute name="id_airport_to" type="BIGINT" isMandatory="true" length="10"/>
899+ <db-attribute name="id_flight_program_paired" type="BIGINT" length="10"/>
900 </db-entity>
901 <db-entity name="flight_program_periods" catalog="u170323_test">
902 <db-attribute name="comment" type="VARCHAR" length="200"/>
903@@ -215,6 +218,7 @@
904 <db-attribute name="deletedate" type="TIMESTAMP" length="19"/>
905 <db-attribute name="frozen" type="TINYINT" isMandatory="true" length="3"/>
906 <db-attribute name="id" type="BIGINT" isPrimaryKey="true" isGenerated="true" isMandatory="true" length="10"/>
907+ <db-attribute name="id_currency_preferred" type="BIGINT" length="10"/>
908 <db-attribute name="name" type="VARCHAR" isMandatory="true" length="255"/>
909 <db-attribute name="webshow" type="TINYINT" isMandatory="true" length="3"/>
910 </db-entity>
911@@ -234,6 +238,15 @@
912 <db-attribute name="name" type="VARCHAR" isMandatory="true" length="60"/>
913 <db-attribute name="webshow" type="TINYINT" isMandatory="true" length="3"/>
914 </db-entity>
915+ <db-entity name="list_email" catalog="u170323_test">
916+ <db-attribute name="client_type" type="TINYINT" isMandatory="true" length="3"/>
917+ <db-attribute name="deletedate" type="TIMESTAMP" length="19"/>
918+ <db-attribute name="email_body" type="LONGVARCHAR" isMandatory="true" length="65535"/>
919+ <db-attribute name="email_subject" type="VARCHAR" isMandatory="true" length="255"/>
920+ <db-attribute name="frozen" type="TINYINT" isMandatory="true" length="3"/>
921+ <db-attribute name="id" type="BIGINT" isPrimaryKey="true" isMandatory="true" length="10"/>
922+ <db-attribute name="name" type="VARCHAR" isMandatory="true" length="60"/>
923+ </db-entity>
924 <db-entity name="list_neighbours" catalog="u170323_test">
925 <db-attribute name="city1" type="BIGINT" isPrimaryKey="true" isMandatory="true" length="10"/>
926 <db-attribute name="city2" type="BIGINT" isPrimaryKey="true" isMandatory="true" length="10"/>
927@@ -243,8 +256,11 @@
928 <db-entity name="list_pay_method" catalog="u170323_test">
929 <db-attribute name="deletedate" type="TIMESTAMP" length="19"/>
930 <db-attribute name="frozen" type="TINYINT" isMandatory="true" length="3"/>
931- <db-attribute name="id" type="BIGINT" isPrimaryKey="true" isGenerated="true" isMandatory="true" length="10"/>
932+ <db-attribute name="id" type="BIGINT" isPrimaryKey="true" isMandatory="true" length="10"/>
933 <db-attribute name="name" type="VARCHAR" isMandatory="true" length="60"/>
934+ <db-attribute name="owner" type="VARCHAR" length="10"/>
935+ <db-attribute name="percent_commission" type="REAL" isMandatory="true" length="12"/>
936+ <db-attribute name="rate_state" type="TINYINT" isMandatory="true" length="3"/>
937 <db-attribute name="webshow" type="TINYINT" isMandatory="true" length="3"/>
938 </db-entity>
939 <db-entity name="list_reservation_status" catalog="u170323_test">
940@@ -330,6 +346,7 @@
941 </db-entity>
942 <db-entity name="payment" catalog="u170323_test">
943 <db-attribute name="comment" type="VARCHAR" length="255"/>
944+ <db-attribute name="commission" type="DECIMAL" isMandatory="true" length="13" scale="4"/>
945 <db-attribute name="date_factpayment" type="DATE" length="10"/>
946 <db-attribute name="date_payment" type="DATE" isMandatory="true" length="10"/>
947 <db-attribute name="deletedate" type="TIMESTAMP" length="19"/>
948@@ -344,21 +361,12 @@
949 <db-attribute name="pluspercent" type="REAL" isMandatory="true" length="12"/>
950 <db-attribute name="summa_payed" type="REAL" isMandatory="true" length="12"/>
951 </db-entity>
952- <db-entity name="promo" catalog="u170323_test">
953- <db-attribute name="descr" type="LONGVARCHAR" isMandatory="true" length="65535"/>
954- <db-attribute name="heading" type="LONGVARCHAR" isMandatory="true" length="65535"/>
955- <db-attribute name="id" type="BIGINT" isPrimaryKey="true" isMandatory="true" length="10"/>
956- <db-attribute name="id_city" type="BIGINT" isMandatory="true" length="10"/>
957- <db-attribute name="id_country" type="BIGINT" isMandatory="true" length="10"/>
958- <db-attribute name="keywords" type="LONGVARCHAR" isMandatory="true" length="65535"/>
959- <db-attribute name="meta_name" type="LONGVARCHAR" isMandatory="true" length="65535"/>
960- <db-attribute name="ref" type="VARCHAR" length="255"/>
961- <db-attribute name="reftext" type="LONGVARCHAR" isMandatory="true" length="65535"/>
962- <db-attribute name="title" type="LONGVARCHAR" isMandatory="true" length="65535"/>
963- </db-entity>
964 <db-entity name="reservation" catalog="u170323_test">
965- <db-attribute name="billdate" type="TIMESTAMP" length="19"/>
966 <db-attribute name="comment" type="LONGVARCHAR" length="65535"/>
967+ <db-attribute name="date_bill" type="TIMESTAMP" length="19"/>
968+ <db-attribute name="date_confirm" type="TIMESTAMP" length="19"/>
969+ <db-attribute name="date_pay" type="TIMESTAMP" length="19"/>
970+ <db-attribute name="date_prepay" type="TIMESTAMP" length="19"/>
971 <db-attribute name="date_reserved" type="DATE" isMandatory="true" length="10"/>
972 <db-attribute name="deletedate" type="TIMESTAMP" length="19"/>
973 <db-attribute name="delivery_address" type="LONGVARCHAR" length="65535"/>
974@@ -380,10 +388,8 @@
975 <db-attribute name="id_vacation_category" type="BIGINT" length="10"/>
976 <db-attribute name="isfrozen" type="TINYINT" isMandatory="true" length="3"/>
977 <db-attribute name="number" type="VARCHAR" length="20"/>
978- <db-attribute name="pay_date" type="TIMESTAMP" length="19"/>
979 <db-attribute name="percent_commission" type="REAL" isMandatory="true" length="12"/>
980 <db-attribute name="phone" type="VARCHAR" isMandatory="true" length="60"/>
981- <db-attribute name="prepay_date" type="TIMESTAMP" length="19"/>
982 <db-attribute name="summa_payed" type="REAL" isMandatory="true" length="12"/>
983 <db-attribute name="summa_reserved" type="REAL" isMandatory="true" length="12"/>
984 </db-entity>
985@@ -405,6 +411,7 @@
986 </db-entity>
987 <db-entity name="reservation_ul" catalog="u170323_test">
988 <db-attribute name="deletedate" type="TIMESTAMP" length="19"/>
989+ <db-attribute name="gendir" type="VARCHAR" length="100"/>
990 <db-attribute name="id" type="BIGINT" isPrimaryKey="true" isGenerated="true" isMandatory="true" length="10"/>
991 <db-attribute name="is_vendor" type="TINYINT" isMandatory="true" length="3"/>
992 <db-attribute name="orgagree_date" type="DATE" length="10"/>
993@@ -442,7 +449,7 @@
994 <db-attribute name="isautomatic" type="TINYINT" length="3"/>
995 <db-attribute name="marginfix" type="REAL" isMandatory="true" length="12"/>
996 <db-attribute name="marginpercent" type="REAL" isMandatory="true" length="12"/>
997- <db-attribute name="name" type="VARCHAR" length="50"/>
998+ <db-attribute name="name" type="VARCHAR" length="250"/>
999 <db-attribute name="sellprice" type="REAL" isMandatory="true" length="12"/>
1000 </db-entity>
1001 <db-entity name="service_payment" catalog="u170323_test">
1002@@ -482,7 +489,7 @@
1003 </db-entity>
1004 <db-entity name="userright" catalog="u170323_test">
1005 <db-attribute name="deletedate" type="TIMESTAMP" length="19"/>
1006- <db-attribute name="id" type="BIGINT" isPrimaryKey="true" isGenerated="true" isMandatory="true" length="10"/>
1007+ <db-attribute name="id" type="BIGINT" isPrimaryKey="true" isMandatory="true" length="10"/>
1008 <db-attribute name="name" type="VARCHAR" isMandatory="true" length="50"/>
1009 </db-entity>
1010 <db-entity name="userrole" catalog="u170323_test">
1011@@ -502,27 +509,11 @@
1012 <db-attribute name="name" type="VARCHAR" isMandatory="true" length="45"/>
1013 <db-attribute name="version" type="INTEGER" isMandatory="true" length="10"/>
1014 </db-entity>
1015- <db-entity name="vlnews" catalog="u170323_test">
1016- <db-attribute name="ann" type="LONGVARCHAR" length="65535"/>
1017- <db-attribute name="arch" type="SMALLINT" length="5"/>
1018- <db-attribute name="autor" type="VARCHAR" length="255"/>
1019- <db-attribute name="data" type="DATE" length="10"/>
1020- <db-attribute name="descr" type="LONGVARCHAR" length="65535"/>
1021- <db-attribute name="img1b" type="VARCHAR" isMandatory="true" length="255"/>
1022- <db-attribute name="img1m" type="VARCHAR" length="255"/>
1023- <db-attribute name="img2b" type="VARCHAR" isMandatory="true" length="255"/>
1024- <db-attribute name="img2m" type="VARCHAR" isMandatory="true" length="255"/>
1025- <db-attribute name="img3b" type="VARCHAR" isMandatory="true" length="255"/>
1026- <db-attribute name="img3m" type="VARCHAR" isMandatory="true" length="255"/>
1027- <db-attribute name="name" type="LONGVARCHAR" length="65535"/>
1028- <db-attribute name="see" type="SMALLINT" length="5"/>
1029- <db-attribute name="title" type="VARCHAR" length="255"/>
1030- <db-attribute name="uid" type="BIGINT" isPrimaryKey="true" isMandatory="true" length="10"/>
1031- <db-attribute name="url" type="VARCHAR" length="255"/>
1032- </db-entity>
1033 <obj-entity name="Block" className="cbadmin.entity2.Block" dbEntityName="block" superClassName="cbadmin.entity2.db_interface">
1034- <obj-attribute name="capacity" type="short" db-attribute-path="capacity"/>
1035+ <obj-attribute name="capacity" type="int" db-attribute-path="capacity"/>
1036+ <obj-attribute name="deletedate" type="java.util.Date" db-attribute-path="deletedate"/>
1037 <obj-attribute name="price" type="float" db-attribute-path="price"/>
1038+ <post-add method-name="onPostAdd"/>
1039 <post-update method-name="onPostUpdate"/>
1040 <post-load method-name="onPostLoad"/>
1041 </obj-entity>
1042@@ -535,6 +526,7 @@
1043 <obj-attribute name="discount" type="java.lang.Float" db-attribute-path="discount"/>
1044 <obj-attribute name="fax" type="java.lang.String" db-attribute-path="fax"/>
1045 <obj-attribute name="icq" type="java.lang.String" db-attribute-path="ICQ"/>
1046+ <obj-attribute name="id_key" type="java.lang.Long" db-attribute-path="id"/>
1047 <obj-attribute name="isVendor" type="java.lang.Byte" db-attribute-path="is_vendor"/>
1048 <obj-attribute name="name" type="java.lang.String" db-attribute-path="name"/>
1049 <obj-attribute name="password" type="java.lang.String" db-attribute-path="password"/>
1050@@ -554,10 +546,12 @@
1051 <obj-attribute name="contactPassport" type="java.lang.String" db-attribute-path="contact_passport"/>
1052 <obj-attribute name="contactPatronymic" type="java.lang.String" db-attribute-path="contact_patronymic"/>
1053 <obj-attribute name="contactRegAddress" type="java.lang.String" db-attribute-path="contact_reg_address"/>
1054+ <obj-attribute name="id_key" type="java.lang.Long" db-attribute-path="id_client"/>
1055 <obj-attribute name="passportz" type="java.lang.String" db-attribute-path="passportz"/>
1056 <obj-attribute name="sex" type="java.lang.Long" db-attribute-path="sex"/>
1057 </obj-entity>
1058 <obj-entity name="ClientUl" className="cbadmin.entity2.ClientUl" dbEntityName="client_ul" superClassName="cbadmin.entity2.db_interface">
1059+ <obj-attribute name="gendir" type="java.lang.String" db-attribute-path="gendir"/>
1060 <obj-attribute name="orgagreeDate" type="java.util.Date" db-attribute-path="orgagree_date"/>
1061 <obj-attribute name="orgagreeEnd" type="java.util.Date" db-attribute-path="orgagree_end"/>
1062 <obj-attribute name="orgagreeNum" type="java.lang.String" db-attribute-path="orgagree_num"/>
1063@@ -610,13 +604,13 @@
1064 <obj-attribute name="timeTo" type="java.util.Date" db-attribute-path="time_to"/>
1065 </obj-entity>
1066 <obj-entity name="ListAge" className="cbadmin.entity2.ListAge" dbEntityName="list_age" superClassName="cbadmin.entity2.db_interface">
1067- <obj-attribute name="agefrom" type="java.lang.Byte" db-attribute-path="agefrom"/>
1068- <obj-attribute name="ageto" type="java.lang.Byte" db-attribute-path="ageto"/>
1069+ <obj-attribute name="agefrom" type="int" db-attribute-path="agefrom"/>
1070+ <obj-attribute name="ageto" type="int" db-attribute-path="ageto"/>
1071 <obj-attribute name="deletedate" type="java.util.Date" db-attribute-path="deletedate"/>
1072 <obj-attribute name="frozen" type="java.lang.Byte" db-attribute-path="frozen"/>
1073- <obj-attribute name="isAdult" type="java.lang.Byte" db-attribute-path="is_adult"/>
1074- <obj-attribute name="isChild" type="java.lang.Byte" db-attribute-path="is_child"/>
1075- <obj-attribute name="isInfant" type="java.lang.Byte" db-attribute-path="is_infant"/>
1076+ <obj-attribute name="isAdult" type="int" db-attribute-path="is_adult"/>
1077+ <obj-attribute name="isChild" type="int" db-attribute-path="is_child"/>
1078+ <obj-attribute name="isInfant" type="int" db-attribute-path="is_infant"/>
1079 <obj-attribute name="name" type="java.lang.String" db-attribute-path="name"/>
1080 <obj-attribute name="webshow" type="java.lang.Byte" db-attribute-path="webshow"/>
1081 </obj-entity>
1082@@ -683,6 +677,14 @@
1083 <obj-attribute name="name" type="java.lang.String" db-attribute-path="name"/>
1084 <obj-attribute name="webshow" type="java.lang.Byte" db-attribute-path="webshow"/>
1085 </obj-entity>
1086+ <obj-entity name="ListEmail" className="cbadmin.entity2.ListEmail" dbEntityName="list_email" superClassName="cbadmin.entity2.db_interface">
1087+ <obj-attribute name="clientType" type="int" db-attribute-path="client_type"/>
1088+ <obj-attribute name="deletedate" type="java.util.Date" db-attribute-path="deletedate"/>
1089+ <obj-attribute name="emailBody" type="java.lang.String" db-attribute-path="email_body"/>
1090+ <obj-attribute name="emailSubject" type="java.lang.String" db-attribute-path="email_subject"/>
1091+ <obj-attribute name="frozen" type="java.lang.Byte" db-attribute-path="frozen"/>
1092+ <obj-attribute name="name" type="java.lang.String" db-attribute-path="name"/>
1093+ </obj-entity>
1094 <obj-entity name="ListNeighbours" className="cbadmin.entity2.ListNeighbours" dbEntityName="list_neighbours" superClassName="cbadmin.entity2.db_interface">
1095 <obj-attribute name="distance" type="java.lang.Integer" db-attribute-path="distance"/>
1096 <obj-attribute name="howToGetTo" type="java.lang.String" db-attribute-path="how_to_get_to"/>
1097@@ -690,7 +692,11 @@
1098 <obj-entity name="ListPayMethod" className="cbadmin.entity2.ListPayMethod" dbEntityName="list_pay_method" superClassName="cbadmin.entity2.db_interface">
1099 <obj-attribute name="deletedate" type="java.util.Date" db-attribute-path="deletedate"/>
1100 <obj-attribute name="frozen" type="java.lang.Byte" db-attribute-path="frozen"/>
1101+ <obj-attribute name="id_key" type="java.lang.Long" db-attribute-path="id"/>
1102 <obj-attribute name="name" type="java.lang.String" db-attribute-path="name"/>
1103+ <obj-attribute name="owner" type="java.lang.String" db-attribute-path="owner"/>
1104+ <obj-attribute name="percentCommission" type="java.lang.Float" db-attribute-path="percent_commission"/>
1105+ <obj-attribute name="rateState" type="int" db-attribute-path="rate_state"/>
1106 <obj-attribute name="webshow" type="java.lang.Byte" db-attribute-path="webshow"/>
1107 </obj-entity>
1108 <obj-entity name="ListReservationStatus" className="cbadmin.entity2.ListReservationStatus" dbEntityName="list_reservation_status" superClassName="cbadmin.entity2.db_interface">
1109@@ -739,6 +745,7 @@
1110 <obj-attribute name="deletedate" type="java.util.Date" db-attribute-path="deletedate"/>
1111 <obj-attribute name="family" type="java.lang.String" db-attribute-path="family"/>
1112 <obj-attribute name="idOffer" type="java.lang.Long" db-attribute-path="id_offer"/>
1113+ <obj-attribute name="id_key" type="java.lang.Long" db-attribute-path="id"/>
1114 <obj-attribute name="isDocsBack" type="java.lang.Byte" db-attribute-path="is_docs_back"/>
1115 <obj-attribute name="isDocsThere" type="java.lang.Byte" db-attribute-path="is_docs_there"/>
1116 <obj-attribute name="name" type="java.lang.String" db-attribute-path="name"/>
1117@@ -754,6 +761,7 @@
1118 </obj-entity>
1119 <obj-entity name="Payment" className="cbadmin.entity2.Payment" dbEntityName="payment" superClassName="cbadmin.entity2.db_interface">
1120 <obj-attribute name="comment" type="java.lang.String" db-attribute-path="comment"/>
1121+ <obj-attribute name="commission" type="java.math.BigDecimal" db-attribute-path="commission"/>
1122 <obj-attribute name="dateFactpayment" type="java.util.Date" db-attribute-path="date_factpayment"/>
1123 <obj-attribute name="datePayment" type="java.util.Date" db-attribute-path="date_payment"/>
1124 <obj-attribute name="deletedate" type="java.util.Date" db-attribute-path="deletedate"/>
1125@@ -762,12 +770,16 @@
1126 <obj-attribute name="moneyholder" type="java.lang.String" db-attribute-path="moneyholder"/>
1127 <obj-attribute name="pluspercent" type="java.lang.Float" db-attribute-path="pluspercent"/>
1128 <obj-attribute name="summaPayed" type="java.lang.Double" db-attribute-path="summa_payed"/>
1129+ <post-persist method-name="onPostPersist"/>
1130 <post-update method-name="onPostUpdate"/>
1131 <post-load method-name="onPostLoad"/>
1132 </obj-entity>
1133 <obj-entity name="Reservation" className="cbadmin.entity2.Reservation" dbEntityName="reservation" superClassName="cbadmin.entity2.db_interface">
1134- <obj-attribute name="billdate" type="java.util.Date" db-attribute-path="billdate"/>
1135 <obj-attribute name="comment" type="java.lang.String" db-attribute-path="comment"/>
1136+ <obj-attribute name="dateBill" type="java.util.Date" db-attribute-path="date_bill"/>
1137+ <obj-attribute name="dateConfirm" type="java.util.Date" db-attribute-path="date_confirm"/>
1138+ <obj-attribute name="datePay" type="java.util.Date" db-attribute-path="date_pay"/>
1139+ <obj-attribute name="datePrepay" type="java.util.Date" db-attribute-path="date_prepay"/>
1140 <obj-attribute name="dateReserved" type="java.util.Date" db-attribute-path="date_reserved"/>
1141 <obj-attribute name="deletedate" type="java.util.Date" db-attribute-path="deletedate"/>
1142 <obj-attribute name="deliveryAddress" type="java.lang.String" db-attribute-path="delivery_address"/>
1143@@ -776,12 +788,11 @@
1144 <obj-attribute name="fax" type="java.lang.String" db-attribute-path="fax"/>
1145 <obj-attribute name="icq" type="java.lang.String" db-attribute-path="icq"/>
1146 <obj-attribute name="idOffer" type="long" db-attribute-path="id_offer"/>
1147+ <obj-attribute name="id_key" type="java.lang.Long" db-attribute-path="id"/>
1148 <obj-attribute name="isfrozen" type="byte" db-attribute-path="isfrozen"/>
1149 <obj-attribute name="number" type="java.lang.String" db-attribute-path="number"/>
1150- <obj-attribute name="payDate" type="java.util.Date" db-attribute-path="pay_date"/>
1151 <obj-attribute name="percentCommission" type="java.lang.Float" db-attribute-path="percent_commission"/>
1152 <obj-attribute name="phone" type="java.lang.String" db-attribute-path="phone"/>
1153- <obj-attribute name="prepayDate" type="java.util.Date" db-attribute-path="prepay_date"/>
1154 <obj-attribute name="summaPayed" type="float" db-attribute-path="summa_payed"/>
1155 <obj-attribute name="summaReserved" type="float" db-attribute-path="summa_reserved"/>
1156 <post-add method-name="onPostAdd"/>
1157@@ -800,9 +811,12 @@
1158 <obj-attribute name="contactPatronymic" type="java.lang.String" db-attribute-path="contact_patronymic"/>
1159 <obj-attribute name="contactRegaddress" type="java.lang.String" db-attribute-path="contact_regaddress"/>
1160 <obj-attribute name="deletedate" type="java.util.Date" db-attribute-path="deletedate"/>
1161+ <obj-attribute name="id_key" type="java.lang.Long" db-attribute-path="id"/>
1162 </obj-entity>
1163 <obj-entity name="ReservationUl" className="cbadmin.entity2.ReservationUl" dbEntityName="reservation_ul" superClassName="cbadmin.entity2.db_interface">
1164 <obj-attribute name="deletedate" type="java.util.Date" db-attribute-path="deletedate"/>
1165+ <obj-attribute name="gendir" type="java.lang.String" db-attribute-path="gendir"/>
1166+ <obj-attribute name="id_key" type="java.lang.Long" db-attribute-path="id"/>
1167 <obj-attribute name="isVendor" type="java.lang.Byte" db-attribute-path="is_vendor"/>
1168 <obj-attribute name="orgagreeDate" type="java.util.Date" db-attribute-path="orgagree_date"/>
1169 <obj-attribute name="orgagreeEnd" type="java.util.Date" db-attribute-path="orgagree_end"/>
1170@@ -826,6 +840,7 @@
1171 <obj-attribute name="buyprice" type="java.lang.Float" db-attribute-path="buyprice"/>
1172 <obj-attribute name="dateFrom" type="java.util.Date" db-attribute-path="date_from"/>
1173 <obj-attribute name="dateTo" type="java.util.Date" db-attribute-path="date_to"/>
1174+ <obj-attribute name="id_key" type="java.lang.Long" db-attribute-path="id"/>
1175 <obj-attribute name="marginfix" type="java.lang.Float" db-attribute-path="marginfix"/>
1176 <obj-attribute name="marginpercent" type="java.lang.Float" db-attribute-path="marginpercent"/>
1177 <obj-attribute name="name" type="java.lang.String" db-attribute-path="name"/>
1178@@ -956,9 +971,12 @@
1179 <db-relationship name="flightArray" source="flight_program" target="flight" toMany="true">
1180 <db-attribute-pair source="id" target="id_flight_program"/>
1181 </db-relationship>
1182- <db-relationship name="flightProgramPeriodsArray" source="flight_program" target="flight_program_periods" toMany="true">
1183+ <db-relationship name="flightProgramPeriods" source="flight_program" target="flight_program_periods" toMany="true">
1184 <db-attribute-pair source="id" target="id_flight_program"/>
1185 </db-relationship>
1186+ <db-relationship name="toFlightProgram" source="flight_program" target="flight_program" toMany="false">
1187+ <db-attribute-pair source="id_flight_program_paired" target="id"/>
1188+ </db-relationship>
1189 <db-relationship name="toListAirline" source="flight_program" target="list_airline" toMany="false">
1190 <db-attribute-pair source="id_airline" target="id"/>
1191 </db-relationship>
1192@@ -1061,6 +1079,9 @@
1193 <db-relationship name="servicePriceArray" source="list_country" target="service_price" toMany="true">
1194 <db-attribute-pair source="id" target="id_country"/>
1195 </db-relationship>
1196+ <db-relationship name="toListCurrency" source="list_country" target="list_currency" toMany="false">
1197+ <db-attribute-pair source="id_currency_preferred" target="id"/>
1198+ </db-relationship>
1199 <db-relationship name="vendorPreferredArray" source="list_country" target="vendor_preferred" toMany="true">
1200 <db-attribute-pair source="id" target="id_country"/>
1201 </db-relationship>
1202@@ -1359,7 +1380,8 @@
1203 <obj-relationship name="offersForIdFlightthere" source="Flight" target="Offer" deleteRule="Deny" db-relationship-path="offersForThere"/>
1204 <obj-relationship name="passengersForIdFlightback" source="Flight" target="Passenger" deleteRule="Deny" db-relationship-path="passengersForBack"/>
1205 <obj-relationship name="passengersForIdFlightthere" source="Flight" target="Passenger" deleteRule="Deny" db-relationship-path="passengersForThere"/>
1206- <obj-relationship name="flightProgramPeriodses" source="FlightProgram" target="FlightProgramPeriods" deleteRule="Deny" db-relationship-path="flightProgramPeriodsArray"/>
1207+ <obj-relationship name="flightProgramPaired" source="FlightProgram" target="FlightProgram" deleteRule="Nullify" db-relationship-path="toFlightProgram"/>
1208+ <obj-relationship name="flightProgramPeriods" source="FlightProgram" target="FlightProgramPeriods" deleteRule="Deny" db-relationship-path="flightProgramPeriods"/>
1209 <obj-relationship name="flights" source="FlightProgram" target="Flight" deleteRule="Deny" db-relationship-path="flightArray"/>
1210 <obj-relationship name="listAirline" source="FlightProgram" target="ListAirline" deleteRule="Nullify" db-relationship-path="toListAirline"/>
1211 <obj-relationship name="listAirportByIdAirportFrom" source="FlightProgram" target="ListAirport" deleteRule="Nullify" db-relationship-path="toListAirport"/>
1212@@ -1393,6 +1415,7 @@
1213 <obj-relationship name="passengersForIdClassthere" source="ListClass" target="Passenger" deleteRule="Deny" db-relationship-path="passengersForIdClassthere"/>
1214 <obj-relationship name="listAirlines" source="ListCountry" target="ListAirline" deleteRule="Deny" db-relationship-path="listAirlineArray"/>
1215 <obj-relationship name="listCities" source="ListCountry" target="ListCity" deleteRule="Deny" db-relationship-path="listCityArray"/>
1216+ <obj-relationship name="preferredCurrency" source="ListCountry" target="ListCurrency" deleteRule="Nullify" db-relationship-path="toListCurrency"/>
1217 <obj-relationship name="reservations" source="ListCountry" target="Reservation" deleteRule="Deny" db-relationship-path="reservationArray"/>
1218 <obj-relationship name="servicePriceArray" source="ListCountry" target="ServicePrice" deleteRule="Deny" db-relationship-path="servicePriceArray"/>
1219 <obj-relationship name="vendorPreferredArray" source="ListCountry" target="VendorPreferred" deleteRule="Deny" db-relationship-path="vendorPreferredArray"/>
1220
1221=== modified file 'src/cbadmin.properties'
1222--- src/cbadmin.properties 2010-11-13 10:31:30 +0000
1223+++ src/cbadmin.properties 2011-04-25 18:28:30 +0000
1224@@ -4,6 +4,10 @@
1225 mail.user = maxzi@mail.ru
1226 mail.password = samba
1227 mail.smtp.auth = true
1228+mail.from = cbadmin@frontdesk.ru
1229+
1230+#\u0435\u0441\u043b\u0438 \u0443\u043a\u0430\u0437\u0430\u043d, \u0442\u043e \u043f\u043e \u043d\u0435\u043c\u0443 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u043e\u043c \u0443\u0445\u043e\u0434\u044f\u0442 \u043b\u043e\u0433\u0438 \u043f\u0440\u0438 \u043e\u0448\u0438\u0431\u043a\u0430\u0445
1231+adminEmail = mcseemz@gmail.com
1232
1233 #mail.transport.protocol = smtp
1234 #mail.host = mail.hqhost.net
1235@@ -94,4 +98,14 @@
1236 backupScript = backupscripts/mysqlbackup
1237 restoreScript = backupscripts/mysqlrestore
1238
1239-cayenneXml = cayenne-test.xml
1240\ No newline at end of file
1241+#test file
1242+cayenneXml = cayenne-test.xml
1243+
1244+#use confirmation date for payment instead of invoice date
1245+useConfirmdate = 1
1246+
1247+#tolerance in hundredths to detect full payment
1248+compareDifference = 5
1249+
1250+#wait for file in print, seconds
1251+printTimeout = 30
1252\ No newline at end of file
1253
1254=== added directory 'src/cbadmin/business'
1255=== added file 'src/cbadmin/business/Money.java'
1256--- src/cbadmin/business/Money.java 1970-01-01 00:00:00 +0000
1257+++ src/cbadmin/business/Money.java 2011-04-25 18:28:30 +0000
1258@@ -0,0 +1,334 @@
1259+package cbadmin.business;
1260+
1261+//import java.math.BigDecimal;
1262+
1263+import cbadmin.util.utils;
1264+import java.math.BigDecimal;
1265+import java.math.BigInteger;
1266+import java.sql.CallableStatement;
1267+import java.sql.PreparedStatement;
1268+import java.sql.ResultSet;
1269+import java.sql.Types;
1270+import org.apache.cayenne.map.DbAttribute;
1271+import org.apache.cayenne.validation.ValidationResult;
1272+
1273+//import java.math.BigInteger;
1274+//import java.sql.CallableStatement;
1275+//import java.sql.PreparedStatement;
1276+//import java.sql.ResultSet;
1277+//import java.sql.Types;
1278+//import org.apache.cayenne.map.DbAttribute;
1279+//import org.apache.cayenne.validation.ValidationResult;
1280+
1281+/**
1282+ * взято из
1283+ * http://www.idinews.com/sourcecode/MoneyJava.html
1284+ * @author 1996 Information Disciplines, Inc., Chicago
1285+ */
1286+
1287+//%TITLE Money Class (copyright 1996, Information Disciplines, Inc)
1288+public final class Money implements org.apache.cayenne.access.types.ExtendedType //// implements java.lang,Comparable
1289+{
1290+// Internal representation: Always an integer, scaled so that unity
1291+// ----------------------- is the smallest measurable quantity
1292+
1293+protected int scale=default_scale;// Smallest fraction of monetary unit to
1294+public static int default_scale=10000;// Smallest fraction of monetary unit to
1295+ // be represented (e.g. 100: cents,
1296+ // 200: 8ths, 1000: mills);
1297+ // User can override before creating
1298+ // any Money objects
1299+
1300+protected long value; // Amount in monetary units * scale
1301+//%SPACE 3
1302+// Constructors and assignment operations
1303+// --------------------------------------
1304+
1305+// To support literal constants as well as simple input, we allow
1306+// conversion from floating point, just as in the constructor.
1307+
1308+ public Money(final double x) {value = Math.round(x * scale);}
1309+ public Money(final double x, final byte digits) {scale = 10^digits; value = Math.round(x * (scale));}
1310+ public Money() {} // Default constructor, for efficiency
1311+ public Money(final Money x) {value = x.value; scale = x.scale; }
1312+ public Money(final BigDecimal x) {
1313+ if (x==null) value = 0;
1314+ else value = (x.multiply(new BigDecimal(scale))).longValue();
1315+ }
1316+//%SPACE 3
1317+// Pseudo assignment operators
1318+// ---------------------------
1319+
1320+ public Money set(final Money rs)
1321+ {value= rs.value; return this;}
1322+ public Money set(final double rs)
1323+ {value= Math.round(rs * scale); return this;}
1324+//%SPACE 3
1325+// Accessors
1326+// ---------
1327+
1328+public long wholeUnits() {return value / scale;}
1329+
1330+public short cents () {return (short)((value*100)/scale
1331+ - (100 * wholeUnits()));}
1332+
1333+/**
1334+ * нельзя пользоваться этим методом при работе с валютами. только для отладки.
1335+ * может быть потеря точности потеря точности
1336+ * @return
1337+ */
1338+public double doubleValue () {return (double)value / (double)scale;}
1339+
1340+public BigDecimal bigdecimalValue () {return new BigDecimal(value).divide(new BigDecimal(scale));}
1341+
1342+//%EJECT
1343+// Numeric utility functions
1344+// -------------------------
1345+
1346+public Money abs()
1347+ {Money result = new Money(this);
1348+ if (value < 0) result.value = - result.value;
1349+ return result;
1350+ }
1351+
1352+public short sign()
1353+ {return (short)(value > 0 ? 1
1354+ : value < 0 ? -1 : 0);}
1355+
1356+// Relational (predicate) operations:
1357+// ---------------------------------
1358+
1359+ public boolean equals (final Money rs) {return value == rs.value;}
1360+ public boolean lessThan (final Money rs) {return value < rs.value;}
1361+ public boolean greaterThan (final Money rs) {return value > rs.value;}
1362+
1363+ public boolean equals (final double rs) {return value == rs * scale;}
1364+ public boolean lessThan (final double rs) {return value < rs * scale;}
1365+ public boolean greaterThan (final double rs) {return value > rs * scale;}
1366+
1367+// These three functions are to comply with Java library conventions.
1368+// They are rarely needed in manipulating Money objects.
1369+
1370+ @Override
1371+ public boolean equals (final Object rs)
1372+ {return rs instanceof Money && ((Money)rs).value == value;}
1373+
1374+ public int compareTo (final Object rs)
1375+ {return sub((Money)rs).sign();}
1376+
1377+ /**
1378+ * сравнение с учетом разрешенной погрешности
1379+ * @param rs
1380+ * @return -1 если меньше, 0 если разница в пределах допуска, иначе +1
1381+ */
1382+public int compareTolerance (final Money rs) {
1383+ return utils.compareMoney(doubleValue(), rs.doubleValue());
1384+}
1385+
1386+ @Override
1387+ public int hashCode ()
1388+ {return (new Long(value)).hashCode();}
1389+
1390+// Arithmetic operations:
1391+// ---------------------
1392+
1393+// For efficiency we follow Scott Myers ("More Effective C++", Addison
1394+// Wesley) in defining the compound assignment operators as primitive,
1395+// and then defining most ordinary arithmetic operators in terms of them.
1396+// Note that the compound assignment operators are much more
1397+// efficient, since no new object is created.
1398+
1399+ public Money addSet (final Money rs)
1400+ {value += rs.value; return this;}
1401+ public Money addSet (final double rs)
1402+ {value += rs * scale; return this;}
1403+ public Money subSet (final Money rs)
1404+ {value -= rs.value; return this;}
1405+ public Money subSet (final double rs)
1406+ {value -= rs * scale; return this;}
1407+ public Money mpySet (final double rs)
1408+ {value *= rs; return this;}
1409+ public Money divSet (final double rs)
1410+ {Math.round(value/=rs); return this;}
1411+
1412+ public Money minusSet()
1413+ {value = - value; return this;}
1414+
1415+ public Money add (final Money rs)
1416+ {return new Money(this).addSet(rs);}
1417+ public Money add (final double rs)
1418+ {return new Money(this).addSet(rs);}
1419+ public Money sub (final Money rs)
1420+ {return new Money(this).subSet(rs);}
1421+ public Money sub (final double rs)
1422+ {return new Money(this).subSet(rs);}
1423+ public Money mpy (final double rs)
1424+ {return new Money(this).mpySet(rs);}
1425+ public Money div (final double rs)
1426+ {return new Money(this).divSet(rs);}
1427+ public double div (final Money rs)
1428+// {return Math.round((double)value/(double)rs.value);}
1429+ {return (double)value/(double)rs.value /**(double)rs.scale/(double)scale*/;}
1430+//public Money div (final Money rs)
1431+// {return new Money(this).divSet(rs);}
1432+
1433+ public Money minus()
1434+ {return new Money(this).minusSet();}
1435+//%EJECT
1436+// External representation: Constants used in output and input functions
1437+// ----------------------- (User may override)
1438+
1439+public static String pfx_symbol = ""; // Leading currency symbol '$'
1440+public static String sfx_symbol = ""; // Trailing currency symbol
1441+public static char decimal_point = '.'; // Character for fractions
1442+public static String group_separator = ""; // Character for 1000nds ','
1443+public static String unit_name = "dollar"; // Name of monetary unit
1444+public static String cent_name = "cent"; // Name of fraction unit
1445+
1446+static long divisors[] = { 1, 1000, 1000000,
1447+ (long)1E9, (long)1E12,(long)1E15, (long)1E18};
1448+
1449+// Conversion functions
1450+// --------------------
1451+
1452+// The following function is needed by toString (below) in order to
1453+// develop its result in left-to-right order:
1454+
1455+ private static short log10(long x) // This function returns the number
1456+ {short result; // of decimal digits in an integer
1457+ for (result=0; x>=10; result++, x/=10); // Decimal "shift" and count
1458+ return result;
1459+ }
1460+
1461+// Conversion to string
1462+// --------------------
1463+
1464+// The result (external Money representation) is the concatenation of:
1465+// - a leading minus sign, if needed
1466+// - the prefix currency symbol, if any (U.S.: '$')
1467+// - groups of 3-digits separated by the group_separator (English: comma)
1468+// (no leading zeros on the leftmost group)
1469+// - a decimal point (English: period)
1470+// - the fractional portion, normally two digits, more if needed
1471+// and if scale > 100
1472+// - the suffix currency symbol, if any (U.S.: none)
1473+
1474+ public String toString (int signs) {
1475+boolean negative = (value < 0); // Remember original sign
1476+ value = negative ? -value : value; // Discard sign temporarily
1477+ long whole = wholeUnits(); // Separate arg. into whole
1478+ short cents = cents(); // and fractional monetary units
1479+ short rest = (short)(value - (cents + 100 * whole) * scale / 100);
1480+
1481+ String result = (negative ? "-" : ""); // Insert prefix minus, if needed
1482+ result = result + pfx_symbol; // Insert dollar sign or equiv.
1483+
1484+// (function continued on next page)
1485+//%EJECT
1486+ // Append groups of 3 digits separated by punctuation
1487+
1488+ int group_no = log10(whole) / 3;
1489+ int group_val = (int)(whole / divisors[group_no]);
1490+
1491+ result = result + group_val; // Append leftmost 3-digits
1492+ // without leading 0's
1493+
1494+ while (group_no > 0) // For each remaining 3-digit group
1495+ {result = result + group_separator; // Insert punctuation
1496+ whole -= group_val * divisors[group_no--]; // Compute new remainder
1497+ group_val = (short)(whole/divisors[group_no]);// Get next 3-digit value
1498+ if (group_val < 100) result = result + "0"; // Insert embedded 0's
1499+ if (group_val < 10) result = result + "0"; // as needed
1500+ result = result + group_val; // Append group value
1501+ }
1502+
1503+// Append the fractional portion
1504+
1505+ result = result + decimal_point; // Append decimal point
1506+ if (cents < 10) // Insert leading 0 if needed
1507+ result = result + "0";
1508+ result = result + cents; // Append cents value
1509+
1510+ if (rest > 0) // Test for fractional pennies
1511+ {while ((rest *= 10) < scale); // (rest *= power(10,log10(scale)))
1512+// result = result + (rest/scale);// Append fractional pennies, if any
1513+ String pennies = new Long(rest/scale).toString();
1514+ result = result + pennies.substring(0, signs>pennies.length() ? pennies.length()-1 : signs-1);// Append fractional pennies, if any
1515+ }
1516+ if (negative) value = - value; // Restore original sign
1517+
1518+// utils.getLogger().debug("Money value="+value+" toString="+result);
1519+ return result + sfx_symbol; // Append final symbol, if any
1520+ }
1521+
1522+
1523+ @Override
1524+ public String toString () {
1525+ return toString(10);
1526+
1527+} // ******* End of toString function
1528+
1529+ //==============================================================
1530+ //org.apache.cayenne.access.types.ExtendedType
1531+
1532+ public String getClassName() {
1533+ return this.getClass().getName();
1534+ }
1535+
1536+ public boolean validateProperty(Object source, String property, Object value,
1537+ DbAttribute dbAttribute, ValidationResult validationResult) {
1538+ Money money = (Money) value;
1539+ //неможет быть случая когда что-то не так
1540+
1541+// if (!g.isValid()) {
1542+// String msg = "Invalid geometry";
1543+// validationResult.addFailure(new BeanValidationFailure(source, property, msg));
1544+// return false;
1545+// }
1546+ return true;
1547+ }
1548+
1549+ public void setJdbcObject(PreparedStatement statement, Object value, int pos, int type,
1550+ int precision) throws Exception {
1551+ Money g = (Money) value;
1552+ switch (type) {
1553+// case Types.BLOB:
1554+// statement.setBytes(pos, g.toText().getBytes(CHARSET));
1555+// break;
1556+ default:
1557+ statement.setBigDecimal(pos, g.bigdecimalValue());
1558+ break;
1559+ }
1560+ }
1561+
1562+ public Object materializeObject(ResultSet rs, int index, int type) throws Exception {
1563+ BigDecimal dec = null;
1564+ switch (type) {
1565+// case Types.BLOB:
1566+// wkt = new String(rs.getBytes(index), CHARSET);
1567+// break;
1568+ default:
1569+ dec = rs.getBigDecimal(index);
1570+ break;
1571+ }
1572+ if (dec == null) return (Money) null;
1573+
1574+ return new Money(dec);
1575+ }
1576+
1577+ public Object materializeObject(CallableStatement rs, int index, int type) throws Exception {
1578+ BigDecimal dec = null;
1579+ switch (type) {
1580+// case Types.BLOB:
1581+// wkt = new String(rs.getBytes(index), CHARSET);
1582+// break;
1583+ default:
1584+ dec = rs.getBigDecimal(index);
1585+ break;
1586+ }
1587+ if (dec == null) return (Money) null;
1588+
1589+ return new Money(dec);
1590+ }
1591+
1592+} // ******* End of class definition
1593
1594=== added file 'src/cbadmin/business/PaymentVendorInterface.java'
1595--- src/cbadmin/business/PaymentVendorInterface.java 1970-01-01 00:00:00 +0000
1596+++ src/cbadmin/business/PaymentVendorInterface.java 2011-04-25 18:28:30 +0000
1597@@ -0,0 +1,52 @@
1598+package cbadmin.business;
1599+
1600+import cbadmin.entity2.Payment;
1601+
1602+/**
1603+ * обработчик специальных типов оплат. например, оплата с депозита, которая должна изменять сопутствующие таблицы
1604+ * вендор не влияет на сохранение оплаты, он производит вспомогательные действия
1605+ * @author mcseem
1606+ */
1607+public interface PaymentVendorInterface {
1608+
1609+ /**
1610+ * проверить, может ли пользователь что-то делать с этой оплатой
1611+ * @return true если всё в порядке, права есть
1612+ */
1613+ public boolean checkRights();
1614+
1615+ /**
1616+ * можно ли сохранять.
1617+ * @param payment
1618+ * @return null если нет ошибок, оначе строку с ошибкой
1619+ */
1620+ public String canSave(Payment payment, int operation);
1621+
1622+ /**
1623+ * после добавления оплаты
1624+ * @param payment
1625+ * @return
1626+ */
1627+ public boolean add(Payment payment);
1628+ /**
1629+ * перед удалением оплаты
1630+ * @param payment
1631+ * @return
1632+ */
1633+ public boolean delete(Payment payment);
1634+ /**
1635+ * обновление оплаты. статус указывает,
1636+ * @param payment
1637+ * @param order - порядок. CONST_FROM - предыдущее состояние оплаты, CONST_TO - финальное состояние оплаты
1638+ * @return
1639+ */
1640+ public boolean update(Payment payment, int order);
1641+
1642+ public final int CONST_SAVE_OPERATION = 1;
1643+ public final int CONST_BEFORE_UPDATE_OPERATION = 2;
1644+ public final int CONST_AFTER_UPDATE_OPERATION = 3;
1645+ public final int CONST_DELETE_OPERATION = 4;
1646+
1647+ public final int CONST_FROM = 1;
1648+ public final int CONST_TO = 2;
1649+}
1650
1651=== added file 'src/cbadmin/business/Price.java'
1652--- src/cbadmin/business/Price.java 1970-01-01 00:00:00 +0000
1653+++ src/cbadmin/business/Price.java 2011-04-25 18:28:30 +0000
1654@@ -0,0 +1,100 @@
1655+package cbadmin.business;
1656+
1657+import cbadmin.entity2.ListAge;
1658+
1659+/**
1660+ * Найденная цена
1661+ * @author mcseem
1662+ */
1663+public final class Price {
1664+ private Money buyPrice = new Money();
1665+ private Money marginFix = new Money();
1666+ private Money marginPercent = new Money();
1667+ private Money sellPrice = new Money();
1668+ private ListAge age;
1669+// private int agefrom;
1670+// private int ageto;
1671+ private int period; //периоды действия из PriceInterface
1672+ private Integer id; //id найденной цены, если есть
1673+
1674+ public Price() {} //оптимизации
1675+
1676+ public Integer getId() {
1677+ return id;
1678+ }
1679+
1680+ public void setId(Integer id) {
1681+ this.id = id;
1682+ }
1683+
1684+ public int getPeriod() {
1685+ return period;
1686+ }
1687+
1688+ public void setPeriod(int period) {
1689+ this.period = period;
1690+ }
1691+
1692+ /**
1693+ * если цена относится к какому-либо конкретному возрасному периоду.
1694+ * применяется при расчете туров
1695+ * @return
1696+ */
1697+ public ListAge getListAge() {
1698+ return age;
1699+ }
1700+
1701+ public void setListAge(ListAge age) {
1702+ this.age = age;
1703+ }
1704+
1705+
1706+ public Money getBuyPrice() {
1707+ return buyPrice;
1708+ }
1709+
1710+ public void setBuyPrice(Money buyPrice) {
1711+ this.buyPrice = buyPrice;
1712+ }
1713+
1714+ public Money getMarginFix() {
1715+ return marginFix;
1716+ }
1717+
1718+ public void setMarginFix(Money marginFix) {
1719+ this.marginFix = marginFix;
1720+ }
1721+
1722+ public Money getMarginPercent() {
1723+ return marginPercent;
1724+ }
1725+
1726+ public void setMarginPercent(Money marginPercent) {
1727+ this.marginPercent = marginPercent;
1728+ }
1729+
1730+ public Money getSellPrice() {
1731+ return sellPrice;
1732+ }
1733+
1734+ public void setSellPrice(Money sellPrice) {
1735+ this.sellPrice = sellPrice;
1736+ }
1737+
1738+ /**
1739+ * пересчитать процент маржи
1740+ */
1741+ public void calcMarginPercent() {
1742+ if (getBuyPrice().wholeUnits()+getBuyPrice().cents()+
1743+ getMarginFix().wholeUnits()+getMarginFix().cents()==0) setMarginPercent(new Money(0));
1744+ else {
1745+ setMarginPercent(
1746+ new Money(getSellPrice().
1747+ div(getBuyPrice().add(getMarginFix()) )).add(-1).mpy(100)
1748+ );
1749+// utils.getLogger().debug("calcMarginPercent: sellprice="+getSellPrice().toString()+"bp+mf="+getBuyPrice().add(getMarginFix()).toString()+
1750+// " division="+getSellPrice().div(getBuyPrice().add(getMarginFix()) )
1751+// );
1752+ }
1753+ }
1754+}
1755
1756=== added file 'src/cbadmin/business/PriceInterface.java'
1757--- src/cbadmin/business/PriceInterface.java 1970-01-01 00:00:00 +0000
1758+++ src/cbadmin/business/PriceInterface.java 2011-04-25 18:28:30 +0000
1759@@ -0,0 +1,62 @@
1760+package cbadmin.business;
1761+
1762+import cbadmin.entity2.ListAge;
1763+import cbadmin.entity2.ListCountry;
1764+import cbadmin.entity2.ListCurrency;
1765+import java.util.Date;
1766+
1767+/**
1768+ * общий интерфейс для всех цен в базе
1769+ * @author mcseem
1770+ */
1771+public interface PriceInterface {
1772+
1773+ public void setId(Integer id);
1774+ public Integer getId();
1775+
1776+ public void setBuyprice(Float buyprice);
1777+ public Float getBuyprice();
1778+
1779+ public void setDateFrom(Date dateFrom);
1780+ public Date getDateFrom();
1781+
1782+ public void setDateTo(Date dateTo);
1783+
1784+ public Date getDateTo();
1785+
1786+ public void setMarginfix(Float marginfix);
1787+
1788+ public Float getMarginfix();
1789+
1790+ public void setMarginpercent(Float marginpercent);
1791+
1792+ public Float getMarginpercent();
1793+
1794+ public void setPeriod(Byte period);
1795+
1796+ public Byte getPeriod();
1797+
1798+ public void setSellprice(Float sellprice);
1799+
1800+ public Float getSellprice();
1801+
1802+ public void setListAge(ListAge listAge);
1803+
1804+ public ListAge getListAge();
1805+
1806+ public void setListCountry(ListCountry listCountry);
1807+
1808+ public ListCountry getListCountry();
1809+
1810+ public void setListCurrency(ListCurrency listCurrency);
1811+
1812+ public ListCurrency getListCurrency();
1813+
1814+ public boolean save();
1815+ public PriceInterface clone();
1816+
1817+ public static byte CONST_PERIOD_DAY = 0;
1818+ public static byte CONST_PERIOD_NIGHT = 1;
1819+ public static byte CONST_PERIOD_TRIP = 2;
1820+
1821+}
1822
1823=== added file 'src/cbadmin/business/PriceVendorDefault.java'
1824--- src/cbadmin/business/PriceVendorDefault.java 1970-01-01 00:00:00 +0000
1825+++ src/cbadmin/business/PriceVendorDefault.java 2011-04-25 18:28:30 +0000
1826@@ -0,0 +1,161 @@
1827+package cbadmin.business;
1828+
1829+import cbadmin.entity2.Client;
1830+import cbadmin.entity2.ListCountry;
1831+import cbadmin.entity2.ListCurrency;
1832+import cbadmin.entity2.ListService;
1833+import cbadmin.entity2.ServicePrice;
1834+import cbadmin.entity2.db_interface;
1835+import cbadmin.util.CalendarDate;
1836+import java.util.ArrayList;
1837+import java.util.Collection;
1838+import java.util.Date;
1839+import java.util.HashMap;
1840+import java.util.Iterator;
1841+import org.apache.cayenne.exp.ExpressionFactory;
1842+
1843+/**
1844+ * Поиск цен в услугах по-умолчанию
1845+ * ОГРАНИЧЕНИЕ - не работает поиск цен в случае если периоды меняются на ходу. до этого числа один, с этого другой.
1846+ * Предполагаем, что периоды установлен на сезон
1847+ *
1848+ * если не указана дата рождения или категория возраста
1849+ * то поднять все на дату начала, создать столько цен сколько найдено
1850+ * далее интеллект
1851+ * смотрим когда заканчивается период. Находим более раннюю дату - параметры или период. Считаем до этой даты
1852+ * выбираем след. дату, поднимаем периоды по условиям
1853+ * обычно периоды заканчиваются одновременно, поэтому сохраняем результат для других периодов
1854+ * если цена для этого возрастного периода не найдена, то он отваливается
1855+ * @author mcseem
1856+ */
1857+public class PriceVendorDefault extends PriceVendorProto implements PriceVendorInterface {
1858+ /**
1859+ * поиск по параметрам в хеше.
1860+ * @param params: параметры
1861+ * <ol>
1862+ * <li>CONST_PARAM_DATEFROM : Date</li>
1863+ * <li>CONST_PARAM_DATETO : Date</li>
1864+ * <li>CONST_PARAM_COUNTRY : ListCountry</li>
1865+ * <li>CONST_PARAM_LISTSERVICE : ListService</li>
1866+ * <li>CONST_PARAM_VENDOR : Client</li>
1867+ * <li>CONST_PARAM_CURRENCY : ListCurrency</li>
1868+ * <li>[CONST_PARAM_BIRTHDAY : Date]</li>
1869+ * <li>[CONST_PARAM_AGECATEGORY : Integer]</li>
1870+ * </ol>
1871+ * @return float[4] {buy, margin fix, margin %, sell}
1872+ */
1873+
1874+ public Collection<Price> findPrice(HashMap<String, Object> params) {
1875+ HashMap<Integer, Price> result = new HashMap(); //id возраста и цена, накопленная по этому возрасту
1876+// ListService service = (ListService) params.get(CONST_PARAM_LISTSERVICE);
1877+ CalendarDate datefrom = new CalendarDate(null, (Date) params.get(CONST_PARAM_DATEFROM));
1878+ if (!isCacheOn) cache.clear(); //будет локальный для текущего запуска
1879+
1880+ findPrice(params, result, datefrom, true); //запускаем обсчет
1881+ for (Price price : result.values()) price.calcMarginPercent();
1882+
1883+ return result.values();
1884+ }
1885+
1886+//------------------------------------------------
1887+ public void findPrice(HashMap<String, Object> params,
1888+ HashMap<Integer, Price> result,
1889+ CalendarDate datefrom,
1890+ boolean isFirst) {
1891+
1892+ ListService service = (ListService) params.get(CONST_PARAM_LISTSERVICE);
1893+ CalendarDate dateto = new CalendarDate(null,(Date) params.get(CONST_PARAM_DATETO));
1894+ ListCountry country = (ListCountry) params.get(CONST_PARAM_COUNTRY);
1895+ ListCurrency currency = (ListCurrency) params.get(CONST_PARAM_CURRENCY);
1896+ Client vendor = (Client) params.get(CONST_PARAM_VENDOR);
1897+
1898+ Date birthday = null;
1899+ Integer ageCategory = null;
1900+ if (params.get(CONST_PARAM_BIRTHDAY)!=null) birthday = (Date) params.get(CONST_PARAM_BIRTHDAY);
1901+ else if(params.get(CONST_PARAM_AGECATEGORY) != null) ageCategory = (Integer) params.get(CONST_PARAM_AGECATEGORY);
1902+
1903+ //из дня рождения найти возраст на дату рейса
1904+ int years = 0;
1905+ if (birthday!=null) {
1906+ CalendarDate cd = new CalendarDate(null, birthday);
1907+ years = cd.monthsUntil(datefrom)/12;
1908+ }
1909+
1910+ Collection<ServicePrice> res = null;
1911+
1912+ if (!cache.containsKey(datefrom)) {
1913+ ArrayList conditions = new ArrayList();
1914+ conditions.add(ExpressionFactory.greaterOrEqualExp(ServicePrice.DATE_TO_PROPERTY, datefrom.toDate(null)));
1915+ conditions.add(ExpressionFactory.lessOrEqualExp(ServicePrice.DATE_FROM_PROPERTY, datefrom.toDate(null)));
1916+ if (service!=null)
1917+ conditions.add(ExpressionFactory.matchExp(ServicePrice.LIST_SERVICE_PROPERTY, service));
1918+ if (vendor!=null)
1919+ conditions.add(ExpressionFactory.matchExp(ServicePrice.VENDOR_PROPERTY, vendor));
1920+ if (country!=null)
1921+ conditions.add(ExpressionFactory.matchExp(ServicePrice.LIST_COUNTRY_PROPERTY, country));
1922+ res = db_interface.queryConditions(ServicePrice.class, conditions); //подняли все цены
1923+ cache.put(datefrom, res);
1924+ }
1925+ else res = cache.get(datefrom);
1926+
1927+ //смотрим какие периоды получили
1928+ HashMap<Integer, PriceInterface> priceFound = new HashMap();
1929+
1930+ // из результата поиска выкинуть те, которые не нашлись
1931+ for (PriceInterface sprice : res) {
1932+ //интересны только те ценовые периоды, которые есть в ценах. либо все, если это первый проход
1933+ if (!isFirst)
1934+ if (!result.containsKey(sprice.getListAge()==null ? null : sprice.getListAge().getId())) continue;
1935+
1936+ // из найденных выкинуть те, которые не подходят под условия возраста/категории
1937+ if (ageCategory!=null) {
1938+ if (sprice.getListAge()!=null && !sprice.getListAge().isInCategory(ageCategory)) continue;
1939+ }
1940+ if (birthday!=null) {
1941+ if (sprice.getListAge()!=null && !sprice.getListAge().isInPeriod(years)) continue;
1942+ }
1943+
1944+ priceFound.put(sprice.getListAge()==null ? null : sprice.getListAge().getId(), sprice);
1945+ }
1946+
1947+ //выкидываем цену, для которой не найден из результата функции
1948+ for (Iterator<Integer> it = result.keySet().iterator(); it.hasNext();) {
1949+ Integer curr = it.next();
1950+ if (!priceFound.containsKey(curr)) it.remove(); //удаляем пропавшую цену
1951+ }
1952+
1953+ if (!isFirst && result.isEmpty()) { //для скорости можно уде тут возвращать
1954+ return;
1955+ }
1956+
1957+ //если цена считается за период и она уже посчитана, то этот ценовой период выкидываем
1958+ for (Price price : result.values()) {
1959+ if (price.getPeriod()==PriceInterface.CONST_PERIOD_TRIP) priceFound.remove(price.getListAge().getId());
1960+ }
1961+
1962+ //на текущий момент найденные ценовые периоды соответствуют ценам результата для непервого прохода
1963+ //поэтому считать надо все, для первого прохода добавлять
1964+ for (PriceInterface sprice : priceFound.values()) {
1965+ CalendarDate dateend = dateto;
1966+ boolean isFinal = true; //нужно ли еще искать периоды для этой цены
1967+ //пересчитать количество дней, которые действует ценовой период
1968+ if (sprice.getDateTo().before(dateend.toDate(null))) {
1969+ dateend = new CalendarDate(null, sprice.getDateTo());
1970+ isFinal = false; //нужны еще проходы
1971+ }
1972+ int days = datefrom.daysUntil(dateend)+1;
1973+ if (sprice.getPeriod()==PriceInterface.CONST_PERIOD_NIGHT && isFinal) days--; //ночей на одну меньше
1974+ if (sprice.getPeriod()==PriceInterface.CONST_PERIOD_TRIP) days=1; //одна штука
1975+ //в случае если нужно искать еще, то посчитать ночь между этим периодом и следующим
1976+ addPrice(result, sprice, days, currency, isFirst);
1977+
1978+ CalendarDate cdnext = dateend.addDays(1); //следующая дата
1979+ if (!cdnext.isAfter(dateto)) { //добираем
1980+ findPrice(params, result, cdnext, false);
1981+ }
1982+ }
1983+ return; //всё обсчитали
1984+ }
1985+
1986+}
1987+//282
1988\ No newline at end of file
1989
1990=== added file 'src/cbadmin/business/PriceVendorFlight.java'
1991--- src/cbadmin/business/PriceVendorFlight.java 1970-01-01 00:00:00 +0000
1992+++ src/cbadmin/business/PriceVendorFlight.java 2011-04-25 18:28:30 +0000
1993@@ -0,0 +1,237 @@
1994+package cbadmin.business;
1995+
1996+import cbadmin.entity2.Block;
1997+import cbadmin.entity2.Flight;
1998+import cbadmin.entity2.ListClass;
1999+import cbadmin.entity2.ListCurrency;
2000+import cbadmin.entity2.Offer;
2001+import cbadmin.entity2.db_interface;
2002+import cbadmin.util.CalendarDate;
2003+import cbadmin.util.CurrencyMgr;
2004+import cbadmin.util.utils;
2005+import java.util.ArrayList;
2006+import java.util.Collection;
2007+import java.util.Date;
2008+import java.util.HashMap;
2009+import java.util.List;
2010+import org.apache.cayenne.exp.ExpressionFactory;
2011+
2012+
2013+/**
2014+ * поиск по предложениям на перелет
2015+ * @author mcseem
2016+ */
2017+public class PriceVendorFlight implements PriceVendorInterface {
2018+
2019+ /**
2020+ * поиск подходящей цены по параметрам
2021+ * @param params: параметры
2022+ * <ol>
2023+ * <li>CONST_PARAM_FLIGHTFROM : Flight</li>
2024+ * <li>CONST_PARAM_CLASSFROM : ListClass</li>
2025+ * <li>CONST_PARAM_FLIGHTTO : Flight</li>
2026+ * <li>CONST_PARAM_CLASSTO : ListClass</li>
2027+ * <li>CONST_PARAM_BIRTHDAY : Date</li>
2028+ * <li>CONST_PARAM_CURRENCY : ListCurrency</li>
2029+ * </ol>
2030+ * @return float[4] {buy, margin fix, margin %, sell}
2031+ */
2032+ public Collection<Price> findPrice(HashMap<String, Object> params) {
2033+ List<Price> result = new ArrayList();
2034+ Flight flightfrom = (Flight) params.get(CONST_PARAM_FLIGHTFROM);
2035+ Flight flightto = (Flight) params.get(CONST_PARAM_FLIGHTTO);
2036+ ListClass classfrom = (ListClass) params.get(CONST_PARAM_CLASSFROM);
2037+ ListClass classto = (ListClass) params.get(CONST_PARAM_CLASSTO);
2038+ Date birthday = (Date) params.get(CONST_PARAM_BIRTHDAY);
2039+ ListCurrency currency = (ListCurrency) params.get(CONST_PARAM_CURRENCY);
2040+
2041+ if (birthday==null) {
2042+ utils.getLogger().debug(this.getClass().getName()+": birthday is null. returning");
2043+ return result;
2044+ }
2045+
2046+ Price price = getPrice(birthday, flightfrom, flightto, classfrom, classto, currency);
2047+ if (price!=null) result.add(price);
2048+// else utils.getLogger().debug("PriceVendorFlight.findPrice: price found=" + price.getSellPrice().doubleValue());
2049+ return result;
2050+ }
2051+
2052+
2053+ private Price getPrice(Date birthday, Flight flightfrom, Flight flightto, ListClass classfrom, ListClass classto,
2054+ ListCurrency currency) {
2055+ boolean pricefound = false; //хоть какая-то цена найдена
2056+
2057+ //получить цены ================================================
2058+ //взять возраст
2059+ int age = 0;
2060+ CalendarDate cd = new CalendarDate(null, birthday);
2061+
2062+ CalendarDate cdNow = new CalendarDate(null, new Date());
2063+ //ориентиреумся на дату вылета/возврата/сегодня
2064+ if (flightfrom!=null || flightto==null)
2065+ cdNow = new CalendarDate(null, flightfrom != null ? flightfrom.getDateFrom() : flightto.getDateFrom());
2066+
2067+ CalendarDate cd2 = cdNow.addMonths(-2 * 12);
2068+ CalendarDate cd12 = cdNow.addMonths(-12 * 12);
2069+ if (cd.isBefore(cd12)) {
2070+ age = AGE_ADT;
2071+ } else if (cd.isBefore(cd2)) {
2072+ age = AGE_CHD;
2073+ } else {
2074+ age = AGE_INF;
2075+ }
2076+ utils.getLogger().debug("PriceVendorFlight: age=" + age);
2077+ Price result = new Price();
2078+
2079+ float price1 = 0;
2080+ float price2 = 0;
2081+ float price3 = 0;
2082+ float priceFinal = 0;
2083+ List conditions = null;
2084+ List<Offer> offers = null;
2085+ if (flightfrom != null) {
2086+ //для начала вылет
2087+ conditions = new ArrayList();
2088+ conditions.add(ExpressionFactory.matchExp(Offer.DELETEDATE_PROPERTY, null));
2089+ conditions.add(ExpressionFactory.matchExp(Offer.FLIGHT_BY_ID_FLIGHTTHERE_PROPERTY, flightfrom));
2090+ conditions.add(ExpressionFactory.matchExp(Offer.FLIGHT_BY_ID_FLIGHTBACK_PROPERTY, null));
2091+ //класс прописываем
2092+ if (classfrom.getParentClass() == null) {
2093+ conditions.add(ExpressionFactory.matchExp(Offer.LIST_CLASS_PROPERTY, classfrom));
2094+ } else {
2095+ conditions.add(ExpressionFactory.matchExp(Offer.LIST_CLASS_PROPERTY, Block.load(Block.CLASS_DEFAULT_ID)));
2096+ }
2097+ offers = db_interface.queryConditions(Offer.class, conditions);
2098+ if (!offers.isEmpty()) {
2099+ //есть вылет
2100+ try {
2101+ if (age == AGE_INF)
2102+ price1 = (float) CurrencyMgr.convert(utils.isFNull((offers.get(0)).getPrice13()),
2103+ offers.get(0).getListCurrency(), currency, new Date());
2104+ else if (age == AGE_CHD)
2105+ price1 = (float) CurrencyMgr.convert(utils.isFNull((offers.get(0)).getPrice12()),
2106+ offers.get(0).getListCurrency(), currency, new Date());
2107+ else
2108+ price1 = (float) CurrencyMgr.convert(utils.isFNull((offers.get(0)).getPrice11()),
2109+ offers.get(0).getListCurrency(), currency, new Date());
2110+
2111+ pricefound = true;
2112+ } catch (Exception ex) {
2113+ utils.getLogger().error("Cannot convert currency", ex);
2114+ }
2115+ }
2116+ }
2117+ if (flightto != null) {
2118+ //теперь возврат
2119+ conditions = new ArrayList();
2120+ conditions.add(ExpressionFactory.matchExp(Offer.DELETEDATE_PROPERTY, null));
2121+ conditions.add(ExpressionFactory.matchExp(Offer.FLIGHT_BY_ID_FLIGHTTHERE_PROPERTY, flightto));
2122+ conditions.add(ExpressionFactory.matchExp(Offer.FLIGHT_BY_ID_FLIGHTBACK_PROPERTY, null));
2123+ //класс прописываем
2124+ if (classto.getParentClass() == null) {
2125+ conditions.add(ExpressionFactory.matchExp(Offer.LIST_CLASS_PROPERTY, classto));
2126+ } else {
2127+ conditions.add(ExpressionFactory.matchExp(Offer.LIST_CLASS_PROPERTY, Block.load(Block.CLASS_DEFAULT_ID)));
2128+ }
2129+ offers = db_interface.queryConditions(Offer.class, conditions);
2130+ if (!offers.isEmpty()) {
2131+ //есть возврат
2132+ try {
2133+ if (age == AGE_INF)
2134+ price2 = (float) CurrencyMgr.convert(utils.isFNull((offers.get(0)).getPrice13()),
2135+ offers.get(0).getListCurrency(), currency, new Date());
2136+ else if (age == AGE_CHD)
2137+ price2 = (float) CurrencyMgr.convert(utils.isFNull((offers.get(0)).getPrice12()),
2138+ offers.get(0).getListCurrency(), currency, new Date());
2139+ else
2140+ price2 = (float) CurrencyMgr.convert(utils.isFNull((offers.get(0)).getPrice11()),
2141+ offers.get(0).getListCurrency(), currency, new Date());
2142+
2143+ pricefound = true;
2144+ } catch (Exception ex) {
2145+ utils.getLogger().error("Cannot convert currency", ex);
2146+ }
2147+
2148+ }
2149+ }
2150+ if (flightfrom != null && flightto != null) {
2151+ //теперь всё вместе
2152+ conditions = new ArrayList();
2153+ conditions.add(ExpressionFactory.matchExp(Offer.DELETEDATE_PROPERTY, null));
2154+ conditions.add(ExpressionFactory.matchExp(Offer.FLIGHT_BY_ID_FLIGHTTHERE_PROPERTY, flightfrom));
2155+ conditions.add(ExpressionFactory.matchExp(Offer.FLIGHT_BY_ID_FLIGHTBACK_PROPERTY, flightto));
2156+ //класс прописываем
2157+ if (classfrom.getParentClass() == null) {
2158+ conditions.add(ExpressionFactory.matchExp(Offer.LIST_CLASS_PROPERTY, classfrom));
2159+ } else {
2160+ conditions.add(ExpressionFactory.matchExp(Offer.LIST_CLASS_PROPERTY, Block.load(Block.CLASS_DEFAULT_ID)));
2161+ }
2162+ if (classto.getParentClass() == null) {
2163+ conditions.add(ExpressionFactory.matchExp(Offer.LIST_CLASS_PROPERTY, classto));
2164+ } else {
2165+ conditions.add(ExpressionFactory.matchExp(Offer.LIST_CLASS_PROPERTY, Block.load(Block.CLASS_DEFAULT_ID)));
2166+ }
2167+ offers = db_interface.queryConditions(Offer.class, conditions);
2168+ if (!offers.isEmpty()) {
2169+ //есть возврат
2170+ try {
2171+ if (age == AGE_INF)
2172+ price3 = (float) CurrencyMgr.convert(utils.isFNull((offers.get(0)).getPrice13()),
2173+ offers.get(0).getListCurrency(), currency, new Date());
2174+ else if (age == AGE_CHD)
2175+ price3 = (float) CurrencyMgr.convert(utils.isFNull((offers.get(0)).getPrice12()),
2176+ offers.get(0).getListCurrency(), currency, new Date());
2177+ else
2178+ price3 = (float) CurrencyMgr.convert(utils.isFNull((offers.get(0)).getPrice11()),
2179+ offers.get(0).getListCurrency(), currency, new Date());
2180+
2181+ pricefound = true;
2182+ } catch (Exception ex) {
2183+ utils.getLogger().error("Cannot convert currency", ex);
2184+ }
2185+
2186+ }
2187+ }
2188+ if (flightfrom != null && flightto != null) {
2189+ //если классы отличаются
2190+ if (!classfrom.getId().equals(classto.getId())) {
2191+ priceFinal = price1 + price2;
2192+ if (flightfrom != null && price1 == 0) {
2193+ utils.getLogger().debug("PriceVendorFlight: no price FROM");
2194+ }
2195+ if (flightto != null && price2 == 0) {
2196+ utils.getLogger().debug("PriceVendorFlight: no price BACK");
2197+ }
2198+
2199+ } else {
2200+ priceFinal = price3;
2201+ }
2202+ } else {
2203+ priceFinal = price1 + price2;
2204+ if (flightfrom != null && price1 == 0) {
2205+ utils.getLogger().debug("PriceVendorFlight: no price FROM");
2206+ }
2207+ if (flightto != null && price2 == 0) {
2208+ utils.getLogger().debug("PriceVendorFlight: no price BACK");
2209+ }
2210+ }
2211+ result.setSellPrice(new Money(priceFinal));
2212+ if (pricefound) {
2213+ utils.getLogger().debug("PriceVendorFlight: price found="+priceFinal);
2214+ return result;
2215+ } else {
2216+ utils.getLogger().debug("PriceVendorFlight: no price found");
2217+ return null;
2218+ }
2219+ }
2220+
2221+ public void setCacheMode(boolean cacheOn) {
2222+ //ничего не будем делать кеширование здесь не нужно
2223+// throw new UnsupportedOperationException("Not supported yet.");
2224+ }
2225+
2226+ private int AGE_INF = 1;
2227+ private int AGE_CHD = 2;
2228+ private int AGE_ADT = 3;
2229+
2230+}
2231
2232=== added file 'src/cbadmin/business/PriceVendorInterface.java'
2233--- src/cbadmin/business/PriceVendorInterface.java 1970-01-01 00:00:00 +0000
2234+++ src/cbadmin/business/PriceVendorInterface.java 2011-04-25 18:28:30 +0000
2235@@ -0,0 +1,54 @@
2236+package cbadmin.business;
2237+
2238+import java.util.Collection;
2239+import java.util.HashMap;
2240+
2241+/**
2242+ * интерфейс для поиска цены. для поиска каждой услуги параметры свои
2243+ * @author mcseem
2244+ */
2245+public interface PriceVendorInterface {
2246+// public float[] findPrice(Object... params);
2247+ public Collection<Price> findPrice(HashMap<String, Object> params);
2248+ public void setCacheMode(boolean cacheOn);
2249+
2250+ //для унификации введем ряд параметров. соответствующих текущим объектам системы и поиска
2251+ public static String CONST_PARAM_DATEFROM = "datefrom";
2252+ public static String CONST_PARAM_DATETO = "dateto";
2253+ public static String CONST_PARAM_FLIGHTFROM = "flightfrom";
2254+ public static String CONST_PARAM_FLIGHTTO = "flightto";
2255+ public static String CONST_PARAM_CLASSFROM = "classfrom";
2256+ public static String CONST_PARAM_CLASSTO = "classto";
2257+ public static String CONST_PARAM_COUNTRY = "country";
2258+ public static String CONST_PARAM_CITY = "city";
2259+ public static String CONST_PARAM_CITYFROM = "cityfrom"; //TRF
2260+ public static String CONST_PARAM_CITYTO = "cityto"; //TRF
2261+
2262+ public static String CONST_PARAM_BIRTHDAY = "birthday";
2263+ public static String CONST_PARAM_LENGTH = "length";
2264+ public static String CONST_PARAM_VENDOR = "vendor";
2265+ public static String CONST_PARAM_EXTRABED = "extrabed";
2266+ public static String CONST_PARAM_POSITION = "position"; //позиция в номере
2267+ public static String CONST_PARAM_CURRENCY = "currency";
2268+ public static String CONST_PARAM_AGECATEGORY = "age"; //категория возраста
2269+ public static String CONST_PARAM_HOTEL = "hotel";
2270+ public static String CONST_PARAM_ROOMTYPE = "roomtype";
2271+ public static String CONST_PARAM_MEALTYPE = "mealtype";
2272+ public static String CONST_PARAM_CATEGORY = "category";
2273+ public static String CONST_PARAM_LISTSERVICE = "listservice"; //текущий тип услуги
2274+ public static String CONST_PARAM_LISTAGE = "ageid"; //текущий возраст. нужен в редких случаях для поиска конкретной цены
2275+ //идет в споффер
2276+
2277+ public static Integer CONST_AGECATEGORY_INFANT = 0; //удалить, если не используется
2278+ public static Integer CONST_AGECATEGORY_CHILD = 1;
2279+ public static Integer CONST_AGECATEGORY_ADULT = 2;
2280+ public static Integer CONST_AGECATEGORY_ADTCHD = 3;
2281+
2282+
2283+ public static String CONST_PARAM_PRICEID = "prcid"; //ID цены для восстановления деталей. идет в споффер
2284+ public static String CONST_PARAM_NODEEPLOOKUP = "nolookup"; //если не надо искать цены по усложненным алгоритмам
2285+ //нужно для предотвращения зацикливания, например в проживаниях и доплатах на питание
2286+
2287+
2288+
2289+}
2290
2291=== added file 'src/cbadmin/business/PriceVendorProto.java'
2292--- src/cbadmin/business/PriceVendorProto.java 1970-01-01 00:00:00 +0000
2293+++ src/cbadmin/business/PriceVendorProto.java 2011-04-25 18:28:30 +0000
2294@@ -0,0 +1,92 @@
2295+package cbadmin.business;
2296+
2297+import cbadmin.entity2.ListCurrency;
2298+import cbadmin.util.CalendarDate;
2299+import cbadmin.util.CurrencyMgr;
2300+import cbadmin.util.utils;
2301+import java.util.Collection;
2302+import java.util.Date;
2303+import java.util.HashMap;
2304+
2305+/**
2306+ * базовый класс для вендоров цен. общие методы
2307+ * @author mcseem
2308+ */
2309+abstract public class PriceVendorProto {
2310+
2311+ /**
2312+ * добавить цену. Проценты не высчитываются, они должны в конце определиться
2313+ * @param result - хеш с ценами
2314+ * @param sprice - найденный ценовой период
2315+ * @param count - количество дней или ночей
2316+ * @param currency - валюта, к кторой привети, либо null если не приводить
2317+ * @param create - нужно ли создавать запись, или пользоваться только существующими
2318+ */
2319+ protected void addPrice(HashMap<Integer, Price> result, PriceInterface sprice, int count, ListCurrency currency, boolean create) {
2320+// utils.getLogger().debug("addPrice: count="+count+" buyprice="+sprice.getBuyprice());
2321+ Price price = result.get(sprice.getListAge()==null ? null : sprice.getListAge().getId());
2322+ if (price==null && !create) return; //не надо создавать
2323+ if (price==null) {
2324+// utils.getLogger().debug("create new price");
2325+ price = new Price();
2326+ price.setPeriod(sprice.getPeriod());
2327+ price.setListAge(sprice.getListAge());
2328+ price.setId(sprice.getId());
2329+ result.put(sprice.getListAge()==null ? null : sprice.getListAge().getId(), price);
2330+ }
2331+ try {
2332+ price.getBuyPrice().addSet(count*CurrencyMgr.convert(sprice.getBuyprice(), sprice.getListCurrency(), currency, new Date()));
2333+ price.getMarginFix().addSet(count*CurrencyMgr.convert(sprice.getMarginfix(), sprice.getListCurrency(), currency, new Date()));
2334+ price.getSellPrice().addSet(count*CurrencyMgr.convert(sprice.getSellprice(), sprice.getListCurrency(), currency, new Date()));
2335+ } catch (Exception ex) {
2336+ utils.getLogger().debug("Cannot convert currency", ex);
2337+ }
2338+// utils.getLogger().debug("addPrice: buyprice="+price.getBuyPrice().toString());
2339+ }
2340+
2341+ protected void addPrice(HashMap<Integer, Price> result, Price sprice, boolean create) {
2342+ if (sprice==null) {
2343+// utils.getLogger().debug("addPrice sprice=null");
2344+ return;
2345+ }
2346+// utils.getLogger().debug("addPrice: count="+count+" buyprice="+sprice.getBuyprice());
2347+ Price price = result.get(sprice.getListAge()==null ? null : sprice.getListAge().getId());
2348+ if (price==null && !create) {
2349+// utils.getLogger().debug("addPrice price=null, create=false");
2350+ return;
2351+ } //не надо создавать
2352+ if (price==null) {
2353+// utils.getLogger().debug("create new price");
2354+ price = new Price();
2355+ price.setPeriod(sprice.getPeriod());
2356+ price.setListAge(sprice.getListAge());
2357+ price.setId(sprice.getId());
2358+// result.put(sprice.getListAge()==null ? null : sprice.getListAge().getId(), price);
2359+ }
2360+ price.getBuyPrice().addSet(sprice.getBuyPrice());
2361+ price.getMarginFix().addSet(sprice.getMarginFix());
2362+ price.getSellPrice().addSet(sprice.getSellPrice());
2363+ result.put(sprice.getListAge()==null ? null : sprice.getListAge().getId(), price);
2364+// utils.getLogger().debug("addPrice done result contains "+result.get(sprice.getListAge()==null ? null : sprice.getListAge().getId()).getSellPrice().doubleValue());
2365+// utils.getLogger().debug("addPrice: buyprice="+price.getBuyPrice().toString());
2366+ }
2367+
2368+
2369+ public void setCacheMode(boolean cacheOn) {
2370+ isCacheOn = cacheOn;
2371+ if (isCacheOn) { //входим в режим кеширования
2372+ //подтянуть все цены,
2373+ }
2374+ else {
2375+ utils.getContext().getQueryCache().removeGroup(CONST_CACHE_GROUP);
2376+ cache.clear();
2377+ }
2378+ }
2379+
2380+ private final static String CONST_CACHE_GROUP="price";
2381+
2382+ protected boolean isCacheOn = false;
2383+ protected HashMap<CalendarDate, Collection> cache = new HashMap();
2384+
2385+
2386+}
2387
2388=== added file 'src/cbadmin/business/ReporterInterface.java'
2389--- src/cbadmin/business/ReporterInterface.java 1970-01-01 00:00:00 +0000
2390+++ src/cbadmin/business/ReporterInterface.java 2011-04-25 18:28:30 +0000
2391@@ -0,0 +1,49 @@
2392+package cbadmin.business;
2393+
2394+import cbadmin.entity2.Reservation;
2395+import java.util.Collection;
2396+
2397+/**
2398+ * Интерфейс для тех, кто строит собственную отчетность
2399+ * В первую очередь для счетов и подтверждений
2400+ * @author mcseem
2401+ */
2402+public interface ReporterInterface {
2403+ /**
2404+ * получить список функциональности, поддерживаемой имплементатором
2405+ * @return список строковых констант
2406+ */
2407+ Collection<Functional> getFunctionality();
2408+ /**
2409+ * создать счет
2410+ * @param res - заявка
2411+ * @return путь к файлу с созданным счетом
2412+ * @throws Exception в случае проблем, если результат не получился
2413+ */
2414+ String createInvoice(Reservation res) throws Exception;
2415+ /**
2416+ * создать счет для отправки по email
2417+ * @param res - заявка
2418+ * @return - путь к файлу шаблона
2419+ * @throws Exception в случае проблем, если результат не получился
2420+ */
2421+ String createInvoiceEmail(Reservation res) throws Exception;
2422+ /**
2423+ * создать подтверждение бронирования (лист бронирования)
2424+ * @param res - заявка
2425+ * @return - путь к файлу шаблона
2426+ * @throws Exception в случае проблем, если результат не получился
2427+ */
2428+ String createAccept(Reservation res) throws Exception;
2429+ /**
2430+ * создать подтверждение бронирования (лист бронирования) для отправки по email
2431+ * @param res - заявка
2432+ * @return - путь к файлу шаблона
2433+ * @throws Exception в случае проблем, если результат не получился
2434+ */
2435+ String createAcceptEmail(Reservation res) throws Exception;
2436+
2437+ public enum Functional {
2438+ INVOICE, INVOICE_EMAIL, ACCEPT, ACCEPT_EMAIL
2439+ }
2440+}
2441
2442=== added file 'src/cbadmin/business/xlsbuilder.java'
2443--- src/cbadmin/business/xlsbuilder.java 1970-01-01 00:00:00 +0000
2444+++ src/cbadmin/business/xlsbuilder.java 2011-04-25 18:28:30 +0000
2445@@ -0,0 +1,572 @@
2446+package cbadmin.business;
2447+
2448+import cbadmin.entity2.ListCity;
2449+import cbadmin.entity2.ListCurrency;
2450+import cbadmin.entity2.Passenger;
2451+import cbadmin.entity2.Payment;
2452+import java.util.Collection;
2453+import java.util.List;
2454+import cbadmin.entity2.Reservation;
2455+import cbadmin.entity2.Service;
2456+
2457+import cbadmin.entity2.db_interface;
2458+import cbadmin.util.PropertiesMgr;
2459+import cbadmin.util.utils;
2460+import java.io.File;
2461+import java.io.FileOutputStream;
2462+import java.io.IOException;
2463+import java.util.ArrayList;
2464+import java.util.Date;
2465+import java.util.HashMap;
2466+import java.util.HashSet;
2467+import java.util.Map;
2468+import javax.swing.JOptionPane;
2469+import net.sf.jasperreports.engine.JasperFillManager;
2470+import net.sf.jasperreports.engine.JasperPrint;
2471+import net.sf.jasperreports.engine.JasperReport;
2472+import net.sf.jasperreports.engine.data.JRBeanCollectionDataSource;
2473+import net.sf.jasperreports.engine.export.JRXlsExporter;
2474+import net.sf.jasperreports.engine.export.JRXlsExporterParameter;
2475+import net.sf.jasperreports.engine.util.JRLoader;
2476+import net.sf.jxls.exception.ParsePropertyException;
2477+import net.sf.jxls.transformer.XLSTransformer;
2478+import org.apache.cayenne.exp.Expression;
2479+import org.apache.cayenne.exp.ExpressionFactory;
2480+import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
2481+import plugins.core.impl.CorePluginImpl;
2482+
2483+/**
2484+ *
2485+ * @author mcseem
2486+ */
2487+public class xlsbuilder implements ReporterInterface{
2488+
2489+
2490+//-------------------------------------------------
2491+//ReporterInterface
2492+ public Collection<Functional> getFunctionality() {
2493+ HashSet<ReporterInterface.Functional> funcs = new HashSet();
2494+ funcs.add(Functional.ACCEPT);
2495+ funcs.add(Functional.ACCEPT_EMAIL);
2496+ funcs.add(Functional.INVOICE);
2497+ funcs.add(Functional.INVOICE_EMAIL);
2498+ return funcs;
2499+ }
2500+
2501+ public String createInvoice(Reservation res) throws Exception {
2502+ return createInvoice(res, null);
2503+ }
2504+
2505+ public String createInvoiceEmail(Reservation res) throws Exception {
2506+ String source = PropertiesMgr.getInvoiceReport(); //файл для отчета
2507+ return createInvoice(res, source);
2508+ }
2509+
2510+ public String createAcceptEmail(Reservation res) throws Exception {
2511+ return createAccept(res);
2512+ }
2513+//-------------------------------------------------
2514+
2515+
2516+ /**
2517+ * Создание подтверждение бронирования
2518+ * @param reservation
2519+ * @return путь к файлу
2520+ * @throws Exception
2521+ */
2522+ public String createAccept( Reservation reservation ) throws Exception {
2523+ utils.getLogger().debug("Start createXLSaccept");
2524+ String baseDirectory = PropertiesMgr.getReportFolder();
2525+ String outDirectory = PropertiesMgr.getTempFolder();
2526+ String source = PropertiesMgr.getAcceptReport(); //файл для отчета
2527+ String xlsSource = baseDirectory + "/" + source;
2528+ String xlsDest = outDirectory + "/" + reservation.getId().toString()+"_" + source;
2529+
2530+ Map beans = new HashMap();
2531+
2532+ List vals=new java.util.ArrayList();
2533+
2534+ //скидку выставим
2535+ if (reservation.getDiscount()==null) {reservation.setDiscount(new Integer(0));}
2536+
2537+ //получим бронь
2538+ beans.put("reservation", reservation);
2539+
2540+ //получить пассажиров
2541+ //перекачать в список
2542+ for (Passenger pass : reservation.getPassengers()) {
2543+ if (pass.getDeletedate()!=null) {continue;} //без удаленных
2544+ pass.processCustomFields();
2545+ vals.add(pass);
2546+ }
2547+
2548+ beans.put("passenger", vals);
2549+
2550+ //получить все комбинации рейсов из туристов
2551+ //список туристов с уникальными рейсами
2552+ List uniqueFPass=new java.util.ArrayList();
2553+ for (int i = 0; i < vals.size(); i++) {
2554+ Passenger pass = (Passenger) vals.get(i);
2555+ boolean dup = false;
2556+ for (int j = 0; j < uniqueFPass.size(); j++) { //для каждого юника
2557+ Passenger passUnique = (Passenger) uniqueFPass.get(j);
2558+
2559+ if (pass.getFlightByIdFlightthere() == passUnique.getFlightByIdFlightthere()
2560+ && pass.getFlightByIdFlightback() == passUnique.getFlightByIdFlightback()
2561+ && pass.getCalculatedClassthere() == passUnique.getCalculatedClassthere()
2562+ && pass.getCalculatedClassback() == passUnique.getCalculatedClassback()
2563+ ) {
2564+ dup = true; //дубликат найден
2565+ continue;
2566+ }
2567+ }
2568+ if (!dup) { //нет дубликата
2569+ uniqueFPass.add(pass);
2570+ }
2571+ }
2572+ beans.put("passflight", uniqueFPass);
2573+ utils.getLogger().info("CITY: "+reservation.getForeignCity());
2574+ beans.put("citythereto", reservation.getForeignCity());
2575+
2576+ //получить все остальные услуги. уникалить по названию и датам
2577+ List<Service> services = new ArrayList();
2578+
2579+ for(Service serv : reservation.getServices()) {
2580+ Integer servid = serv.getListService().getId();
2581+ //берем услуги, не связанные с пассажирами
2582+ if (serv.getPassenger()==null &&
2583+ !servid.equals(PropertiesMgr.getServiceAvia())) {
2584+ //нашли остальную услугу
2585+
2586+ services.add(serv);
2587+ }
2588+ }
2589+ beans.put("otherServices", services);
2590+
2591+ //получить валюту брони
2592+ ListCurrency cur=reservation.getListCurrency();
2593+ beans.put("currency", cur);
2594+
2595+ XLSTransformer transformer = new XLSTransformer();
2596+ transformer.transformXLS(xlsSource, beans, xlsDest);
2597+// recalcXLS(xlsDest); //обновление формул
2598+
2599+ return xlsDest;
2600+ }
2601+
2602+ /**
2603+ * Создание счета
2604+ * использует invoiceReport, reportFolder, tempFolder, xlspreview
2605+ * @param id_reservation ID брони
2606+ * @param templateName файл с шаблоном (опционально)
2607+ * @return
2608+ * @throws java.lang.Exception
2609+ */
2610+ private String createInvoice(Reservation reservation, String templateName) throws Exception {
2611+ utils.getLogger().debug("Start createXLSinvoice");
2612+
2613+ String baseDirectory = PropertiesMgr.getReportFolder();
2614+ String outDirectory = PropertiesMgr.getTempFolder();
2615+ String source = PropertiesMgr.getInvoiceNostampReport(); //файл для отчета
2616+ if (templateName!=null) source = templateName;
2617+
2618+
2619+ String xlsSource = baseDirectory + "/" + source;
2620+ String xlsDest = outDirectory + "/" + reservation.getId().toString()+"_" + source;
2621+
2622+ Map beans = new HashMap();
2623+ List vals = new java.util.ArrayList();
2624+ ListCity cityto = null;
2625+
2626+ Integer itemcount = new Integer(0);
2627+ //получить пассажиров
2628+ //перекачать в список
2629+ for (Passenger pass : reservation.getPassengers()) {
2630+ if (pass.getDeletedate() != null) { continue; } //без удаленных
2631+// if (pass.getFlightByIdFlightthere() == null) { continue; } //без рейсов
2632+ vals.add(pass);
2633+ itemcount++;
2634+ }
2635+
2636+ Integer totalsum = new Integer(new Float(reservation.getSummaReserved()).intValue());
2637+ beans.put("totalsum", totalsum);
2638+ beans.put("itemcount", itemcount);
2639+ beans.put("reservation", reservation);
2640+
2641+ //получить все комбинации рейсов из туристов
2642+ //список туристов с уникальными рейсами
2643+ List uniqueFPass = new java.util.ArrayList();
2644+ for (int i = 0; i < vals.size(); i++) {
2645+ Passenger pass = (Passenger) vals.get(i);
2646+ pass.processCustomFields();
2647+ boolean dup = false;
2648+ for (int j = 0; j < uniqueFPass.size(); j++) { //для каждого юника
2649+ Passenger passUnique = (Passenger) uniqueFPass.get(j);
2650+// passUnique.processCustomFields();
2651+
2652+ if (pass.getFlightByIdFlightthere() == passUnique.getFlightByIdFlightthere() &&
2653+ pass.getFlightByIdFlightback() == passUnique.getFlightByIdFlightback() &&
2654+ pass.getPriceFlight()==passUnique.getPriceFlight() &&
2655+ pass.getTicketName().equals(passUnique.getTicketName())
2656+ ) {
2657+ passUnique.setCount(passUnique.getCount()+1);
2658+ dup = true; //дубликат найден
2659+ }
2660+ }
2661+ if (!dup) { //нет дубликата
2662+ pass.setCount(1);
2663+ uniqueFPass.add(pass); //добавляем пассажира
2664+ }
2665+ }
2666+ beans.put("passflight", uniqueFPass);
2667+ beans.put("citythereto", reservation.getForeignCity());
2668+
2669+ //получить валюту брони
2670+ ListCurrency cur = reservation.getListCurrency();
2671+ beans.put("currency", cur);
2672+
2673+ XLSTransformer transformer = new XLSTransformer();
2674+ transformer.transformXLS(xlsSource, beans, xlsDest);
2675+// recalcXLS(xlsDest); //обновление формул
2676+
2677+ return xlsDest;
2678+ }
2679+
2680+
2681+ /**
2682+ * Создание приходного ордера
2683+ * @param payment - оплата
2684+ * @return путь к файлу
2685+ * @throws Exception
2686+ */
2687+ public static String createXLSkassaIn( Payment payment ) throws Exception {
2688+ utils.getLogger().debug("Start createXLSkassaIn");
2689+
2690+ String source = PropertiesMgr.getProperty(PROP_KASSAIN_REPORT, DEFAULT_KASSAIN_REPORT); //файл для отчета
2691+ if (source.equals(DEFAULT_KASSAIN_REPORT)) {
2692+ if (!utils.extractResource("plugins/core/"+source, PropertiesMgr.getReportFolder()+"/"+source)) {
2693+ utils.getLogger().error(CorePluginImpl.PLUGIN_NAME+": cannot extract resource plugins/core/"+source);
2694+ throw new Exception("Не найден файл с шаблоном");
2695+ }
2696+ }
2697+
2698+ String baseDirectory = PropertiesMgr.getReportFolder();
2699+ String outDirectory = PropertiesMgr.getTempFolder();
2700+ String xlsSource = baseDirectory + "/" + source;
2701+ String xlsDest = outDirectory + "/" + payment.getId().toString()+"_" + source;
2702+
2703+ Map beans = new HashMap();
2704+ beans.put("reservation", payment.getReservation());
2705+ beans.put("payment", payment);
2706+
2707+ XLSTransformer transformer = new XLSTransformer();
2708+ transformer.transformXLS(xlsSource, beans, xlsDest);
2709+// recalcXLS(xlsDest); //обновление формул
2710+
2711+ return xlsDest;
2712+ }
2713+
2714+ /**
2715+ * Создание расходного ордера
2716+ * @param payment - оплата
2717+ * @return путь к файлу
2718+ * @throws Exception
2719+ */
2720+ public static String createXLSkassaOut( Payment payment ) throws Exception {
2721+ utils.getLogger().debug("Start createXLSkassaOut");
2722+
2723+ String source = PropertiesMgr.getProperty(PROP_KASSAOUT_REPORT, DEFAULT_KASSAOUT_REPORT); //файл для отчета
2724+ if (source.equals(DEFAULT_KASSAOUT_REPORT)) {
2725+ if (!utils.extractResource("plugins/core/"+source, PropertiesMgr.getReportFolder()+"/"+source)) {
2726+ utils.getLogger().error(CorePluginImpl.PLUGIN_NAME+": cannot extract resource plugins/core/"+source);
2727+ throw new Exception("Не найден файл с шаблоном");
2728+ }
2729+ }
2730+
2731+ String baseDirectory = PropertiesMgr.getReportFolder();
2732+ String outDirectory = PropertiesMgr.getTempFolder();
2733+ String xlsSource = baseDirectory + "/" + source;
2734+ String xlsDest = outDirectory + "/" + payment.getId().toString()+"_" + source;
2735+
2736+ Map beans = new HashMap();
2737+ beans.put("reservation", payment.getReservation());
2738+ beans.put("payment", payment);
2739+
2740+ XLSTransformer transformer = new XLSTransformer();
2741+ transformer.transformXLS(xlsSource, beans, xlsDest);
2742+// recalcXLS(xlsDest); //обновление формул
2743+
2744+ return xlsDest;
2745+ }
2746+
2747+
2748+ /**
2749+ * создать отчет по пассажирам на направлении (гор.вылета/гор.возврата/дата)
2750+ * @param cityfrom
2751+ * @param cityto
2752+ * @param datefrom
2753+ * @return путь к файлу
2754+ * @throws Exception
2755+ */
2756+ public static String createXLSflightlistdirection( ListCity cityfrom, ListCity cityto, Date datefrom) throws Exception {
2757+ utils.getLogger().debug("Start createXLSflightlistdirection");
2758+
2759+ String baseDirectory = PropertiesMgr.getReportFolder();
2760+ String outDirectory = PropertiesMgr.getTempFolder();
2761+ String source = PropertiesMgr.getFlightlistdirReport(); //файл для отчета
2762+
2763+ String name="";
2764+ if (cityfrom!=null) name+=cityfrom.getId().toString()+"_";
2765+ else name+="__";
2766+ if (cityto!=null) name+=cityto.getId().toString()+"_";
2767+ else name+="__";
2768+
2769+ String xlsSource = baseDirectory + "/" + source;
2770+ String xlsDest = outDirectory + "/" + name + source;
2771+
2772+ Map beans = new HashMap();
2773+
2774+ List vals=new java.util.ArrayList();
2775+
2776+ //получим бронь
2777+ if (cityfrom!=null) beans.put("cityfrom", cityfrom);
2778+ if (cityto!=null) beans.put("cityto", cityto);
2779+ beans.put("datefrom", datefrom);
2780+
2781+ //рейсы на вылет --------------------------------
2782+ List conditions = new ArrayList();
2783+ conditions.add(ExpressionFactory.matchExp("deletedate", null)); //пассажир не удален
2784+
2785+ List subconditions = new ArrayList();
2786+ subconditions.add(ExpressionFactory.matchExp("flightByIdFlightthere+.deletedate", null)); //рейс не удален
2787+ if (datefrom != null)
2788+ subconditions.add(ExpressionFactory.matchExp("flightByIdFlightthere+.dateFrom", datefrom));
2789+ if (cityfrom != null)
2790+ subconditions.add(ExpressionFactory.matchExp("flightByIdFlightthere+.listAirportByIdAirportFrom+.listCity", cityfrom));
2791+ if (cityto != null)
2792+ subconditions.add(ExpressionFactory.matchExp("flightByIdFlightthere+.listAirportByIdAirportTo+.listCity", cityto));
2793+ Expression qual = ExpressionFactory.joinExp(Expression.AND, subconditions);
2794+
2795+ subconditions = new ArrayList();
2796+ subconditions.add(ExpressionFactory.matchExp("flightByIdFlightback+.deletedate", null)); //рейс не удален
2797+ if (datefrom != null)
2798+ subconditions.add(ExpressionFactory.matchExp("flightByIdFlightback+.dateFrom", datefrom));
2799+ if (cityfrom != null)
2800+ subconditions.add(ExpressionFactory.matchExp("flightByIdFlightback+.listAirportByIdAirportFrom+.listCity", cityfrom));
2801+ if (cityto != null)
2802+ subconditions.add(ExpressionFactory.matchExp("flightByIdFlightback+.listAirportByIdAirportTo+.listCity", cityto));
2803+ Expression qual2 = ExpressionFactory.joinExp(Expression.AND, subconditions);
2804+ subconditions = new ArrayList();
2805+ subconditions.add(qual);
2806+ subconditions.add(qual2);
2807+ Expression qual3 = ExpressionFactory.joinExp(Expression.OR, subconditions);
2808+ conditions.add(qual3);
2809+
2810+ List<Passenger> resFrom = db_interface.queryConditions(Passenger.class, conditions);
2811+
2812+ //получить пассажиров на вылет
2813+ for (Passenger pass : resFrom) {
2814+ pass.processCustomFields();
2815+ vals.add(pass); }
2816+
2817+ beans.put("passenger", vals);
2818+
2819+ XLSTransformer transformer = new XLSTransformer();
2820+ transformer.transformXLS(xlsSource, beans, xlsDest);
2821+// recalcXLS(xlsDest); //обновление формул
2822+
2823+ return xlsDest;
2824+ }
2825+
2826+ /**
2827+ * пересчет всех формул в файле
2828+ * @param path
2829+ * @throws java.io.FileNotFoundException
2830+ * @throws java.io.IOException
2831+ */
2832+// public static void recalcXLS(String path) throws FileNotFoundException, IOException {
2833+// FileInputStream fis = new FileInputStream(path);
2834+// HSSFWorkbook wb = new HSSFWorkbook(fis); //or new XSSFWorkbook("/somepath/test.xls")
2835+// HSSFFormulaEvaluator evaluator = new HSSFFormulaEvaluator(wb);
2836+// for (int sheetNum = 0; sheetNum < wb.getNumberOfSheets(); sheetNum++) {
2837+// HSSFSheet sheet = wb.getSheetAt(sheetNum);
2838+//
2839+// for (Iterator<HSSFRow> it = sheet.rowIterator(); it.hasNext();) {
2840+// HSSFRow r = it.next();
2841+// for (Iterator<HSSFCell> it2 = r.cellIterator(); it2.hasNext();) {
2842+// HSSFCell c = it2.next();
2843+// if (c.getCellType() == HSSFCell.CELL_TYPE_FORMULA) {
2844+// evaluator.evaluateFormulaCell(c);
2845+// }
2846+// }
2847+// }
2848+// }
2849+// wb.write(new FileOutputStream(path));
2850+// }
2851+
2852+
2853+
2854+ /**
2855+ * печать счета в картинку
2856+ * использует invoiceNostampReport, xlsPrintCommand, xlsPrintExtension, reportFolder, tempFolder
2857+ * @param id_reservation
2858+ * @return путь к картинке
2859+ * @throws Exception
2860+ */
2861+ public static String printXLS(String res) throws Exception {
2862+// String source = PropertiesMgr.getInvoiceReport(); //файл для отчета
2863+// String res = createXLSinvoice(id_reservation, source);
2864+
2865+ String xlsprint = PropertiesMgr.getXlsPrintCommand();
2866+
2867+ res = res.replace("/", File.separator);
2868+
2869+ //отрезать расширение
2870+ String res2 = res.substring(0, res.lastIndexOf("."));
2871+ utils.getLogger().info("Result filename without extension: "+res2);
2872+
2873+ String filename = res2;
2874+ String extension = PropertiesMgr.getXlsPrintExtension(); //расширение у результата
2875+ if (!extension.equals("")) filename = res2+"."+extension;
2876+
2877+ File f = new File(filename);
2878+ f.delete();
2879+
2880+ utils.getLogger().info("Result should be: "+f.getAbsolutePath());
2881+
2882+ String commandLine = (xlsprint+" "+res).replace("/", File.separator);
2883+ utils.getLogger().info("Going to run: "+commandLine);
2884+ Process p = Runtime.getRuntime().exec(commandLine);
2885+
2886+ int count=PropertiesMgr.getPropertyInteger("printTimeout");
2887+ utils.getLogger().debug("wait for file max seconds: "+count);
2888+ while (count>0) {
2889+ try {
2890+ if (!f.exists()) { Thread.sleep(1000); }
2891+ else break;
2892+ } catch (InterruptedException interruptedException) {
2893+ throw new Exception("Interrupted while waiting for file");
2894+ }
2895+ count--;
2896+ }
2897+// p.waitFor();
2898+
2899+ if (!f.exists()) throw new Exception("File "+f.getAbsolutePath()+" not discovered");
2900+ return filename;
2901+ }
2902+
2903+
2904+ /**
2905+ * Открытие XLS файла на просмотр
2906+ * @param filename полное имя файла
2907+ */
2908+ public static void openXLS( String filename) {
2909+ try { //запуск превью
2910+ utils.getLogger().debug("openXLS: filename="+filename);
2911+ String xlspreview = PropertiesMgr.getXlspreview();
2912+ utils.getLogger().debug("openXLS: previewer="+xlspreview);
2913+ utils.getLogger().debug("openXLS: fileseparator="+File.separator);
2914+ String toRun = xlspreview.replace("/", File.separator);
2915+ toRun += " " + filename.replace("/", File.separator);
2916+ utils.getLogger().info("Running: "+toRun);
2917+ Process p = Runtime.getRuntime().exec(toRun);
2918+ } catch (IOException ex) {
2919+ utils.getLogger().error(ex);
2920+ JOptionPane.showMessageDialog(null, "Не удалось открыть файл "+filename);
2921+ }
2922+ }
2923+
2924+ /**
2925+ * Обработать файл jXLS
2926+ * @param xlsSource - входной файл
2927+ * @param beans - подготовленные бины
2928+ * @param xlsDest - выходной файл
2929+ * @return true - если всё успешно
2930+ */
2931+ public static boolean transformXLS( String xlsSource, Map beans, String xlsDest) throws InvalidFormatException {
2932+ XLSTransformer transformer = new XLSTransformer();
2933+ try {
2934+ transformer.transformXLS(xlsSource, beans, xlsDest);
2935+ } catch (ParsePropertyException ex) {
2936+ utils.getLogger().info(ex);
2937+ return false;
2938+ } catch (IOException ex) {
2939+ utils.getLogger().info(ex);
2940+ return false;
2941+ }
2942+ return true;
2943+ }
2944+
2945+ /**
2946+ * регистрация репортеров
2947+ * @param rif
2948+ */
2949+ public static void registerReporter(ReporterInterface rif) {
2950+ if (reporters.isEmpty() && !(rif instanceof xlsbuilder)) registerReporter(new xlsbuilder());
2951+ for (ReporterInterface.Functional func : rif.getFunctionality()) {
2952+ reporters.put(func, rif);
2953+ }
2954+ }
2955+
2956+ /**
2957+ * генерация отчета классом, ответственным за это
2958+ * @param func
2959+ * @param res
2960+ * @return
2961+ * @throws Exception
2962+ */
2963+ public static String doReport(ReporterInterface.Functional func, Reservation res) throws Exception {
2964+ if (reporters.isEmpty()) registerReporter(new xlsbuilder());
2965+
2966+ if (!reporters.containsKey(func)) throw new Exception("Не обнаружен функционал для создания этого отчета");
2967+ ReporterInterface reporter = reporters.get(func);
2968+ if (func.equals(ReporterInterface.Functional.ACCEPT)) return reporter.createAccept(res);
2969+ if (func.equals(ReporterInterface.Functional.ACCEPT_EMAIL)) return reporter.createAcceptEmail(res);
2970+ if (func.equals(ReporterInterface.Functional.INVOICE)) return reporter.createInvoice(res);
2971+ if (func.equals(ReporterInterface.Functional.INVOICE_EMAIL)) return reporter.createInvoiceEmail(res);
2972+ throw new Exception("Запрос на неизвестный отчет");
2973+ }
2974+
2975+
2976+ public static Collection<Passenger> jasperPassenger() {
2977+ List<Passenger> passengers = new ArrayList<Passenger>();
2978+ return passengers;
2979+ }
2980+
2981+ public static Collection<Passenger> jasperPassenger(Map<String, Object> beans, String name) throws Exception
2982+ {
2983+
2984+ List<Passenger> passengers = (List<Passenger>) beans.get(name);
2985+
2986+ String outputFileName = "payments-report.xls";
2987+ JasperReport report = (JasperReport) JRLoader.loadObject(utils.getClassloader().getResourceAsStream("report1.jasper"));
2988+ JasperPrint print = JasperFillManager.fillReport(report, beans,
2989+ new JRBeanCollectionDataSource(passengers));
2990+ FileOutputStream fs = new FileOutputStream(new File(outputFileName));
2991+ JRXlsExporter exporterXLS = new JRXlsExporter();
2992+ exporterXLS.setParameter(JRXlsExporterParameter.JASPER_PRINT, print);
2993+ exporterXLS.setParameter(JRXlsExporterParameter.OUTPUT_STREAM, fs);
2994+ exporterXLS.setParameter(JRXlsExporterParameter.IS_ONE_PAGE_PER_SHEET, Boolean.TRUE);
2995+ exporterXLS.setParameter(JRXlsExporterParameter.IS_WHITE_PAGE_BACKGROUND, Boolean.FALSE);
2996+ exporterXLS.setParameter(JRXlsExporterParameter.IS_REMOVE_EMPTY_SPACE_BETWEEN_ROWS, Boolean.TRUE);
2997+ exporterXLS.exportReport();
2998+
2999+// return outputFileName;
3000+ return passengers;
3001+
3002+ }
3003+
3004+
3005+ /**
3006+ * связка функционала с классами отчетности
3007+ */
3008+ private static HashMap<ReporterInterface.Functional, ReporterInterface> reporters = new HashMap();
3009+
3010+
3011+ private static String PROP_KASSAIN_REPORT = "kassainReport";
3012+ private static String PROP_KASSAOUT_REPORT = "kassaoutReport";
3013+
3014+ private static String DEFAULT_KASSAIN_REPORT = "kassain_default.xls";
3015+ private static String DEFAULT_KASSAOUT_REPORT = "kassaout_default.xls";
3016+
3017+}
3018
3019=== modified file 'src/cbadmin/entity2/Block.java'
3020--- src/cbadmin/entity2/Block.java 2010-11-15 22:27:20 +0000
3021+++ src/cbadmin/entity2/Block.java 2011-04-25 18:28:30 +0000
3022@@ -2,6 +2,7 @@
3023
3024 import cbadmin.entity2.auto._Block;
3025 import cbadmin.util.CurrencyMgr;
3026+import cbadmin.util.PluginMgr;
3027 import cbadmin.util.PropertiesMgr;
3028 import cbadmin.util.utils;
3029 import java.util.ArrayList;
3030@@ -10,6 +11,7 @@
3031 import java.util.HashSet;
3032 import java.util.List;
3033 import org.apache.cayenne.exp.ExpressionFactory;
3034+import plugins.BlockListenerPlugin;
3035
3036 public class Block extends _Block {
3037
3038@@ -23,22 +25,16 @@
3039 else return getVendor().getName();
3040 }
3041
3042- @Override
3043- public void setDeletedate(Date d) {
3044- if (getId()==null) throw new IllegalStateException("Not initialized.");
3045- if (d!=null) {
3046- setFlight(null);
3047- deleteDirect();
3048- }
3049- else { //это восстановление, не трогаем
3050- }
3051- }
3052-
3053- @Override
3054- public Date getDeletedate() {
3055- if (getId()==null) throw new IllegalStateException("Not initialized.");
3056- else return null;
3057- }
3058+// @Override
3059+// public void setDeletedate(Date d) {
3060+// if (getId()==null) throw new IllegalStateException("Not initialized.");
3061+// if (d!=null) {
3062+// setFlight(null);
3063+// deleteDirect();
3064+// }
3065+// else { //это восстановление, не трогаем
3066+// }
3067+// }
3068
3069 @Override
3070 /**
3071@@ -46,10 +42,34 @@
3072 */
3073 public boolean delete() {
3074 if (this.getSummaPayed()!=0) return false;
3075+ if (!this.getPassengersForIdBlockback().isEmpty()) return false;
3076+ if (!this.getPassengersForIdBlockthere().isEmpty()) return false;
3077+
3078+ for (BlockListenerPlugin plugin : PluginMgr.getPlugins(BlockListenerPlugin.class))
3079+ if (!plugin.deleteBlock(this)) return false;
3080+
3081 return super.delete();
3082 }
3083
3084 /**
3085+ * можно ли удалить этот блок безболезненно.
3086+ * Зависит от того, можно ли удалить все его зависимости.
3087+ * Зависит от того, есть ли неудаленные оплаты по нему.
3088+ * Есть ли на нем пассажиры.
3089+ * @return true если блок может быть удален
3090+ */
3091+ public boolean canDelete() {
3092+ if (!getNonDeletedPassengers().isEmpty()) return false;
3093+ if (!getNonDeletedPayments().isEmpty()) return false;
3094+
3095+ //спрашиваем у плагинов, если есть
3096+ for (BlockListenerPlugin plugin : PluginMgr.getPlugins(BlockListenerPlugin.class))
3097+ if (!plugin.canDeleteBlock(this)) return false;
3098+
3099+ return true;
3100+ }
3101+
3102+ /**
3103 * поиск блоков по рейсу и поставщику
3104 * @param flight рейс
3105 * @param vendor поставщик
3106@@ -59,8 +79,26 @@
3107 List conditions = new ArrayList();
3108 conditions.add(ExpressionFactory.matchExp(Block.FLIGHT_PROPERTY, flight));
3109 conditions.add(ExpressionFactory.matchExp(Block.VENDOR_PROPERTY, vendor));
3110- return db_interface.queryConditions(Block.class, conditions);
3111- }
3112+ conditions.add(ExpressionFactory.matchExp(Block.DELETEDATE_PROPERTY, null));
3113+ return db_interface.queryConditions(Block.class, conditions);
3114+ }
3115+
3116+ /**
3117+ * поиск блоков по рейсу и поставщику
3118+ * @param flight рейс
3119+ * @param vendor поставщик
3120+ * @param lclass класс перелета
3121+ * @return список найденных блоков
3122+ */
3123+ public static List<Block> queryByFlightVendorClass(Flight flight, Client vendor, ListClass lclass) {
3124+ List conditions = new ArrayList();
3125+ conditions.add(ExpressionFactory.matchExp(Block.FLIGHT_PROPERTY, flight));
3126+ conditions.add(ExpressionFactory.matchExp(Block.VENDOR_PROPERTY, vendor));
3127+ conditions.add(ExpressionFactory.matchExp(Block.LIST_CLASS_PROPERTY, lclass));
3128+ conditions.add(ExpressionFactory.matchExp(Block.DELETEDATE_PROPERTY, null));
3129+ return db_interface.queryConditions(Block.class, conditions);
3130+ }
3131+
3132
3133 //========================================================
3134 //заявки/пассажиры
3135@@ -73,7 +111,7 @@
3136 List<Passenger> pass = new ArrayList();
3137 pass.addAll(getPassengersForIdBlockthere());
3138 pass.addAll(getPassengersForIdBlockback());
3139- List res = new ArrayList();
3140+ List<Passenger> res = new ArrayList();
3141
3142 for (Passenger passenger : pass) {
3143 if (passenger.getDeletedate()!=null) continue;
3144@@ -237,18 +275,31 @@
3145 }
3146 //===========================================================
3147 //оплаты
3148+
3149+ /**
3150+ * количество сидящих пассажиров
3151+ * @return
3152+ */
3153+ public List<Payment> getNonDeletedPayments() {
3154+ if (getId()==null) throw new IllegalStateException("Not initialized.");
3155+ List<Payment> payments = new ArrayList();
3156+ for (Payment payment : getPayments()) if (!payment.isDeleted()) payments.add(payment);
3157+ return payments;
3158+ }
3159+
3160+
3161 /**
3162 * сумма к оплате
3163 * @param curres
3164 * @return
3165 */
3166- public double getSummaToPay(ListCurrency curres) {
3167+ public double getSummaToPay(ListCurrency curres, Date calcdate) {
3168 if (getId()==null) throw new IllegalStateException("Not initialized.");
3169 double total = 0;
3170 if (getPrice()==0) return total; //нулевая сумма
3171
3172 try {
3173- Date calcdate = new Date();
3174+ if (calcdate==null) calcdate = new Date();
3175 total += CurrencyMgr.convert(getPrice()*getCapacity(), getListCurrency().getId(), curres.getId(), calcdate);
3176 } catch (Exception ex) {
3177 utils.getLogger().error(ex);
3178@@ -259,12 +310,20 @@
3179 }
3180
3181 /**
3182+ * сумма к оплате
3183+ * @param curres
3184+ * @return
3185+ */
3186+ public double getSummaToPay(ListCurrency curres) {
3187+ return getSummaToPay(curres, null);
3188+ }
3189+
3190+ /**
3191 * сумма к оплате в текущей валюте
3192 * @return
3193 */
3194 public double getSummaToPay() {
3195- if (getId()==null) throw new IllegalStateException("Not initialized.");
3196- return getSummaToPay(getListCurrency());
3197+ return getSummaToPay(getListCurrency(), null);
3198 }
3199
3200 /**
3201@@ -285,7 +344,7 @@
3202 continue;
3203 }
3204
3205- payed += payment.getPayed(getListCurrency(), curres);
3206+ payed += payment.getPayed(getListCurrency(), curres, true);
3207 }
3208 utils.getLogger().info("getSummaPayed: summa="+payed);
3209 return payed;
3210@@ -313,6 +372,27 @@
3211
3212 //=============================================================
3213 //вспомогательное
3214+ /**
3215+ * заполнение всех полей в отдельный метод для повторного использования
3216+ * @param flight
3217+ * @param vendor поставщик блока
3218+ * @param capacity
3219+ * @param lclass класс перелета
3220+ * @param currency
3221+ * @param price
3222+ */
3223+ public void fill(Flight flight, Client vendor, int capacity, ListClass lclass, ListCurrency currency, float price) {
3224+ this.setListClass(lclass);
3225+ this.setVendor(vendor);
3226+ this.setFlight(flight);
3227+ this.setListCurrency(currency);
3228+ this.setCapacity(capacity);
3229+ this.setPrice(price);
3230+ }
3231+
3232+//=============================================================
3233+//шаблоны
3234+
3235 //для детализации прогнозного отчета
3236 public double getSummaLeftEuro() {
3237 if (getId()==null) throw new IllegalStateException("Not initialized.");
3238@@ -329,7 +409,7 @@
3239 if (getListCurrency().getId().equals(CurrencyMgr.CURRENCY_ROUBLE_ID)) return getSummaToPay()-getSummaPayed();
3240 else return 0;
3241 }
3242- public double getSummaReservationsPaid() {
3243+ public double getSummaReservationsPaidRoubles() {
3244 if (getId()==null) throw new IllegalStateException("Not initialized.");
3245 double sum = 0;
3246 for (Reservation res : getReservationsMain()) {
3247@@ -342,6 +422,22 @@
3248 }
3249 return sum;
3250 }
3251+ public double getSummaReservationsPaidNoCommissionRoubles() {
3252+ if (getId()==null) throw new IllegalStateException("Not initialized.");
3253+ double sum = 0;
3254+ for (Reservation res : getReservationsMain()) {
3255+
3256+ if (res.getListReservationStatus().getId().equals(Reservation.RESERVATION_STATUS_NEW) ) continue;
3257+ if (res.getListReservationStatus().getId().equals(Reservation.RESERVATION_STATUS_INPROGRESS) ) continue;
3258+ if (res.getListReservationStatus().getId().equals(Reservation.RESERVATION_STATUS_VOIDED) ) continue;
3259+
3260+ double sumtot = res.getSummaPayedNoCommissionRoubles();
3261+ if (sumtot>=res.getAviaVendorsToPayDiscountRoubles()) sum += res.getAviaVendorsToPayDiscountRoubles();
3262+ else sum+= res.getSummaPayedNoCommissionRoubles();
3263+ }
3264+ return sum;
3265+ }
3266+
3267 public double getSummaReservationsLeftRouble() {
3268 if (getId()==null) throw new IllegalStateException("Not initialized.");
3269 double sum = 0;
3270@@ -352,7 +448,9 @@
3271 if (res.getListReservationStatus().getId().equals(Reservation.RESERVATION_STATUS_VOIDED) ) continue;
3272
3273 if (res.getListCurrency().getId().equals(CurrencyMgr.CURRENCY_ROUBLE_ID))
3274- sum+= res.getSummaToPay(res.getListCurrency(), res.getDiscount())-res.getSummaPayed(res.getListCurrency());
3275+ if (res.getSummaPayed(res.getListCurrency())<res.getAviaVendorsToPayDiscountRoubles())
3276+ sum+= res.getAviaVendorsToPayDiscountRoubles()-res.getSummaPayed(res.getListCurrency());
3277+// sum+= res.getSummaToPay(res.getListCurrency(), res.getDiscount(), null)-res.getSummaPayed(res.getListCurrency());
3278 }
3279 return sum;
3280 }
3281@@ -365,7 +463,7 @@
3282 if (res.getListReservationStatus().getId().equals(Reservation.RESERVATION_STATUS_VOIDED) ) continue;
3283
3284 if (res.getListCurrency().getId().equals(CurrencyMgr.CURRENCY_DOLLAR_ID))
3285- sum+= res.getSummaToPay(res.getListCurrency(), res.getDiscount())-res.getSummaPayed(res.getListCurrency());
3286+ sum+= res.getSummaToPay(res.getListCurrency(), res.getDiscount(), null)-res.getSummaPayed(res.getListCurrency());
3287 }
3288 return sum;
3289 }
3290@@ -378,7 +476,7 @@
3291 if (res.getListReservationStatus().getId().equals(Reservation.RESERVATION_STATUS_VOIDED) ) continue;
3292
3293 if (res.getListCurrency().getId().equals(CurrencyMgr.CURRENCY_EURO_ID))
3294- sum+= res.getSummaToPay(res.getListCurrency(), res.getDiscount())-res.getSummaPayed(res.getListCurrency());
3295+ sum+= res.getSummaToPay(res.getListCurrency(), res.getDiscount(), null)-res.getSummaPayed(res.getListCurrency());
3296 }
3297 return sum;
3298 }
3299@@ -458,5 +556,22 @@
3300 "Поставщик"
3301 };
3302
3303+ @Override
3304+ protected void onPostAdd() {
3305+ utils.getLogger().debug("Block.onPostAdd called");
3306+
3307+ setCapacity(0);
3308+ setPrice(0);
3309+ }
3310+
3311+ //направления транзакций с блоками
3312+ /**
3313+ * мы покупаем. у нас увеличивается
3314+ */
3315+ public static int CONST_DIRECTION_BUY = 1;
3316+ /**
3317+ * мы продаем. у нас уменьшается
3318+ */
3319+ public static int CONST_DIRECTION_SELL = 2;
3320
3321 }
3322
3323=== modified file 'src/cbadmin/entity2/Client.java'
3324--- src/cbadmin/entity2/Client.java 2010-11-04 23:24:26 +0000
3325+++ src/cbadmin/entity2/Client.java 2011-04-25 18:28:30 +0000
3326@@ -3,9 +3,11 @@
3327 import cbadmin.entity2.auto._Client;
3328 import java.util.ArrayList;
3329 import java.util.Comparator;
3330+import java.util.HashMap;
3331 import java.util.List;
3332 import org.apache.cayenne.exp.Expression;
3333 import org.apache.cayenne.exp.ExpressionFactory;
3334+import org.apache.cayenne.query.PrefetchTreeNode;
3335
3336 public class Client extends _Client {
3337
3338@@ -22,6 +24,16 @@
3339 return queryAllNotDeleted(Client.class);
3340 }
3341
3342+ public static List<Client> queryAllNotDeletedNameNotNull() {
3343+ List conditions = new ArrayList();
3344+ conditions.add(ExpressionFactory.noMatchExp(Client.NAME_PROPERTY, null));
3345+ conditions.add(ExpressionFactory.matchExp(Client.DELETEDATE_PROPERTY, null));
3346+ return db_interface.queryConditions(Client.class, conditions);
3347+
3348+// return queryAllNotDeleted(Client.class);
3349+ }
3350+
3351+
3352 /**
3353 * Нужно сформировать имя при сохранении
3354 * @return
3355@@ -47,13 +59,14 @@
3356 conditions.add(ExpressionFactory.matchExp(Client.UNAME_PROPERTY, name));
3357 List<db_interface> list = db_interface.queryConditions(Client.class, conditions);
3358 for (db_interface val : list) {
3359- if (val.getId()!=id) return true;
3360+ if (!val.getId().equals(id)) return true;
3361 }
3362 return false;
3363 }
3364 public static List queryByUname(String name) {
3365 List conditions = new ArrayList();
3366 conditions.add(ExpressionFactory.matchExp(Client.UNAME_PROPERTY, name));
3367+
3368 return db_interface.queryConditions(Client.class, conditions);
3369 }
3370
3371@@ -66,7 +79,11 @@
3372 Expression qualifier2 = ExpressionFactory.matchExp(Client.CL_TYPE_PROPERTY, 1);
3373 List conds = new ArrayList();
3374 conds.add(qualifier2);
3375- return queryConditions(Client.class, conds);
3376+
3377+ HashMap<String, Integer> map = new HashMap();
3378+ map.put("clientFl", PrefetchTreeNode.DISJOINT_PREFETCH_SEMANTICS);
3379+
3380+ return queryConditions(Client.class, conds, map);
3381 }
3382
3383 /**
3384@@ -77,7 +94,11 @@
3385 Expression qualifier2 = ExpressionFactory.matchExp(Client.CL_TYPE_PROPERTY, 2);
3386 List conds = new ArrayList();
3387 conds.add(qualifier2);
3388- return queryConditions(Client.class, conds);
3389+ HashMap<String, Integer> map = new HashMap();
3390+ map.put("clientUl", PrefetchTreeNode.JOINT_PREFETCH_SEMANTICS);
3391+
3392+ return queryConditions(Client.class, conds, map);
3393+
3394 }
3395
3396
3397
3398=== modified file 'src/cbadmin/entity2/Flight.java'
3399--- src/cbadmin/entity2/Flight.java 2010-11-04 23:24:26 +0000
3400+++ src/cbadmin/entity2/Flight.java 2011-04-25 18:28:30 +0000
3401@@ -33,6 +33,7 @@
3402 for (int i = 0; i < blocks.length; i++) {
3403 Block block = (Block)blocks[i];
3404 block.delete(); //на самом деле там физически удаляется
3405+ //20.03.2011 уже нет, также ставится deletedate
3406 }
3407 return super.delete();
3408 }
3409@@ -71,6 +72,20 @@
3410 }
3411
3412 /**
3413+ * можно ли удалить этот рейс безболезненно.
3414+ * Зависит от того, можно ли удалить все входящие в него блоки.
3415+ * Зависит от того, есть ли предложения на этот рейс(?)
3416+ * @return true если рейс может быть удален
3417+ */
3418+ public boolean canDelete() {
3419+ for (Block block : getBlocks()) { //нам нужны только неудаленные блоки. направление (покупаем/продаем) значения не имеет
3420+ if (!block.canDelete()) return false;
3421+ }
3422+ //предложения рассматривать не будем. они отрабатывают автоматом
3423+ return true;
3424+ }
3425+
3426+ /**
3427 * создаем блок waitlist
3428 * @return
3429 */
3430@@ -96,21 +111,49 @@
3431 return true;
3432 }
3433
3434+ /**
3435+ * получить блоки в рейсе БЕЗ удаленных. для получения удаленных следует использовать запрос.
3436+ * @return
3437+ */
3438+ @Override
3439+ public List<Block> getBlocks() {
3440+ List<Block> blocks = new ArrayList();
3441+
3442+ for (Block block : super.getBlocks()) {
3443+ if (!block.isDeleted()) blocks.add(block);
3444+ }
3445+ return blocks;
3446+ }
3447
3448 //-------------------------------
3449 public List<Passenger> getNonDeletedPassengers() {
3450 List<Passenger> pass = getPassengersForIdFlightthere();
3451 pass.addAll(getPassengersForIdFlightback());
3452- List res = new ArrayList();
3453+ List<Passenger> res = new ArrayList();
3454
3455 for (Passenger passenger : pass) {
3456- if (passenger.getDeletedate()!=null) continue;
3457+ if (passenger.isDeleted()) continue;
3458 res.add(passenger);
3459 }
3460 return res;
3461 }
3462
3463 /**
3464+ * найти не waitlist блоки
3465+ * @return
3466+ */
3467+ public List<Block> getNonWaitlistBlocks() {
3468+ List<Block> blocks = getBlocks();
3469+ List<Block> res = new ArrayList();
3470+
3471+ for (Block block : blocks) {
3472+ if (!block.getListClass().isWaitlist()) res.add(block);
3473+ }
3474+ return res;
3475+ }
3476+
3477+
3478+ /**
3479 * найти удаленный рейс этой программы (т.е. с тем же номером) за эту дату
3480 * @param program
3481 * @param date
3482@@ -148,6 +191,7 @@
3483
3484 /**
3485 * получить список рейсов по параметрам
3486+ * удаленные не показываем
3487 */
3488 public static List<Flight> queryByCountryAndDate(ListCountry countryFrom, ListCountry countryTo, Date date) {
3489 List conditions = new ArrayList();
3490@@ -163,6 +207,7 @@
3491 ) , countryTo));
3492 conditions.add(ExpressionFactory.matchExp(
3493 Flight.DATE_FROM_PROPERTY , date));
3494+ conditions.add(ExpressionFactory.matchExp(Flight.DELETEDATE_PROPERTY , null));
3495
3496 //принудительно кешируем, эти данные не меняются
3497 return db_interface.queryConditions(Flight.class, conditions, "flightCache");
3498@@ -170,6 +215,11 @@
3499
3500 /**
3501 * получить список рейсов по параметрам
3502+ * @param cityFrom город вылета
3503+ * @param cityTo город прилёта
3504+ * @param airline авиакомпания. null для всех
3505+ * @param datefrom дата с. Опциональна
3506+ * @param dateto дата по. Опциональна
3507 */
3508 public static List<String> getFlightList(ListCity cityFrom, ListCity cityTo,
3509 ListAirline airline, Date datefrom, Date dateto) {
3510@@ -180,6 +230,7 @@
3511 if (airline!=null) hql = hql + " and f.listAirline=:airline ";
3512 if (datefrom!=null) hql = hql + " and f.dateFrom>=:datefrom ";
3513 if (dateto!=null) hql = hql + " and f.dateFrom<=:dateto ";
3514+ hql = hql + " and f.deletedate is null ";
3515
3516 EJBQLQuery query = new EJBQLQuery(hql);
3517 query.setParameter("cityfrom", cityFrom);
3518@@ -195,17 +246,23 @@
3519
3520 /**
3521 * получить список рейсов по городам и дате
3522+ * без удаленных
3523 */
3524 public static List<Flight> getFlightList(ListCity cityFrom, ListCity cityTo, Date date) {
3525 //заполнить список рейсов для данного города и даты
3526
3527 List conditions = new ArrayList();
3528 conditions.add(ExpressionFactory.matchExp(Flight.DELETEDATE_PROPERTY, null));
3529- conditions.add(ExpressionFactory.matchExp("listAirportByIdAirportFrom.listCity", cityFrom));
3530- conditions.add(ExpressionFactory.matchExp("listAirportByIdAirportTo.listCity", cityTo));
3531+ conditions.add(ExpressionFactory.matchExp(
3532+ utils.path(Flight.LIST_AIRPORT_BY_ID_AIRPORT_FROM_PROPERTY,
3533+ ListAirport.LIST_CITY_PROPERTY), cityFrom));
3534+ conditions.add(ExpressionFactory.matchExp(
3535+ utils.path(Flight.LIST_AIRPORT_BY_ID_AIRPORT_TO_PROPERTY,
3536+ ListAirport.LIST_CITY_PROPERTY), cityTo));
3537 conditions.add(ExpressionFactory.matchExp(Flight.DATE_FROM_PROPERTY, date));
3538
3539 List<Flight> resultFlight = db_interface.queryConditions(Flight.class, conditions);
3540+ if (resultFlight==null) resultFlight = new ArrayList<Flight>();
3541 return resultFlight;
3542 }
3543
3544
3545=== modified file 'src/cbadmin/entity2/FlightProgram.java'
3546--- src/cbadmin/entity2/FlightProgram.java 2010-06-01 20:53:46 +0000
3547+++ src/cbadmin/entity2/FlightProgram.java 2011-04-25 18:28:30 +0000
3548@@ -8,7 +8,7 @@
3549
3550 @Override
3551 public boolean delete() {
3552- Object[] pers = getFlightProgramPeriodses().toArray();
3553+ Object[] pers = getFlightProgramPeriods().toArray();
3554 for (int i = 0; i < pers.length; i++) {
3555 FlightProgramPeriods per = (FlightProgramPeriods)pers[i];
3556 per.delete(); //на самом деле там физически удаляется
3557@@ -29,5 +29,17 @@
3558 return res;
3559 }
3560
3561+ /**
3562+ * можно ли удалить этот период безболезненно.
3563+ * Зависит от того, можно ли удалить все входящие в него рейсы.
3564+ * @return true если период может быть удален
3565+ */
3566+ public boolean canDelete() {
3567+ for (FlightProgramPeriods flightprogramperiod : getFlightProgramPeriods()) {
3568+ if (flightprogramperiod.isDeleted()) continue;
3569+ if (!flightprogramperiod.canDelete()) return false;
3570+ }
3571+ return true;
3572+ }
3573
3574 }
3575
3576=== modified file 'src/cbadmin/entity2/FlightProgramPeriods.java'
3577--- src/cbadmin/entity2/FlightProgramPeriods.java 2010-04-09 06:21:55 +0000
3578+++ src/cbadmin/entity2/FlightProgramPeriods.java 2011-04-25 18:28:30 +0000
3579@@ -27,7 +27,7 @@
3580 */
3581 @Override
3582 public boolean delete() {
3583- Object[] flights = getFlights().toArray();
3584+ Object[] flights = getNonDeletedFlights().toArray();
3585 for (int i = 0; i < flights.length; i++) {
3586 Flight flight = (Flight)flights[i];
3587 flight.delete(); //на самом деле там физически удаляется
3588@@ -51,7 +51,7 @@
3589 return blocks;
3590 }
3591
3592- public List<Flight> getNonDeletedFlights() {
3593+ public List<Flight> getNonDeletedFlights() {
3594 if (getId()==null) throw new IllegalStateException("Not initialized.");
3595 List<Flight> pass = getFlights();
3596 List res = new ArrayList();
3597@@ -63,4 +63,19 @@
3598 return res;
3599 }
3600
3601+ /**
3602+ * можно ли удалить этот период безболезненно.
3603+ * Зависит от того, можно ли удалить все входящие в него рейсы.
3604+ * @return true если период может быть удален
3605+ */
3606+ public boolean canDelete() {
3607+ for (Flight flight : getFlights()) {
3608+ if (flight.isDeleted()) continue;
3609+ if (!flight.canDelete()) return false;
3610+ }
3611+ return true;
3612+ }
3613+
3614+
3615+
3616 }
3617
3618=== modified file 'src/cbadmin/entity2/ListAge.java'
3619--- src/cbadmin/entity2/ListAge.java 2010-09-21 14:26:29 +0000
3620+++ src/cbadmin/entity2/ListAge.java 2011-04-25 18:28:30 +0000
3621@@ -1,7 +1,7 @@
3622 package cbadmin.entity2;
3623
3624 import cbadmin.entity2.auto._ListAge;
3625-import cbadmin.util.PriceVendorInterface;
3626+import cbadmin.business.PriceVendorInterface;
3627
3628 public class ListAge extends _ListAge {
3629
3630@@ -10,13 +10,20 @@
3631 }
3632
3633
3634+ /**
3635+ * если сразу в две категории попал
3636+ * @return
3637+ */
3638+ public boolean isAdultChild() {
3639+ return isAdult() && isChild();
3640+ }
3641
3642 public void setInfant(Boolean infant) {
3643 if (infant) setIsInfant(new Byte("1"));
3644 else setIsInfant(new Byte("0"));
3645 }
3646 public boolean isInfant() {
3647- return (getIsInfant().byteValue()==1);
3648+ return (getIsInfant()==1);
3649 }
3650
3651 public void setAdult(Boolean adult) {
3652@@ -24,7 +31,7 @@
3653 else setIsAdult(new Byte("0"));
3654 }
3655 public boolean isAdult() {
3656- return (getIsAdult().byteValue()==1);
3657+ return (getIsAdult()==1);
3658 }
3659
3660 public void setChild(Boolean child) {
3661@@ -32,7 +39,7 @@
3662 else setIsChild(new Byte("0"));
3663 }
3664 public boolean isChild() {
3665- return (getIsChild().byteValue()==1);
3666+ return (getIsChild()==1);
3667 }
3668
3669
3670@@ -43,9 +50,11 @@
3671 */
3672 public boolean isInPeriod(int age) {
3673 if (age<0) return false;
3674+ if (getAgefrom()==0 && getAgeto()==0) return true;
3675
3676 if (getAgefrom()==0) return age<=getAgeto();
3677 if (getAgeto()==0) return age>=getAgefrom();
3678+ if (getAgeto()==0) return age>=getAgefrom();
3679 return age>=getAgefrom() && age<=getAgeto();
3680 }
3681
3682@@ -54,7 +63,7 @@
3683 * @param ageCategory - категория возраста. Дефиниции в PriceVendorInterface
3684 * @return true если попадает
3685 */
3686- public boolean isInCategory(String ageCategory) {
3687+ public boolean isInCategory(Integer ageCategory) {
3688 if (ageCategory.equals(PriceVendorInterface.CONST_AGECATEGORY_INFANT) && isInfant()) return true;
3689 if (ageCategory.equals(PriceVendorInterface.CONST_AGECATEGORY_CHILD) && isChild()) return true;
3690 if (ageCategory.equals(PriceVendorInterface.CONST_AGECATEGORY_ADULT) && isAdult()) return true;
3691
3692=== modified file 'src/cbadmin/entity2/ListAirline.java'
3693--- src/cbadmin/entity2/ListAirline.java 2010-10-16 07:11:43 +0000
3694+++ src/cbadmin/entity2/ListAirline.java 2011-04-25 18:28:30 +0000
3695@@ -7,6 +7,23 @@
3696
3697 public class ListAirline extends _ListAirline {
3698
3699+ /**
3700+ * вернуть имя с кодом авиакомпании
3701+ * @return
3702+ */
3703+ @Override
3704+ public String getName() {
3705+ return super.getName()+" ("+getCode()+")";
3706+ }
3707+
3708+ /**
3709+ * вернуть чистое имя, без кода авиакомпании
3710+ * @return
3711+ */
3712+ public String getCleanName() {
3713+ return super.getName();
3714+ }
3715+
3716 public static List<ListAirline> queryAll() {
3717 return queryAll(ListAirline.class);
3718 }
3719
3720=== modified file 'src/cbadmin/entity2/ListClass.java'
3721--- src/cbadmin/entity2/ListClass.java 2010-11-04 23:24:26 +0000
3722+++ src/cbadmin/entity2/ListClass.java 2011-04-25 18:28:30 +0000
3723@@ -36,5 +36,12 @@
3724 return res;
3725 }
3726
3727+ /**
3728+ * класс относится к waitlist'ам
3729+ * @return
3730+ */
3731+ public boolean isWaitlist() {
3732+ return (getParentClass()!=null);
3733+ }
3734
3735 }
3736
3737=== added file 'src/cbadmin/entity2/ListEmail.java'
3738--- src/cbadmin/entity2/ListEmail.java 1970-01-01 00:00:00 +0000
3739+++ src/cbadmin/entity2/ListEmail.java 2011-04-25 18:28:30 +0000
3740@@ -0,0 +1,7 @@
3741+package cbadmin.entity2;
3742+
3743+import cbadmin.entity2.auto._ListEmail;
3744+
3745+public class ListEmail extends _ListEmail {
3746+
3747+}
3748
3749=== modified file 'src/cbadmin/entity2/ListPayMethod.java'
3750--- src/cbadmin/entity2/ListPayMethod.java 2010-11-04 23:24:26 +0000
3751+++ src/cbadmin/entity2/ListPayMethod.java 2011-04-25 18:28:30 +0000
3752@@ -1,7 +1,10 @@
3753 package cbadmin.entity2;
3754
3755 import cbadmin.entity2.auto._ListPayMethod;
3756+import cbadmin.util.utils;
3757 import java.util.List;
3758+import org.apache.cayenne.ObjectId;
3759+import org.apache.cayenne.query.EJBQLQuery;
3760
3761 public class ListPayMethod extends _ListPayMethod {
3762
3763@@ -9,5 +12,33 @@
3764 return queryAllNotDeleted(ListPayMethod.class);
3765 }
3766
3767+ public void setId(Long id) {
3768+ ObjectId oid = new ObjectId("ListPayMethod", ID_PK_COLUMN, id);
3769+ setObjectId(oid);
3770+ }
3771+
3772+
3773+ /**
3774+ * получить номер последней пользовательской услуги
3775+ * @return
3776+ */
3777+ public static Long getLastId() {
3778+
3779+ EJBQLQuery query = new EJBQLQuery("select max(a.id_key) FROM ListPayMethod a");
3780+ List<Long> list = utils.getContext().performQuery(query);
3781+ if (list.isEmpty()) return CONST_CUSTOM_SERVICES_FROM;
3782+ else return list.get(0).longValue();
3783+ }
3784+
3785+ public static Long CONST_CUSTOM_SERVICES_FROM = new Long(1000);
3786+
3787+ /**
3788+ * оплата по курсу на дату высталвения подверждения и счета
3789+ */
3790+ public static int CONST_RATE_BILLDATE = 1;
3791+ /**
3792+ * оплата по курсу на дату оплаты
3793+ */
3794+ public static int CONST_RATE_PAYDATE = 0;
3795
3796 }
3797
3798=== modified file 'src/cbadmin/entity2/Passenger.java'
3799--- src/cbadmin/entity2/Passenger.java 2010-10-24 21:50:24 +0000
3800+++ src/cbadmin/entity2/Passenger.java 2011-04-25 18:28:30 +0000
3801@@ -177,38 +177,22 @@
3802
3803 /*
3804 * рассчитать класс на вылет
3805- * 1. Если пассажиры, то берутся классы для пассажиров.
3806- * 2. Если нет пассажиров, либо они не сидят, то берется предложение, по которому сформирована заявка.
3807- * 3. Если нет предложения, то берется класс по-умолчанию
3808+ * если есть родительский класс, то это WL, нужен папа
3809 */
3810 public ListClass getCalculatedClassthere() {
3811- if (getFlightByIdFlightthere()==null) return null;
3812- if (getListClassByIdClassthere()!=null) return getListClassByIdClassthere();
3813- //получим предложение, в котором рейсы
3814- Offer offer = db_interface.load(Offer.class, new Long(getReservation().getIdOffer()).intValue());
3815- if (offer!=null) { //получить класс перелета из предложения, если есть
3816- ListClass cls=offer.getListClass();
3817- return cls;
3818- }
3819- return ListClass.load(Block.CLASS_DEFAULT_ID);
3820+ if (getBlockByIdBlockthere()==null) return null; //не сидит
3821+ if (getBlockByIdBlockthere().getListClass().getParentClass()!=null) return getBlockByIdBlockthere().getListClass().getParentClass();
3822+ else return getBlockByIdBlockthere().getListClass();
3823 }
3824
3825 /*
3826- * рассчитать класс на вылет
3827- * 1. Если пассажиры, то берутся классы для пассажиров.
3828- * 2. Если нет пассажиров, либо они не сидят, то берется предложение, по которому сформирована заявка.
3829- * 3. Если нет предложения, то берется класс по-умолчанию
3830+ * рассчитать класс на возврат
3831+ * если есть родительский класс, то это WL, нужен папа
3832 */
3833 public ListClass getCalculatedClassback() {
3834- if (getFlightByIdFlightback()==null) return null;
3835- if (getListClassByIdClassback()!=null) return getListClassByIdClassback();
3836- //получим предложение, в котором рейсы
3837- Offer offer = db_interface.load(Offer.class, new Long(getReservation().getIdOffer()).intValue());
3838- if (offer!=null) { //получить класс перелета из предложения, если есть
3839- ListClass cls=offer.getListClass();
3840- return cls;
3841- }
3842- return ListClass.load(Block.CLASS_DEFAULT_ID);
3843+ if (getBlockByIdBlockback()==null) return null; //не сидит
3844+ if (getBlockByIdBlockback().getListClass().getParentClass()!=null) return getBlockByIdBlockback().getListClass().getParentClass();
3845+ else return getBlockByIdBlockback().getListClass();
3846 }
3847
3848 /**
3849@@ -292,9 +276,7 @@
3850 if (getId()==null) throw new IllegalStateException("Not initialized.");
3851 double rub = 0;
3852 try {
3853- Date date = new Date();
3854- if (getReservation().getBilldate()!=null) date = getReservation().getBilldate();
3855- //по возможности берем дату выставления счета
3856+ Date date = getReservation().getReportDate(); //по возможности берем дату
3857
3858 utils.getLogger().debug("getPriceFlightRoubles: date="+date);
3859
3860@@ -375,6 +357,13 @@
3861 else return null;
3862 }
3863
3864+ public Object showFieldIfNotWaitlist(Block block, Object obj, Object objelse) {
3865+ if (block==null) return objelse;
3866+ if (block.getListClass()==null) return objelse;
3867+ if (block.getListClass().getParentClass()==null) return obj;
3868+ else return objelse;
3869+ }
3870+
3871 //==============================================================
3872 //сохранения услуги перелета при сохранении пассажира
3873
3874@@ -564,6 +553,7 @@
3875
3876 @Override
3877 protected void onPostAdd() {
3878+ utils.getLogger().debug("Passenger.onPostAdd called");
3879 CalendarDate cd = new CalendarDate(1900,1,1);
3880 setBirthday(cd.toDate(null));
3881 setActive(cd.toDate(null));
3882
3883=== modified file 'src/cbadmin/entity2/Payment.java'
3884--- src/cbadmin/entity2/Payment.java 2010-09-29 11:52:28 +0000
3885+++ src/cbadmin/entity2/Payment.java 2011-04-25 18:28:30 +0000
3886@@ -12,19 +12,24 @@
3887
3888
3889 /**
3890- * посчитать реальную оплату с учетом фиксированного курса и процентов
3891+ * посчитать реальную оплату с учетом фиксированного курса и процентов.
3892+ * Опционально берется либо только доход, либо доход с комиссией
3893 * @param parentcur - валюта родительского объекта. К ней считается кросскурс
3894 * @param outcur валюта результата
3895+ * @param addCommission true - присуммировать коммиссию посредника к доходу. При суммировании получается полная сумма, заплаченная клиентом
3896 * @return
3897 */
3898- public Double getPayed(ListCurrency parentcur, ListCurrency outcur) {
3899+ public Double getPayed(ListCurrency parentcur, ListCurrency outcur, boolean addCommission) {
3900 utils.getLogger().debug("PaymentDAO.getPayed "+parentcur.getAbbr()+", "+outcur.getAbbr());
3901 Date datepayment = getDatePayment();
3902 double payed=0;
3903
3904+ //сумма для конверсии
3905+ double summaPayed = getSummaPayed() + (addCommission ? getCommission().doubleValue() : 0);
3906+
3907 //валюта оплаты и вывода совпадает
3908 if (outcur.getId().equals(getListCurrency().getId())) {
3909- payed = getSummaPayed();
3910+ payed = summaPayed;
3911 utils.getLogger().debug("PaymentDAO.getPayed cur equals. returning "+payed);
3912 return payed;
3913 }
3914@@ -49,13 +54,13 @@
3915
3916 //если из рублей куда-то перевести, то учесть процент к ЦБ
3917 if (getListCurrency().getId().equals(CurrencyMgr.CURRENCY_ROUBLE_ID))
3918- temppayed = getSummaPayed() * crossrate / (1+getPluspercent()/100);
3919+ temppayed = summaPayed * crossrate / (1+getPluspercent()/100);
3920 //иначе учесть % к ЦБ в другую сторону
3921- else temppayed = getSummaPayed() * crossrate * (1+getPluspercent()/100);
3922- utils.getLogger().debug("PaymentDAO.getPayed SummaPayed="+getSummaPayed());
3923- utils.getLogger().debug("PaymentDAO.getPayed Pluspercent="+getPluspercent());
3924- utils.getLogger().debug("PaymentDAO.getPayed temppayed="+temppayed);
3925- utils.getLogger().debug("PaymentDAO.getPayed datepayment="+datepayment);
3926+ else temppayed = summaPayed * crossrate * (1+getPluspercent()/100);
3927+// utils.getLogger().debug("PaymentDAO.getPayed SummaPayed="+summaPayed);
3928+// utils.getLogger().debug("PaymentDAO.getPayed Pluspercent="+getPluspercent());
3929+// utils.getLogger().debug("PaymentDAO.getPayed temppayed="+temppayed);
3930+// utils.getLogger().debug("PaymentDAO.getPayed datepayment="+datepayment);
3931
3932 //double crossrate2 = CurrencyMgr.getCrossRate(curres.getId(), getListCurrency().getId(), datepayment);
3933 double crossrate2 = CurrencyMgr.getCrossRate(parentcur.getId(), outcur.getId(), datepayment);
3934@@ -69,6 +74,13 @@
3935 return payed;
3936 }
3937
3938+ /**
3939+ * сумма дохода и комиссии для безконверсии
3940+ */
3941+ public Double getPayedTotal() {
3942+ return getSummaPayed()+getCommission().doubleValue();
3943+ }
3944+
3945 //=======================================================
3946 //для шаблонов
3947 /**
3948@@ -86,7 +98,7 @@
3949 }
3950 else {
3951 //payed += getPayed(getObject().getListCurrency(), parentCurrency);
3952- payed += getPayed(parentCurrency, parentCurrency);
3953+ payed += getPayed(parentCurrency, parentCurrency, true);
3954 }
3955
3956 return payed;
3957@@ -105,12 +117,15 @@
3958 public Integer getJustRoubles() {
3959 if (getId()==null) throw new IllegalStateException("Not initialized.");
3960 double rub = 0;
3961- try {
3962- rub = CurrencyMgr.convert(getSummaPayed(), getListCurrency().getId(),
3963- CurrencyMgr.CURRENCY_ROUBLE_ID, getDatePayment());
3964- } catch (Exception ex) {
3965- utils.getLogger().error(ex);
3966- }
3967+
3968+ rub = getPayed(ListCurrency.load(CurrencyMgr.CURRENCY_ROUBLE_ID), ListCurrency.load(CurrencyMgr.CURRENCY_ROUBLE_ID), true);
3969+
3970+// try {
3971+// rub = CurrencyMgr.convert(getPayedTotal(), getListCurrency().getId(),
3972+// CurrencyMgr.CURRENCY_ROUBLE_ID, getDatePayment());
3973+// } catch (Exception ex) {
3974+// utils.getLogger().error(ex);
3975+// }
3976 return new Integer(new Double(rub).intValue());
3977 }
3978
3979@@ -121,12 +136,15 @@
3980 public Integer getJustKopeeks() {
3981 if (getId()==null) throw new IllegalStateException("Not initialized.");
3982 double rub = 0;
3983- try {
3984- rub = CurrencyMgr.convert(getSummaPayed(), getListCurrency().getId(),
3985- CurrencyMgr.CURRENCY_ROUBLE_ID, getDatePayment());
3986- } catch (Exception ex) {
3987- utils.getLogger().error(ex);
3988- }
3989+
3990+ rub = getPayed(ListCurrency.load(CurrencyMgr.CURRENCY_ROUBLE_ID), ListCurrency.load(CurrencyMgr.CURRENCY_ROUBLE_ID), true);
3991+
3992+// try {
3993+// rub = CurrencyMgr.convert(getPayedTotal(), getListCurrency().getId(),
3994+// CurrencyMgr.CURRENCY_ROUBLE_ID, getDatePayment());
3995+// } catch (Exception ex) {
3996+// utils.getLogger().error(ex);
3997+// }
3998 return new Integer(new Double((rub - new Double(rub).intValue())*100).intValue()) ;
3999 }
4000
4001@@ -140,15 +158,17 @@
4002 double rub = 0;
4003
4004 if (parentCurrency==null) {
4005- try {
4006- rub = CurrencyMgr.convert(getSummaPayed(), getListCurrency().getId(),
4007- CurrencyMgr.CURRENCY_ROUBLE_ID, getDatePayment());
4008- } catch (Exception ex) {
4009- utils.getLogger().error(ex);
4010- }
4011+ rub = getPayed(ListCurrency.load(CurrencyMgr.CURRENCY_ROUBLE_ID), ListCurrency.load(CurrencyMgr.CURRENCY_ROUBLE_ID), true);
4012+//
4013+// try {
4014+// rub = CurrencyMgr.convert(getSummaPayed(), getListCurrency().getId(),
4015+// CurrencyMgr.CURRENCY_ROUBLE_ID, getDatePayment());
4016+// } catch (Exception ex) {
4017+// utils.getLogger().error(ex);
4018+// }
4019 }
4020 else {
4021- rub = getPayed(parentCurrency, ListCurrency.load(CurrencyMgr.CURRENCY_ROUBLE_ID));
4022+ rub = getPayed(parentCurrency, ListCurrency.load(CurrencyMgr.CURRENCY_ROUBLE_ID), true);
4023 }
4024 return new Double(rub);
4025 }
4026@@ -186,6 +206,11 @@
4027 }
4028
4029 @Override
4030+ protected void onPostPersist() {
4031+ onPostUpdate(props, propnames, origvalues);
4032+ }
4033+
4034+ @Override
4035 protected void onPostLoad() {
4036 onPostLoad(props, origvalues);
4037 }
4038@@ -212,6 +237,7 @@
4039 Payment.SUMMA_PAYED_PROPERTY,
4040 Payment.LIST_CURRENCY_PROPERTY,
4041 Payment.LIST_PAY_METHOD_PROPERTY,
4042+ Payment.RESERVATION_PROPERTY
4043 };
4044
4045 String propnames[] = {
4046@@ -225,5 +251,6 @@
4047 "Сумма оплаты",
4048 "Валюта",
4049 "Метод оплаты",
4050+ "Заявка"
4051 };
4052 }
4053
4054=== modified file 'src/cbadmin/entity2/Reservation.java'
4055--- src/cbadmin/entity2/Reservation.java 2010-11-04 23:24:26 +0000
4056+++ src/cbadmin/entity2/Reservation.java 2011-04-25 18:28:30 +0000
4057@@ -4,6 +4,7 @@
4058 import cbadmin.util.CurrencyMgr;
4059 import cbadmin.util.PropertiesMgr;
4060 import cbadmin.util.utils;
4061+import java.text.SimpleDateFormat;
4062 import java.util.ArrayList;
4063 import java.util.Collection;
4064 import java.util.Comparator;
4065@@ -28,6 +29,28 @@
4066 else return "---";
4067 }
4068
4069+ @Override
4070+ public boolean save() {
4071+ //проверка на то, нужно ли номер для заявки прописывать
4072+ if (getNumber()==null || getNumber().isEmpty() || getNumber().startsWith("-")) { //нужен номер
4073+ //получить услуги
4074+ for (Service service : getServices()) {
4075+ if (service.isDeleted()) continue;
4076+ //AAAММГГ####
4077+ if (service.getListService().getId().equals(PropertiesMgr.getServiceAvia())) {
4078+ //это перелет, обрабатываем так
4079+ setNumber(getForeignCity()+(new SimpleDateFormat("MMyy").format(getDateFirstFlight()))+getId());
4080+ }
4081+ else {
4082+ setNumber("MOW"+(new SimpleDateFormat("MMyy").format(getDateReserved()))+getId());
4083+ }
4084+ break;
4085+ }
4086+ }
4087+
4088+ return super.save();
4089+ }
4090+
4091 /**
4092 * при неинициализированной брони getPassengers=null
4093 * @return
4094@@ -75,6 +98,16 @@
4095 }
4096 return min;
4097 }
4098+
4099+ @Override
4100+ public void setFrozen(Boolean frozen) {
4101+ if (frozen) setIsfrozen(new Byte("1"));
4102+ else setIsfrozen(new Byte("0"));
4103+ }
4104+ @Override
4105+ public boolean isFrozen() {
4106+ return (getIsfrozen()==1);
4107+ }
4108 //=================================================================
4109 //оплаченность
4110
4111@@ -89,28 +122,40 @@
4112 double payed = 0;
4113 List<Payment> pmnt = getPayments();
4114 for (Payment payment : pmnt) {
4115- if (payment.getDeletedate() != null) { continue; }
4116-
4117- //та же валюта. не надо конверсий
4118- if (curres.getId().equals(payment.getListCurrency().getId())) {
4119- payed += payment.getSummaPayed();
4120- utils.getLogger().debug("ReservationDAO.getSummaPayed equal cur. next payment");
4121- continue;
4122- }
4123-
4124- payed += payment.getPayed(getListCurrency(), curres);
4125-
4126- }
4127- utils.getLogger().debug("ReservationDAO.getSummaPayed return="+payed);
4128- return payed;
4129- }
4130-
4131- /**
4132- * сумма к оплате без учета услуг.
4133+ if (payment.isDeleted()) { continue; }
4134+
4135+ payed += payment.getPayed(getListCurrency(), curres, true);
4136+ }
4137+ utils.getLogger().debug("ReservationDAO.getSummaPayed return="+payed);
4138+ return payed;
4139+ }
4140+
4141+ /**
4142+ * оплаченная сумма в нужной валюте с учетом даты оплаты и типа оплаты и после вычета комиссии
4143+ * @param curres
4144+ * @return
4145+ */
4146+ public double getSummaPayedNoCommission(ListCurrency curres) {
4147+ if (getId()==null) return 0;
4148+ utils.getLogger().debug("ReservationDAO.getSummaPayed reservation="+getId()+", currency="+curres.getAbbr());
4149+ double payed = 0;
4150+ List<Payment> pmnt = getPayments();
4151+ for (Payment payment : pmnt) {
4152+ if (payment.isDeleted()) { continue; }
4153+
4154+ payed += payment.getPayed(getListCurrency(), curres, false);
4155+ }
4156+ utils.getLogger().debug("ReservationDAO.getSummaPayed return="+payed);
4157+ return payed;
4158+ }
4159+
4160+
4161+ /**
4162+ * сумма к оплате с учетом скидки.
4163 * @return
4164 */
4165 public double getSummaToPay() {
4166- return getSummaToPay(getListCurrency(), getDiscount());
4167+ return getSummaToPay(getListCurrency(), getDiscount(), null);
4168 }
4169
4170 /**
4171@@ -118,7 +163,7 @@
4172 * @param curres
4173 * @return
4174 */
4175- public double getSummaToPay(ListCurrency curres, int discountperc) {
4176+ public double getSummaToPay(ListCurrency curres, int discountperc, Date calcdate) {
4177 if (getId()==null) return 0;
4178 double total = 0; // на которую влияет скидка
4179 double totalNotAffected = 0; // на которую не влияет скидка
4180@@ -126,15 +171,15 @@
4181 double perctotalNotAffected = 0; // процент от заявки, на который не влияет скидка
4182 boolean isError = false;
4183
4184+ //выбираем какую дату брать
4185+ if (calcdate==null) calcdate = getReportDate();
4186+
4187 //добавляем услуги
4188 if (getServices()==null || getServices().isEmpty()) ;
4189 else {
4190 for (Service service : getServices()) {
4191- Date calcdate = new Date();
4192-
4193 if (service.getListService().isPercentOfTotal()) continue; //в этом прозоде не учитываем
4194 try {
4195- if (getBilldate()!=null) calcdate = getBilldate();
4196 if (service.getListService().isAffected())
4197 total += CurrencyMgr.convert(service.getSellprice()*service.getPax(), service.getListCurrency(), curres, calcdate);
4198 else
4199@@ -150,12 +195,9 @@
4200 if (isError) return -1; //ошибка случилась
4201
4202 for (Service service : getServices()) {
4203- Date calcdate = new Date();
4204-
4205 if (!service.getListService().isPercentOfTotal()) continue; //в этом прозоде учитываем
4206
4207 try {
4208- if (getBilldate()!=null) calcdate = getBilldate();
4209 if (service.getListService().isAffected())
4210 perctotal += (total+totalNotAffected)*service.getMarginpercent()/100;
4211 else
4212@@ -188,12 +230,34 @@
4213 }
4214
4215 /**
4216+ * Пересчет суммы оплаченного в рубли
4217+ * @return
4218+ */
4219+ public double getSummaPayedNoCommissionRoubles() {
4220+ if (getId()==null) throw new IllegalStateException("Not initialized.");
4221+ return Math.floor(getSummaPayedNoCommission(ListCurrency.load(CurrencyMgr.CURRENCY_ROUBLE_ID))*100)/100;
4222+ }
4223+
4224+ /**
4225 * сумма к оплате в рублях без учета услуг.
4226 * @return
4227 */
4228 public double getSummaToPayRoubles() {
4229- return getSummaToPay(ListCurrency.load(CurrencyMgr.CURRENCY_ROUBLE_ID), getDiscount());
4230- }
4231+ return Math.floor(
4232+ getSummaToPay(ListCurrency.load(CurrencyMgr.CURRENCY_ROUBLE_ID), getDiscount(), null)*(100+getPercentCommission())
4233+ )/100;
4234+ }
4235+
4236+ /**
4237+ * сумма к оплате в рублях без учета скидки.
4238+ * @return
4239+ */
4240+ public double getSummaToPayNoDiscountRoubles() {
4241+ return Math.floor(
4242+ getSummaToPay(ListCurrency.load(CurrencyMgr.CURRENCY_ROUBLE_ID), 0, null)*(100+getPercentCommission())
4243+ )/100;
4244+ }
4245+
4246
4247 /**
4248 * сумма к оплате в рублях прописью. копейки цифрами
4249@@ -243,7 +307,7 @@
4250 public boolean changeStatusAutomatic(){
4251 if (getId()==null) throw new IllegalStateException("Not initialized.");
4252 double payed = getSummaPayed(getListCurrency());
4253- double topay = getSummaToPay(getListCurrency(), getDiscount());
4254+ double topay = getSummaToPay(getListCurrency(), getDiscount(), null);
4255 int comparedmoney = utils.compareMoney(payed, topay); //сравнение оплаченного и к оплате
4256
4257 if (getListReservationStatus().getId().equals(RESERVATION_STATUS_NEW)) { //первое открытие заявки
4258@@ -251,14 +315,16 @@
4259 save();
4260 }
4261 else if (getListReservationStatus().getId().equals(RESERVATION_STATUS_INPROGRESS)) { //отправка подтверждения
4262- setListReservationStatus(ListReservationStatus.load(RESERVATION_STATUS_ACCEPTED));
4263+ if (topay!=0) setListReservationStatus(ListReservationStatus.load(RESERVATION_STATUS_ACCEPTED));
4264+ else setListReservationStatus(ListReservationStatus.load(RESERVATION_STATUS_PAYED));
4265 save();
4266 }
4267 else if (getListReservationStatus().getId().equals(RESERVATION_STATUS_ACCEPTED) ||
4268 getListReservationStatus().getId().equals(RESERVATION_STATUS_PREPAYED) ||
4269 getListReservationStatus().getId().equals(RESERVATION_STATUS_PAYED) ||
4270 getListReservationStatus().getId().equals(RESERVATION_STATUS_OVERPAYED) ) { //оплата прошла
4271- if (payed==0) setListReservationStatus(ListReservationStatus.load(RESERVATION_STATUS_ACCEPTED));
4272+ if (topay==0 && payed==0) setListReservationStatus(ListReservationStatus.load(RESERVATION_STATUS_PAYED));
4273+ else if(payed == 0) setListReservationStatus(ListReservationStatus.load(RESERVATION_STATUS_ACCEPTED));
4274 else if (comparedmoney<0) setListReservationStatus(ListReservationStatus.load(RESERVATION_STATUS_PREPAYED));
4275 else if (comparedmoney==0) setListReservationStatus(ListReservationStatus.load(RESERVATION_STATUS_PAYED));
4276 else setListReservationStatus(ListReservationStatus.load(RESERVATION_STATUS_OVERPAYED));
4277@@ -299,7 +365,7 @@
4278 double topay = 0;
4279 if (!(getListCurrency()==null)) {
4280 payed = getSummaPayed(getListCurrency());
4281- topay = getSummaToPay(getListCurrency(), getDiscount());
4282+ topay = getSummaToPay(getListCurrency(), getDiscount(), null);
4283 }
4284
4285 int comparedmoney = utils.compareMoney(payed, topay); //сравнение оплаченного и к оплате
4286@@ -399,6 +465,19 @@
4287 }
4288 else isSuccess = true;
4289 }
4290+ else if (status.equals(Reservation.RESERVATION_STATUS_VOIDED)) {
4291+ List<Service> services = getServices();
4292+ isSuccess = true;
4293+ if (services!=null) {
4294+ for(Service service : services)
4295+ if (!service.getPaymentsDone().isEmpty()) {
4296+ if (alert) JOptionPane.showMessageDialog(null, "В заявке есть услуги, по которым уже проведены оплаты поставщику.");
4297+ isSuccess = false;
4298+ break;
4299+ }
4300+ }
4301+ else isSuccess = true;
4302+ }
4303 else isSuccess = true;
4304 // if (status.equals(Reservation.RESERVATION_STATUS_MONEYBACK)) { isSuccess = true; }
4305 // if (status.equals(Reservation.RESERVATION_STATUS_VOIDED)) isSuccess = true;
4306@@ -406,6 +485,31 @@
4307 return isSuccess;
4308 }
4309
4310+ /**
4311+ * перевод заявки в статус "аннулирована"
4312+ * @return
4313+ */
4314+ public boolean doVoid() {
4315+ if (getId()==null) throw new IllegalStateException("Not initialized.");
4316+ if (!checkStatusChangePossible(Reservation.RESERVATION_STATUS_VOIDED, true)) return false;
4317+ for (Passenger pas : getPassengers()) {
4318+ if (!pas.isDeleted()) { pas.delete(); }
4319+ }
4320+ //удаляем услуги, не привязанные к пассажирам
4321+ List<Service> servs = getServices();
4322+ ArrayList<Service> services = new ArrayList();
4323+ services.addAll(servs);
4324+ for(Service service : services)
4325+ if (!service.isDeleted()) { service.delete(); }
4326+
4327+ //войдируем статус
4328+ setListReservationStatus(ListReservationStatus.load(Reservation.RESERVATION_STATUS_VOIDED));
4329+ boolean res = delete();
4330+ if (!res) utils.getContext().rollbackChanges();
4331+ return res;
4332+ }
4333+
4334+
4335 //----------------------------------------------------------------------------
4336
4337 /**
4338@@ -455,6 +559,7 @@
4339 //блоки
4340 /**
4341 * Основной блок, с которым связывается эта заявка. Берется по блоку первого неудаленного пассажира
4342+ * Сначала сортируются по убыванию по дате вылета
4343 * Применяется в финансовом отчете
4344 * Применяется при определении параметров рейса на вылет для заявки
4345 * @return
4346@@ -661,6 +766,10 @@
4347 }
4348 //=======================================================================
4349 //для шаблонов
4350+ /**
4351+ * контактный адрес в зависимости от типа заказчика
4352+ * @return
4353+ */
4354 public String getReservationClientAddress() {
4355 if (getReservationUl()!=null) {
4356 return getReservationUl().getOrgregAddress();
4357@@ -671,7 +780,10 @@
4358 return null;
4359 }
4360
4361-
4362+ /**
4363+ * имя контактного лица в зависимости от типа заказчика
4364+ * @return
4365+ */
4366 public String getContactname() {
4367 if (getId()==null) throw new IllegalStateException("Not initialized.");
4368 if (getReservationUl()!=null) {
4369@@ -685,6 +797,89 @@
4370 }
4371
4372 /**
4373+ * поставщик услуг в заявке. Имеет смысл когда перепродается чужой тур.
4374+ * Сначала ищет поставщика проживания. Если не найден, то первого встречного.
4375+ * Иначе null.
4376+ * @return
4377+ */
4378+ public ClientUl getVendor() {
4379+ if (getServices()==null || getServices().isEmpty()) ;
4380+ else {
4381+ for (Service service : getServices()) {
4382+ if (service.getListService().getId().equals(PropertiesMgr.getServiceAccomodation()))
4383+ return service.getVendor().getClientUl();
4384+ }
4385+ for (Service service : getServices()) return service.getVendor().getClientUl();
4386+ }
4387+ return null;
4388+ }
4389+
4390+ /**
4391+ * оплаты всем поставщикам услуг, кроме перелетов
4392+ * @return
4393+ */
4394+ public double getNonAviaVendorsPayedRoubles() {
4395+ double summa = 0;
4396+ for (Service service : getServices()) {
4397+ if (service.isDeleted()) continue;
4398+ if (!service.getListService().getId().equals(PropertiesMgr.getServiceAvia())) { //есть неперелетная услуга
4399+ if (service.getSummaToPayVendor()!=0)
4400+ summa += service.getSummaPayedVendor(ListCurrency.load(CurrencyMgr.CURRENCY_ROUBLE_ID));
4401+ }
4402+ }
4403+ return summa;
4404+ }
4405+
4406+ /**
4407+ * сумма к оплате всем поставщикам услуг, кроме перелетов
4408+ * @return
4409+ */
4410+ public double getNonAviaVendorsToPayRoubles() {
4411+ double summa = 0;
4412+ for (Service service : getServices()) {
4413+ if (service.isDeleted()) continue;
4414+ if (!service.getListService().getId().equals(PropertiesMgr.getServiceAvia())) { //есть неперелетная услуга
4415+ if (service.getSummaToPayVendor()!=0)
4416+ summa += service.getSummaToPayVendor(ListCurrency.load(CurrencyMgr.CURRENCY_ROUBLE_ID));
4417+ }
4418+ }
4419+ return summa;
4420+ }
4421+
4422+ /**
4423+ * сумма к оплате по всем перелетам в рублях с учетом скидки по заявке
4424+ * @return
4425+ */
4426+ public double getAviaVendorsToPayDiscountRoubles() {
4427+ double summa = 0;
4428+ for (Service service : getServices()) {
4429+ if (service.isDeleted()) continue;
4430+ if (!service.getListService().getId().equals(PropertiesMgr.getServiceAvia())) { //есть неперелетная услуга
4431+ if (service.getSummaToPayVendor()!=0)
4432+ summa += service.getSummaToPayVendor(ListCurrency.load(CurrencyMgr.CURRENCY_ROUBLE_ID));
4433+ }
4434+ }
4435+ return summa*((100-this.getDiscount()))/100;
4436+ }
4437+
4438+ /**
4439+ * сумма к оплате по всем перелетам в рублях с учетом скидки по заявке
4440+ * @return
4441+ */
4442+ public double getAviaVendorsToPayDiscount() {
4443+ double summa = 0;
4444+ for (Service service : getServices()) {
4445+ if (service.isDeleted()) continue;
4446+ if (!service.getListService().getId().equals(PropertiesMgr.getServiceAvia())) { //есть неперелетная услуга
4447+ if (service.getSummaToPayVendor()!=0)
4448+ summa += service.getSummaToPayVendor(this.getListCurrency());
4449+ }
4450+ }
4451+ return summa*((100-this.getDiscount()))/100;
4452+ }
4453+
4454+
4455+ /**
4456 * Получить все оплаты в Payment, без удаленных
4457 * @return
4458 */
4459@@ -718,11 +913,47 @@
4460
4461
4462 /**
4463- * сумма к оплате без учета услуг.
4464+ * сумма к оплате в валюте без учета скидки.
4465 * @return
4466 */
4467 public double getSummaToPayNoDiscount() {
4468- return getSummaToPay(getListCurrency(), 0);
4469+ return getSummaToPay(getListCurrency(), 0, null);
4470+ }
4471+
4472+ /**
4473+ * для договора
4474+ * @return
4475+ */
4476+ public String getPassengersDetailed() {
4477+ utils.getLogger().debug("getPassengersDetailed called");
4478+ String result = "";
4479+ SimpleDateFormat sdf = new SimpleDateFormat("dd.MM.yyyy");
4480+ for(Passenger pass : getNonDeletedPassengers() ) {
4481+ String bd = "";
4482+ try { bd = sdf.format(pass.getBirthday()); }
4483+ catch (Exception ex) { bd="---"; }
4484+
4485+ String ac = "";
4486+ try { ac = sdf.format(pass.getActive()); }
4487+ catch (Exception ex) { ac="---"; }
4488+
4489+ result += pass.getFamily()+" "+pass.getName()+" | "+bd+" | "+pass.getSerial()+" | "+ac+"\n";
4490+ }
4491+ return result;
4492+ }
4493+
4494+ /**
4495+ * Дата, на которую надо пересчитывать суммы к оплате
4496+ * зависит от даты подтверждения или счета, в зависимости от настроек
4497+ * если нет ни того ни другого, то на сегодня
4498+ */
4499+ public Date getReportDate() {
4500+ Date calcdate = new Date();
4501+ if (!PropertiesMgr.getProperty("useConfirmdate", PropertiesMgr.PROP_NOT_EXIST).equals(PropertiesMgr.PROP_NOT_EXIST))
4502+ calcdate = getDateConfirm();
4503+ else calcdate = getDateBill();
4504+ if (calcdate==null) calcdate = new Date();
4505+ return calcdate;
4506 }
4507 //===================================================================================
4508
4509@@ -748,6 +979,7 @@
4510 */
4511 @Override
4512 protected void onPostAdd() {
4513+ utils.getLogger().debug("Reservation.onPostAdd called");
4514 setIdOffer(0);
4515 setSummaReserved(0);
4516 setSummaPayed(0);
4517@@ -788,7 +1020,7 @@
4518 HashMap origvalues = new HashMap();
4519
4520 String props[] = {
4521- Reservation.BILLDATE_PROPERTY,
4522+ Reservation.DATE_BILL_PROPERTY,
4523 Reservation.COMMENT_PROPERTY,
4524 Reservation.DATE_RESERVED_PROPERTY,
4525 Reservation.DELETEDATE_PROPERTY,
4526@@ -798,10 +1030,10 @@
4527 Reservation.FAX_PROPERTY,
4528 Reservation.ICQ_PROPERTY,
4529 Reservation.ISFROZEN_PROPERTY,
4530- Reservation.PAY_DATE_PROPERTY,
4531+ Reservation.DATE_PAY_PROPERTY,
4532 Reservation.PERCENT_COMMISSION_PROPERTY,
4533 Reservation.PHONE_PROPERTY,
4534- Reservation.PREPAY_DATE_PROPERTY,
4535+ Reservation.DATE_PREPAY_PROPERTY,
4536 Reservation.SUMMA_RESERVED_PROPERTY,
4537 Reservation.CLIENT_PROPERTY,
4538 Reservation.LIST_COUNTRY_PROPERTY,
4539@@ -812,7 +1044,8 @@
4540 Reservation.RESERVATION_FL_PROPERTY,
4541 Reservation.RESERVATION_UL_PROPERTY,
4542 Reservation.USER_PROPERTY,
4543- Reservation.PERCENT_COMMISSION_PROPERTY
4544+ Reservation.PERCENT_COMMISSION_PROPERTY,
4545+ Reservation.DATE_CONFIRM_PROPERTY
4546 };
4547
4548 String propnames[] = {
4549@@ -840,8 +1073,8 @@
4550 "Физлицо",
4551 "Юрлицо",
4552 "Менеджер",
4553- "Процент комиссии"
4554-
4555+ "Процент комиссии",
4556+ "Дата подтверждения"
4557 };
4558
4559 }
4560
4561=== modified file 'src/cbadmin/entity2/ReservationUl.java'
4562--- src/cbadmin/entity2/ReservationUl.java 2010-11-04 23:24:26 +0000
4563+++ src/cbadmin/entity2/ReservationUl.java 2011-04-25 18:28:30 +0000
4564@@ -66,6 +66,7 @@
4565 copy.setOrgname(this.getOrgname());
4566 copy.setOrgpostAddress(this.getOrgpostAddress());
4567 copy.setOrgregAddress(this.getOrgregAddress());
4568+ copy.setGendir(this.getGendir());
4569 copy.setIsVendor(this.getIsVendor());
4570
4571 return copy;
4572
4573=== modified file 'src/cbadmin/entity2/Service.java'
4574--- src/cbadmin/entity2/Service.java 2010-09-29 11:52:28 +0000
4575+++ src/cbadmin/entity2/Service.java 2011-04-25 18:28:30 +0000
4576@@ -30,6 +30,16 @@
4577 else return null;
4578 }
4579
4580+ /**
4581+ * если нет описания услуги, то подставлять её тип
4582+ * @return
4583+ */
4584+ public String getDescription() {
4585+ if (super.getName().trim().equals("---") || super.getName().trim().isEmpty())
4586+ return getListService().getName();
4587+ else return super.getName().trim();
4588+ }
4589+
4590 public void setAutomatic(boolean automatic) {
4591 if (automatic) setAutomatic(new Byte(new Integer(1).byteValue()));
4592 else setAutomatic(new Byte(new Integer(0).byteValue()));
4593@@ -147,7 +157,7 @@
4594 continue;
4595 }
4596 else
4597- payed += payment.getPayed(getListCurrency(), curres)*part;
4598+ payed += payment.getPayed(getListCurrency(), curres, true)*part;
4599 }
4600 utils.getLogger().info("getSummaPayed: summa="+payed);
4601 return payed;
4602
4603=== modified file 'src/cbadmin/entity2/ServicePrice.java'
4604--- src/cbadmin/entity2/ServicePrice.java 2010-08-09 04:15:09 +0000
4605+++ src/cbadmin/entity2/ServicePrice.java 2011-04-25 18:28:30 +0000
4606@@ -1,9 +1,10 @@
4607 package cbadmin.entity2;
4608
4609+import cbadmin.business.PriceInterface;
4610 import cbadmin.entity2.auto._ServicePrice;
4611 import java.util.Date;
4612
4613-public class ServicePrice extends _ServicePrice {
4614+public class ServicePrice extends _ServicePrice implements PriceInterface {
4615
4616 @Override
4617 public void setDeletedate(Date d) {
4618@@ -20,4 +21,21 @@
4619 return null;
4620 }
4621
4622+ @Override
4623+ public ServicePrice clone() {
4624+ ServicePrice per = new ServicePrice();
4625+ per.setBuyprice(getBuyprice());
4626+ per.setMarginfix(getMarginfix());
4627+ per.setMarginpercent(getMarginpercent());
4628+ per.setSellprice(getSellprice());
4629+ per.setDateFrom(getDateFrom());
4630+ per.setDateTo(getDateTo());
4631+ per.setListCurrency(getListCurrency());
4632+ per.setListService(getListService());
4633+ per.setListCountry(getListCountry());
4634+ per.setVendor(getVendor());
4635+ per.setListAge(getListAge());
4636+ per.setPeriod(getPeriod());
4637+ return per;
4638+ }
4639 }
4640
4641=== modified file 'src/cbadmin/entity2/auto/_Block.java'
4642--- src/cbadmin/entity2/auto/_Block.java 2010-06-01 20:53:46 +0000
4643+++ src/cbadmin/entity2/auto/_Block.java 2011-04-25 18:28:30 +0000
4644@@ -1,5 +1,6 @@
4645 package cbadmin.entity2.auto;
4646
4647+import java.util.Date;
4648 import java.util.List;
4649
4650 import cbadmin.entity2.Client;
4651@@ -19,6 +20,7 @@
4652 public abstract class _Block extends db_interface {
4653
4654 public static final String CAPACITY_PROPERTY = "capacity";
4655+ public static final String DELETEDATE_PROPERTY = "deletedate";
4656 public static final String PRICE_PROPERTY = "price";
4657 public static final String FLIGHT_PROPERTY = "flight";
4658 public static final String LIST_CLASS_PROPERTY = "listClass";
4659@@ -30,12 +32,19 @@
4660
4661 public static final String ID_PK_COLUMN = "id";
4662
4663- public void setCapacity(short capacity) {
4664+ public void setCapacity(int capacity) {
4665 writeProperty("capacity", capacity);
4666 }
4667- public short getCapacity() {
4668+ public int getCapacity() {
4669 Object value = readProperty("capacity");
4670- return (value != null) ? (Short) value : 0;
4671+ return (value != null) ? (Integer) value : 0;
4672+ }
4673+
4674+ public void setDeletedate(Date deletedate) {
4675+ writeProperty("deletedate", deletedate);
4676+ }
4677+ public Date getDeletedate() {
4678+ return (Date)readProperty("deletedate");
4679 }
4680
4681 public void setPrice(float price) {
4682@@ -118,6 +127,8 @@
4683 }
4684
4685
4686+ protected abstract void onPostAdd();
4687+
4688 protected abstract void onPostUpdate();
4689
4690 protected abstract void onPostLoad();
4691
4692=== modified file 'src/cbadmin/entity2/auto/_Client.java'
4693--- src/cbadmin/entity2/auto/_Client.java 2010-08-25 07:05:29 +0000
4694+++ src/cbadmin/entity2/auto/_Client.java 2011-04-25 18:28:30 +0000
4695@@ -30,6 +30,7 @@
4696 public static final String DISCOUNT_PROPERTY = "discount";
4697 public static final String FAX_PROPERTY = "fax";
4698 public static final String ICQ_PROPERTY = "icq";
4699+ public static final String ID_KEY_PROPERTY = "id_key";
4700 public static final String IS_VENDOR_PROPERTY = "isVendor";
4701 public static final String NAME_PROPERTY = "name";
4702 public static final String PASSWORD_PROPERTY = "password";
4703@@ -104,6 +105,13 @@
4704 return (String)readProperty("icq");
4705 }
4706
4707+ public void setId_key(Long id_key) {
4708+ writeProperty("id_key", id_key);
4709+ }
4710+ public Long getId_key() {
4711+ return (Long)readProperty("id_key");
4712+ }
4713+
4714 public void setIsVendor(Byte isVendor) {
4715 writeProperty("isVendor", isVendor);
4716 }
4717
4718=== modified file 'src/cbadmin/entity2/auto/_ClientFl.java'
4719--- src/cbadmin/entity2/auto/_ClientFl.java 2010-05-27 16:30:42 +0000
4720+++ src/cbadmin/entity2/auto/_ClientFl.java 2011-04-25 18:28:30 +0000
4721@@ -25,6 +25,7 @@
4722 public static final String CONTACT_PASSPORT_PROPERTY = "contactPassport";
4723 public static final String CONTACT_PATRONYMIC_PROPERTY = "contactPatronymic";
4724 public static final String CONTACT_REG_ADDRESS_PROPERTY = "contactRegAddress";
4725+ public static final String ID_KEY_PROPERTY = "id_key";
4726 public static final String PASSPORTZ_PROPERTY = "passportz";
4727 public static final String SEX_PROPERTY = "sex";
4728 public static final String CLIENT_PROPERTY = "client";
4729@@ -109,6 +110,13 @@
4730 return (String)readProperty("contactRegAddress");
4731 }
4732
4733+ public void setId_key(Long id_key) {
4734+ writeProperty("id_key", id_key);
4735+ }
4736+ public Long getId_key() {
4737+ return (Long)readProperty("id_key");
4738+ }
4739+
4740 public void setPassportz(String passportz) {
4741 writeProperty("passportz", passportz);
4742 }
4743
4744=== modified file 'src/cbadmin/entity2/auto/_ClientUl.java'
4745--- src/cbadmin/entity2/auto/_ClientUl.java 2010-05-28 14:23:00 +0000
4746+++ src/cbadmin/entity2/auto/_ClientUl.java 2011-04-25 18:28:30 +0000
4747@@ -13,6 +13,7 @@
4748 */
4749 public abstract class _ClientUl extends db_interface {
4750
4751+ public static final String GENDIR_PROPERTY = "gendir";
4752 public static final String ORGAGREE_DATE_PROPERTY = "orgagreeDate";
4753 public static final String ORGAGREE_END_PROPERTY = "orgagreeEnd";
4754 public static final String ORGAGREE_NUM_PROPERTY = "orgagreeNum";
4755@@ -31,6 +32,13 @@
4756
4757 public static final String ID_CLIENT_PK_COLUMN = "id_client";
4758
4759+ public void setGendir(String gendir) {
4760+ writeProperty("gendir", gendir);
4761+ }
4762+ public String getGendir() {
4763+ return (String)readProperty("gendir");
4764+ }
4765+
4766 public void setOrgagreeDate(Date orgagreeDate) {
4767 writeProperty("orgagreeDate", orgagreeDate);
4768 }
4769
4770=== modified file 'src/cbadmin/entity2/auto/_FlightProgram.java'
4771--- src/cbadmin/entity2/auto/_FlightProgram.java 2010-04-09 06:21:55 +0000
4772+++ src/cbadmin/entity2/auto/_FlightProgram.java 2011-04-25 18:28:30 +0000
4773@@ -4,6 +4,7 @@
4774 import java.util.List;
4775
4776 import cbadmin.entity2.Flight;
4777+import cbadmin.entity2.FlightProgram;
4778 import cbadmin.entity2.FlightProgramPeriods;
4779 import cbadmin.entity2.ListAirline;
4780 import cbadmin.entity2.ListAirport;
4781@@ -19,7 +20,8 @@
4782
4783 public static final String DELETEDATE_PROPERTY = "deletedate";
4784 public static final String FLIGHT_NUM_PROPERTY = "flightNum";
4785- public static final String FLIGHT_PROGRAM_PERIODSES_PROPERTY = "flightProgramPeriodses";
4786+ public static final String FLIGHT_PROGRAM_PAIRED_PROPERTY = "flightProgramPaired";
4787+ public static final String FLIGHT_PROGRAM_PERIODS_PROPERTY = "flightProgramPeriods";
4788 public static final String FLIGHTS_PROPERTY = "flights";
4789 public static final String LIST_AIRLINE_PROPERTY = "listAirline";
4790 public static final String LIST_AIRPORT_BY_ID_AIRPORT_FROM_PROPERTY = "listAirportByIdAirportFrom";
4791@@ -41,15 +43,24 @@
4792 return (String)readProperty("flightNum");
4793 }
4794
4795- public void addToFlightProgramPeriodses(FlightProgramPeriods obj) {
4796- addToManyTarget("flightProgramPeriodses", obj, true);
4797- }
4798- public void removeFromFlightProgramPeriodses(FlightProgramPeriods obj) {
4799- removeToManyTarget("flightProgramPeriodses", obj, true);
4800+ public void setFlightProgramPaired(FlightProgram flightProgramPaired) {
4801+ setToOneTarget("flightProgramPaired", flightProgramPaired, true);
4802+ }
4803+
4804+ public FlightProgram getFlightProgramPaired() {
4805+ return (FlightProgram)readProperty("flightProgramPaired");
4806+ }
4807+
4808+
4809+ public void addToFlightProgramPeriods(FlightProgramPeriods obj) {
4810+ addToManyTarget("flightProgramPeriods", obj, true);
4811+ }
4812+ public void removeFromFlightProgramPeriods(FlightProgramPeriods obj) {
4813+ removeToManyTarget("flightProgramPeriods", obj, true);
4814 }
4815 @SuppressWarnings("unchecked")
4816- public List<FlightProgramPeriods> getFlightProgramPeriodses() {
4817- return (List<FlightProgramPeriods>)readProperty("flightProgramPeriodses");
4818+ public List<FlightProgramPeriods> getFlightProgramPeriods() {
4819+ return (List<FlightProgramPeriods>)readProperty("flightProgramPeriods");
4820 }
4821
4822
4823
4824=== modified file 'src/cbadmin/entity2/auto/_ListAge.java'
4825--- src/cbadmin/entity2/auto/_ListAge.java 2010-09-21 14:26:29 +0000
4826+++ src/cbadmin/entity2/auto/_ListAge.java 2011-04-25 18:28:30 +0000
4827@@ -27,18 +27,20 @@
4828
4829 public static final String ID_PK_COLUMN = "id";
4830
4831- public void setAgefrom(Byte agefrom) {
4832+ public void setAgefrom(int agefrom) {
4833 writeProperty("agefrom", agefrom);
4834 }
4835- public Byte getAgefrom() {
4836- return (Byte)readProperty("agefrom");
4837+ public int getAgefrom() {
4838+ Object value = readProperty("agefrom");
4839+ return (value != null) ? (Integer) value : 0;
4840 }
4841
4842- public void setAgeto(Byte ageto) {
4843+ public void setAgeto(int ageto) {
4844 writeProperty("ageto", ageto);
4845 }
4846- public Byte getAgeto() {
4847- return (Byte)readProperty("ageto");
4848+ public int getAgeto() {
4849+ Object value = readProperty("ageto");
4850+ return (value != null) ? (Integer) value : 0;
4851 }
4852
4853 public void setDeletedate(Date deletedate) {
4854@@ -55,25 +57,28 @@
4855 return (Byte)readProperty("frozen");
4856 }
4857
4858- public void setIsAdult(Byte isAdult) {
4859+ public void setIsAdult(int isAdult) {
4860 writeProperty("isAdult", isAdult);
4861 }
4862- public Byte getIsAdult() {
4863- return (Byte)readProperty("isAdult");
4864+ public int getIsAdult() {
4865+ Object value = readProperty("isAdult");
4866+ return (value != null) ? (Integer) value : 0;
4867 }
4868
4869- public void setIsChild(Byte isChild) {
4870+ public void setIsChild(int isChild) {
4871 writeProperty("isChild", isChild);
4872 }
4873- public Byte getIsChild() {
4874- return (Byte)readProperty("isChild");
4875+ public int getIsChild() {
4876+ Object value = readProperty("isChild");
4877+ return (value != null) ? (Integer) value : 0;
4878 }
4879
4880- public void setIsInfant(Byte isInfant) {
4881+ public void setIsInfant(int isInfant) {
4882 writeProperty("isInfant", isInfant);
4883 }
4884- public Byte getIsInfant() {
4885- return (Byte)readProperty("isInfant");
4886+ public int getIsInfant() {
4887+ Object value = readProperty("isInfant");
4888+ return (value != null) ? (Integer) value : 0;
4889 }
4890
4891 public void setName(String name) {
4892
4893=== modified file 'src/cbadmin/entity2/auto/_ListCountry.java'
4894--- src/cbadmin/entity2/auto/_ListCountry.java 2010-08-25 07:05:29 +0000
4895+++ src/cbadmin/entity2/auto/_ListCountry.java 2011-04-25 18:28:30 +0000
4896@@ -5,6 +5,7 @@
4897
4898 import cbadmin.entity2.ListAirline;
4899 import cbadmin.entity2.ListCity;
4900+import cbadmin.entity2.ListCurrency;
4901 import cbadmin.entity2.Reservation;
4902 import cbadmin.entity2.ServicePrice;
4903 import cbadmin.entity2.VendorPreferred;
4904@@ -24,6 +25,7 @@
4905 public static final String WEBSHOW_PROPERTY = "webshow";
4906 public static final String LIST_AIRLINES_PROPERTY = "listAirlines";
4907 public static final String LIST_CITIES_PROPERTY = "listCities";
4908+ public static final String PREFERRED_CURRENCY_PROPERTY = "preferredCurrency";
4909 public static final String RESERVATIONS_PROPERTY = "reservations";
4910 public static final String SERVICE_PRICE_ARRAY_PROPERTY = "servicePriceArray";
4911 public static final String VENDOR_PREFERRED_ARRAY_PROPERTY = "vendorPreferredArray";
4912@@ -82,6 +84,15 @@
4913 }
4914
4915
4916+ public void setPreferredCurrency(ListCurrency preferredCurrency) {
4917+ setToOneTarget("preferredCurrency", preferredCurrency, true);
4918+ }
4919+
4920+ public ListCurrency getPreferredCurrency() {
4921+ return (ListCurrency)readProperty("preferredCurrency");
4922+ }
4923+
4924+
4925 public void addToReservations(Reservation obj) {
4926 addToManyTarget("reservations", obj, true);
4927 }
4928
4929=== added file 'src/cbadmin/entity2/auto/_ListEmail.java'
4930--- src/cbadmin/entity2/auto/_ListEmail.java 1970-01-01 00:00:00 +0000
4931+++ src/cbadmin/entity2/auto/_ListEmail.java 2011-04-25 18:28:30 +0000
4932@@ -0,0 +1,67 @@
4933+package cbadmin.entity2.auto;
4934+
4935+import java.util.Date;
4936+
4937+import cbadmin.entity2.db_interface;
4938+
4939+/**
4940+ * Class _ListEmail was generated by Cayenne.
4941+ * It is probably a good idea to avoid changing this class manually,
4942+ * since it may be overwritten next time code is regenerated.
4943+ * If you need to make any customizations, please use subclass.
4944+ */
4945+public abstract class _ListEmail extends db_interface {
4946+
4947+ public static final String CLIENT_TYPE_PROPERTY = "clientType";
4948+ public static final String DELETEDATE_PROPERTY = "deletedate";
4949+ public static final String EMAIL_BODY_PROPERTY = "emailBody";
4950+ public static final String EMAIL_SUBJECT_PROPERTY = "emailSubject";
4951+ public static final String FROZEN_PROPERTY = "frozen";
4952+ public static final String NAME_PROPERTY = "name";
4953+
4954+ public static final String ID_PK_COLUMN = "id";
4955+
4956+ public void setClientType(int clientType) {
4957+ writeProperty("clientType", clientType);
4958+ }
4959+ public int getClientType() {
4960+ Object value = readProperty("clientType");
4961+ return (value != null) ? (Integer) value : 0;
4962+ }
4963+
4964+ public void setDeletedate(Date deletedate) {
4965+ writeProperty("deletedate", deletedate);
4966+ }
4967+ public Date getDeletedate() {
4968+ return (Date)readProperty("deletedate");
4969+ }
4970+
4971+ public void setEmailBody(String emailBody) {
4972+ writeProperty("emailBody", emailBody);
4973+ }
4974+ public String getEmailBody() {
4975+ return (String)readProperty("emailBody");
4976+ }
4977+
4978+ public void setEmailSubject(String emailSubject) {
4979+ writeProperty("emailSubject", emailSubject);
4980+ }
4981+ public String getEmailSubject() {
4982+ return (String)readProperty("emailSubject");
4983+ }
4984+
4985+ public void setFrozen(Byte frozen) {
4986+ writeProperty("frozen", frozen);
4987+ }
4988+ public Byte getFrozen() {
4989+ return (Byte)readProperty("frozen");
4990+ }
4991+
4992+ public void setName(String name) {
4993+ writeProperty("name", name);
4994+ }
4995+ public String getName() {
4996+ return (String)readProperty("name");
4997+ }
4998+
4999+}
5000
The diff has been truncated for viewing.

Subscribers

People subscribed via source and target branches

to all changes: