copia do projeto scia
git-svn-id: http://desenvolvimento.rjconsultores.com.br/repositorio/sco/AdmVenta/Web/trunk/ventaboletos@19145 d1611594-4594-4d17-8e1d-87c2c4800839master
commit
fe0ce5adbd
|
@ -0,0 +1,109 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<classpath>
|
||||||
|
<classpathentry kind="src" path="src/java"/>
|
||||||
|
<classpathentry kind="con" path="org.eclipse.jst.j2ee.internal.web.container"/>
|
||||||
|
<classpathentry kind="con" path="org.eclipse.jst.j2ee.internal.module.container"/>
|
||||||
|
<classpathentry kind="lib" path="/LibreriasAdmVenta/antlr-2.7.6.jar"/>
|
||||||
|
<classpathentry kind="lib" path="/LibreriasAdmVenta/aopalliance-1.0.jar"/>
|
||||||
|
<classpathentry kind="lib" path="/LibreriasAdmVenta/asm-attrs.jar"/>
|
||||||
|
<classpathentry kind="lib" path="/LibreriasAdmVenta/asm.jar"/>
|
||||||
|
<classpathentry kind="lib" path="/LibreriasAdmVenta/aspectjrt-1.5.4.jar"/>
|
||||||
|
<classpathentry kind="lib" path="/LibreriasAdmVenta/brazilutils-0.1.1.jar"/>
|
||||||
|
<classpathentry kind="lib" path="/LibreriasAdmVenta/bsh.jar"/>
|
||||||
|
<classpathentry kind="lib" path="/LibreriasAdmVenta/c3p0-0.9.1.jar"/>
|
||||||
|
<classpathentry kind="lib" path="/LibreriasAdmVenta/cglib-nodep-2.1_3.jar"/>
|
||||||
|
<classpathentry kind="lib" path="/LibreriasAdmVenta/com.springsource.org.aopalliance-1.0.0.jar"/>
|
||||||
|
<classpathentry kind="lib" path="/LibreriasAdmVenta/commons-beanutils-1.8.2.jar"/>
|
||||||
|
<classpathentry kind="lib" path="/LibreriasAdmVenta/commons-codec-1.3.jar"/>
|
||||||
|
<classpathentry kind="lib" path="/LibreriasAdmVenta/commons-collections-3.2.1.jar"/>
|
||||||
|
<classpathentry kind="lib" path="/LibreriasAdmVenta/commons-digester-1.7.jar"/>
|
||||||
|
<classpathentry kind="lib" path="/LibreriasAdmVenta/commons-fileupload.jar"/>
|
||||||
|
<classpathentry kind="lib" path="/LibreriasAdmVenta/commons-io.jar"/>
|
||||||
|
<classpathentry kind="lib" path="/LibreriasAdmVenta/commons-lang.jar"/>
|
||||||
|
<classpathentry kind="lib" path="/LibreriasAdmVenta/commons-logging-1.1.1.jar"/>
|
||||||
|
<classpathentry kind="lib" path="/LibreriasAdmVenta/dom4j-1.6.1.jar"/>
|
||||||
|
<classpathentry kind="lib" path="/LibreriasAdmVenta/ehcache-1.2.3.jar"/>
|
||||||
|
<classpathentry kind="lib" path="/LibreriasAdmVenta/ejb3-persistence.jar"/>
|
||||||
|
<classpathentry kind="lib" path="/LibreriasAdmVenta/fckez.jar"/>
|
||||||
|
<classpathentry kind="lib" path="/LibreriasAdmVenta/hibernate-annotations.jar"/>
|
||||||
|
<classpathentry kind="lib" path="/LibreriasAdmVenta/hibernate-commons-annotations.jar"/>
|
||||||
|
<classpathentry kind="lib" path="/LibreriasAdmVenta/hibernate-entitymanager.jar"/>
|
||||||
|
<classpathentry kind="lib" path="/LibreriasAdmVenta/hibernate-tools.jar"/>
|
||||||
|
<classpathentry kind="lib" path="/LibreriasAdmVenta/hibernate3.jar"/>
|
||||||
|
<classpathentry kind="lib" path="/LibreriasAdmVenta/iText-2.1.7.jar"/>
|
||||||
|
<classpathentry kind="lib" path="/LibreriasAdmVenta/javassist-3.9.0.GA.jar"/>
|
||||||
|
<classpathentry kind="lib" path="/LibreriasAdmVenta/jcommon.jar"/>
|
||||||
|
<classpathentry kind="lib" path="/LibreriasAdmVenta/jdbc2_0-stdext.jar"/>
|
||||||
|
<classpathentry kind="lib" path="/LibreriasAdmVenta/js.jar"/>
|
||||||
|
<classpathentry kind="lib" path="/LibreriasAdmVenta/jstl-1.1.2.jar"/>
|
||||||
|
<classpathentry kind="lib" path="/LibreriasAdmVenta/jta-1.1.jar"/>
|
||||||
|
<classpathentry kind="lib" path="/LibreriasAdmVenta/jta.jar"/>
|
||||||
|
<classpathentry kind="lib" path="/LibreriasAdmVenta/jtds-1.2.5.jar"/>
|
||||||
|
<classpathentry kind="lib" path="/LibreriasAdmVenta/jxl.jar"/>
|
||||||
|
<classpathentry kind="lib" path="/LibreriasAdmVenta/log4j-1.2.16.jar"/>
|
||||||
|
<classpathentry kind="lib" path="/LibreriasAdmVenta/mvel.jar"/>
|
||||||
|
<classpathentry kind="lib" path="/LibreriasAdmVenta/ognl.jar"/>
|
||||||
|
<classpathentry kind="lib" path="/LibreriasAdmVenta/ojdbc6_g.jar"/>
|
||||||
|
<classpathentry kind="lib" path="/LibreriasAdmVenta/portlet-api.jar"/>
|
||||||
|
<classpathentry kind="lib" path="/LibreriasAdmVenta/quartz-all-1.6.5.jar"/>
|
||||||
|
<classpathentry kind="lib" path="/LibreriasAdmVenta/silvergray.jar"/>
|
||||||
|
<classpathentry kind="lib" path="/LibreriasAdmVenta/slf4j-api-1.6.1.jar"/>
|
||||||
|
<classpathentry kind="lib" path="/LibreriasAdmVenta/slf4j-log4j12-1.6.1.jar"/>
|
||||||
|
<classpathentry kind="lib" path="/LibreriasAdmVenta/standard-1.1.2.jar"/>
|
||||||
|
<classpathentry kind="lib" path="/LibreriasAdmVenta/trg-search-0.4.3.jar"/>
|
||||||
|
<classpathentry kind="lib" path="/LibreriasAdmVenta/zcommon.jar"/>
|
||||||
|
<classpathentry kind="lib" path="/LibreriasAdmVenta/zcommons-el.jar"/>
|
||||||
|
<classpathentry kind="lib" path="/LibreriasAdmVenta/zhtml.jar"/>
|
||||||
|
<classpathentry kind="lib" path="/LibreriasAdmVenta/zk.jar"/>
|
||||||
|
<classpathentry kind="lib" path="/LibreriasAdmVenta/zkplus.jar"/>
|
||||||
|
<classpathentry kind="lib" path="/LibreriasAdmVenta/zul.jar"/>
|
||||||
|
<classpathentry kind="lib" path="/LibreriasAdmVenta/zweb.jar"/>
|
||||||
|
<classpathentry kind="lib" path="/LibreriasAdmVenta/org.springframework.aop-3.0.6.RELEASE.jar"/>
|
||||||
|
<classpathentry kind="lib" path="/LibreriasAdmVenta/org.springframework.asm-3.0.6.RELEASE.jar"/>
|
||||||
|
<classpathentry kind="lib" path="/LibreriasAdmVenta/org.springframework.aspects-3.0.6.RELEASE.jar"/>
|
||||||
|
<classpathentry kind="lib" path="/LibreriasAdmVenta/org.springframework.beans-3.0.6.RELEASE.jar"/>
|
||||||
|
<classpathentry kind="lib" path="/LibreriasAdmVenta/org.springframework.context-3.0.6.RELEASE.jar"/>
|
||||||
|
<classpathentry kind="lib" path="/LibreriasAdmVenta/org.springframework.context.support-3.0.6.RELEASE.jar"/>
|
||||||
|
<classpathentry kind="lib" path="/LibreriasAdmVenta/org.springframework.core-3.0.6.RELEASE.jar"/>
|
||||||
|
<classpathentry kind="lib" path="/LibreriasAdmVenta/org.springframework.expression-3.0.6.RELEASE.jar"/>
|
||||||
|
<classpathentry kind="lib" path="/LibreriasAdmVenta/org.springframework.instrument-3.0.6.RELEASE.jar"/>
|
||||||
|
<classpathentry kind="lib" path="/LibreriasAdmVenta/org.springframework.instrument.tomcat-3.0.6.RELEASE.jar"/>
|
||||||
|
<classpathentry kind="lib" path="/LibreriasAdmVenta/org.springframework.jdbc-3.0.6.RELEASE.jar"/>
|
||||||
|
<classpathentry kind="lib" path="/LibreriasAdmVenta/org.springframework.jms-3.0.6.RELEASE.jar"/>
|
||||||
|
<classpathentry kind="lib" path="/LibreriasAdmVenta/org.springframework.orm-3.0.6.RELEASE.jar"/>
|
||||||
|
<classpathentry kind="lib" path="/LibreriasAdmVenta/org.springframework.oxm-3.0.6.RELEASE.jar"/>
|
||||||
|
<classpathentry kind="lib" path="/LibreriasAdmVenta/org.springframework.test-3.0.6.RELEASE.jar"/>
|
||||||
|
<classpathentry kind="lib" path="/LibreriasAdmVenta/org.springframework.transaction-3.0.6.RELEASE.jar"/>
|
||||||
|
<classpathentry kind="lib" path="/LibreriasAdmVenta/org.springframework.web-3.0.6.RELEASE.jar"/>
|
||||||
|
<classpathentry kind="lib" path="/LibreriasAdmVenta/org.springframework.web.portlet-3.0.6.RELEASE.jar"/>
|
||||||
|
<classpathentry kind="lib" path="/LibreriasAdmVenta/org.springframework.web.servlet-3.0.6.RELEASE.jar"/>
|
||||||
|
<classpathentry kind="lib" path="/LibreriasAdmVenta/org.springframework.web.struts-3.0.6.RELEASE.jar"/>
|
||||||
|
<classpathentry kind="lib" path="/LibreriasAdmVenta/spring-security-acl-3.0.7.RELEASE.jar"/>
|
||||||
|
<classpathentry kind="lib" path="/LibreriasAdmVenta/spring-security-aspects-3.0.7.RELEASE.jar"/>
|
||||||
|
<classpathentry kind="lib" path="/LibreriasAdmVenta/spring-security-cas-client-3.0.7.RELEASE.jar"/>
|
||||||
|
<classpathentry kind="lib" path="/LibreriasAdmVenta/spring-security-config-3.0.7.RELEASE.jar"/>
|
||||||
|
<classpathentry kind="lib" path="/LibreriasAdmVenta/spring-security-core-3.0.7.RELEASE.jar"/>
|
||||||
|
<classpathentry kind="lib" path="/LibreriasAdmVenta/spring-security-ldap-3.0.7.RELEASE.jar"/>
|
||||||
|
<classpathentry kind="lib" path="/LibreriasAdmVenta/spring-security-taglibs-3.0.7.RELEASE.jar"/>
|
||||||
|
<classpathentry kind="lib" path="/LibreriasAdmVenta/spring-security-web-3.0.7.RELEASE.jar"/>
|
||||||
|
<classpathentry combineaccessrules="false" kind="src" path="/CustomAdmVenta"/>
|
||||||
|
<classpathentry combineaccessrules="false" kind="src" path="/modelWeb"/>
|
||||||
|
<classpathentry kind="lib" path="/LibreriasAdmVenta/groovy-all-1.7.5.jar"/>
|
||||||
|
<classpathentry kind="lib" path="/LibreriasAdmVenta/jasperreports-4.5.0.jar"/>
|
||||||
|
<classpathentry kind="lib" path="/LibreriasAdmVenta/jfreechart-1.0.12.jar"/>
|
||||||
|
<classpathentry kind="lib" path="/LibreriasAdmVenta/poi-3.8-20120326.jar"/>
|
||||||
|
<classpathentry kind="lib" path="/LibreriasAdmVenta/poi-ooxml-3.8-20120326.jar"/>
|
||||||
|
<classpathentry kind="lib" path="/LibreriasAdmVenta/poi-ooxml-schemas-3.8-20120326.jar"/>
|
||||||
|
<classpathentry kind="lib" path="/LibreriasAdmVenta/xmlbeans-2.3.0.jar"/>
|
||||||
|
<classpathentry kind="con" path="org.eclipse.jst.server.core.container/org.eclipse.jst.server.tomcat.runtimeTarget/Apache Tomcat v7.0">
|
||||||
|
<attributes>
|
||||||
|
<attribute name="owner.project.facets" value="jst.web"/>
|
||||||
|
</attributes>
|
||||||
|
</classpathentry>
|
||||||
|
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER">
|
||||||
|
<attributes>
|
||||||
|
<attribute name="owner.project.facets" value="java"/>
|
||||||
|
</attributes>
|
||||||
|
</classpathentry>
|
||||||
|
<classpathentry kind="output" path="build/classes"/>
|
||||||
|
</classpath>
|
|
@ -0,0 +1,45 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<projectDescription>
|
||||||
|
<name>ventaboletosadm</name>
|
||||||
|
<comment></comment>
|
||||||
|
<projects>
|
||||||
|
<project>modelWeb</project>
|
||||||
|
<project>LibreriasAdmVenta</project>
|
||||||
|
<project>CustomAdmVenta</project>
|
||||||
|
</projects>
|
||||||
|
<buildSpec>
|
||||||
|
<buildCommand>
|
||||||
|
<name>org.eclipse.wst.jsdt.core.javascriptValidator</name>
|
||||||
|
<arguments>
|
||||||
|
</arguments>
|
||||||
|
</buildCommand>
|
||||||
|
<buildCommand>
|
||||||
|
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||||
|
<arguments>
|
||||||
|
</arguments>
|
||||||
|
</buildCommand>
|
||||||
|
<buildCommand>
|
||||||
|
<name>org.eclipse.wst.common.project.facet.core.builder</name>
|
||||||
|
<arguments>
|
||||||
|
</arguments>
|
||||||
|
</buildCommand>
|
||||||
|
<buildCommand>
|
||||||
|
<name>org.eclipse.wst.validation.validationbuilder</name>
|
||||||
|
<arguments>
|
||||||
|
</arguments>
|
||||||
|
</buildCommand>
|
||||||
|
<buildCommand>
|
||||||
|
<name>org.eclipselabs.tapiji.tools.core.I18NBuilder</name>
|
||||||
|
<arguments>
|
||||||
|
</arguments>
|
||||||
|
</buildCommand>
|
||||||
|
</buildSpec>
|
||||||
|
<natures>
|
||||||
|
<nature>org.eclipse.jem.workbench.JavaEMFNature</nature>
|
||||||
|
<nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature>
|
||||||
|
<nature>org.eclipse.wst.common.project.facet.core.nature</nature>
|
||||||
|
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||||
|
<nature>org.eclipse.wst.jsdt.core.jsNature</nature>
|
||||||
|
<nature>org.eclipselabs.tapiji.tools.core.nature</nature>
|
||||||
|
</natures>
|
||||||
|
</projectDescription>
|
|
@ -0,0 +1,12 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<classpath>
|
||||||
|
<classpathentry kind="src" path="web"/>
|
||||||
|
<classpathentry kind="con" path="org.eclipse.wst.jsdt.launching.JRE_CONTAINER"/>
|
||||||
|
<classpathentry kind="con" path="org.eclipse.wst.jsdt.launching.WebProject">
|
||||||
|
<attributes>
|
||||||
|
<attribute name="hide" value="true"/>
|
||||||
|
</attributes>
|
||||||
|
</classpathentry>
|
||||||
|
<classpathentry kind="con" path="org.eclipse.wst.jsdt.launching.baseBrowserLibrary"/>
|
||||||
|
<classpathentry kind="output" path=""/>
|
||||||
|
</classpath>
|
|
@ -0,0 +1,5 @@
|
||||||
|
#Mon May 14 12:48:03 BRT 2012
|
||||||
|
eclipse.preferences.version=1
|
||||||
|
encoding//src/java/rebel.xml=UTF-8
|
||||||
|
encoding//web/WEB-INF/i3-label_es_MX.label=UTF-8
|
||||||
|
encoding//web/WEB-INF/i3-label_pt_BR.label=UTF-8
|
|
@ -0,0 +1,280 @@
|
||||||
|
#Wed Feb 08 14:33:42 BRST 2012
|
||||||
|
eclipse.preferences.version=1
|
||||||
|
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
||||||
|
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
|
||||||
|
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
|
||||||
|
org.eclipse.jdt.core.compiler.compliance=1.6
|
||||||
|
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
|
||||||
|
org.eclipse.jdt.core.compiler.debug.localVariable=generate
|
||||||
|
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
|
||||||
|
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
||||||
|
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
||||||
|
org.eclipse.jdt.core.compiler.source=1.6
|
||||||
|
org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
|
||||||
|
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16
|
||||||
|
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=0
|
||||||
|
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16
|
||||||
|
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=16
|
||||||
|
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16
|
||||||
|
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16
|
||||||
|
org.eclipse.jdt.core.formatter.alignment_for_assignment=0
|
||||||
|
org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16
|
||||||
|
org.eclipse.jdt.core.formatter.alignment_for_compact_if=16
|
||||||
|
org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80
|
||||||
|
org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0
|
||||||
|
org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16
|
||||||
|
org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0
|
||||||
|
org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16
|
||||||
|
org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16
|
||||||
|
org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16
|
||||||
|
org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16
|
||||||
|
org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16
|
||||||
|
org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16
|
||||||
|
org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16
|
||||||
|
org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16
|
||||||
|
org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16
|
||||||
|
org.eclipse.jdt.core.formatter.blank_lines_after_imports=1
|
||||||
|
org.eclipse.jdt.core.formatter.blank_lines_after_package=1
|
||||||
|
org.eclipse.jdt.core.formatter.blank_lines_before_field=0
|
||||||
|
org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0
|
||||||
|
org.eclipse.jdt.core.formatter.blank_lines_before_imports=1
|
||||||
|
org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1
|
||||||
|
org.eclipse.jdt.core.formatter.blank_lines_before_method=1
|
||||||
|
org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1
|
||||||
|
org.eclipse.jdt.core.formatter.blank_lines_before_package=0
|
||||||
|
org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1
|
||||||
|
org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1
|
||||||
|
org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line
|
||||||
|
org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line
|
||||||
|
org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line
|
||||||
|
org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line
|
||||||
|
org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line
|
||||||
|
org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line
|
||||||
|
org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line
|
||||||
|
org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line
|
||||||
|
org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line
|
||||||
|
org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line
|
||||||
|
org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line
|
||||||
|
org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=false
|
||||||
|
org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false
|
||||||
|
org.eclipse.jdt.core.formatter.comment.format_block_comments=true
|
||||||
|
org.eclipse.jdt.core.formatter.comment.format_header=false
|
||||||
|
org.eclipse.jdt.core.formatter.comment.format_html=true
|
||||||
|
org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=true
|
||||||
|
org.eclipse.jdt.core.formatter.comment.format_line_comments=true
|
||||||
|
org.eclipse.jdt.core.formatter.comment.format_source_code=true
|
||||||
|
org.eclipse.jdt.core.formatter.comment.indent_parameter_description=true
|
||||||
|
org.eclipse.jdt.core.formatter.comment.indent_root_tags=true
|
||||||
|
org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert
|
||||||
|
org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=insert
|
||||||
|
org.eclipse.jdt.core.formatter.comment.line_length=80
|
||||||
|
org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries=true
|
||||||
|
org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries=true
|
||||||
|
org.eclipse.jdt.core.formatter.compact_else_if=true
|
||||||
|
org.eclipse.jdt.core.formatter.continuation_indentation=2
|
||||||
|
org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=2
|
||||||
|
org.eclipse.jdt.core.formatter.disabling_tag=@formatter\:off
|
||||||
|
org.eclipse.jdt.core.formatter.enabling_tag=@formatter\:on
|
||||||
|
org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false
|
||||||
|
org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column=true
|
||||||
|
org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true
|
||||||
|
org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true
|
||||||
|
org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true
|
||||||
|
org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true
|
||||||
|
org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true
|
||||||
|
org.eclipse.jdt.core.formatter.indent_empty_lines=false
|
||||||
|
org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true
|
||||||
|
org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true
|
||||||
|
org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true
|
||||||
|
org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=false
|
||||||
|
org.eclipse.jdt.core.formatter.indentation.size=4
|
||||||
|
org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_member=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_new_line_after_label=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.join_lines_in_comments=true
|
||||||
|
org.eclipse.jdt.core.formatter.join_wrapped_lines=false
|
||||||
|
org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false
|
||||||
|
org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false
|
||||||
|
org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false
|
||||||
|
org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false
|
||||||
|
org.eclipse.jdt.core.formatter.lineSplit=9999
|
||||||
|
org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=false
|
||||||
|
org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=false
|
||||||
|
org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0
|
||||||
|
org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1
|
||||||
|
org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=true
|
||||||
|
org.eclipse.jdt.core.formatter.tabulation.char=tab
|
||||||
|
org.eclipse.jdt.core.formatter.tabulation.size=4
|
||||||
|
org.eclipse.jdt.core.formatter.use_on_off_tags=false
|
||||||
|
org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false
|
||||||
|
org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true
|
||||||
|
org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true
|
|
@ -0,0 +1,4 @@
|
||||||
|
#Wed Feb 08 14:33:42 BRST 2012
|
||||||
|
eclipse.preferences.version=1
|
||||||
|
formatter_profile=_rjconsultores
|
||||||
|
formatter_settings_version=11
|
|
@ -0,0 +1,15 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project-modules id="moduleCoreId" project-version="1.5.0">
|
||||||
|
<wb-module deploy-name="ventaboletosadm">
|
||||||
|
<wb-resource deploy-path="/" source-path="/web"/>
|
||||||
|
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/java"/>
|
||||||
|
<dependent-module archiveName="modelWeb.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/modelWeb/modelWeb">
|
||||||
|
<dependency-type>uses</dependency-type>
|
||||||
|
</dependent-module>
|
||||||
|
<dependent-module archiveName="CustomAdmVenta.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/CustomAdmVenta/CustomAdmVenta">
|
||||||
|
<dependency-type>uses</dependency-type>
|
||||||
|
</dependent-module>
|
||||||
|
<property name="java-output-path" value="/ventaboletosadm/build/classes"/>
|
||||||
|
<property name="context-root" value="/ventaboletosadm"/>
|
||||||
|
</wb-module>
|
||||||
|
</project-modules>
|
|
@ -0,0 +1,10 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<faceted-project>
|
||||||
|
<runtime name="Apache Tomcat v7.0"/>
|
||||||
|
<fixed facet="java"/>
|
||||||
|
<fixed facet="jst.web"/>
|
||||||
|
<fixed facet="wst.jsdt.web"/>
|
||||||
|
<installed facet="jst.web" version="2.4"/>
|
||||||
|
<installed facet="wst.jsdt.web" version="1.0"/>
|
||||||
|
<installed facet="java" version="1.6"/>
|
||||||
|
</faceted-project>
|
|
@ -0,0 +1 @@
|
||||||
|
org.eclipse.wst.jsdt.launching.baseBrowserLibrary
|
|
@ -0,0 +1 @@
|
||||||
|
Window
|
|
@ -0,0 +1,4 @@
|
||||||
|
#Fri Oct 14 14:34:32 BRT 2011
|
||||||
|
default.configuration=
|
||||||
|
eclipse.preferences.version=1
|
||||||
|
hibernate3.enabled=false
|
|
@ -0,0 +1,3 @@
|
||||||
|
#Mon Oct 17 21:38:50 BRST 2011
|
||||||
|
eclipse.preferences.version=1
|
||||||
|
org.jboss.ide.eclipse.as.core.singledeployable.deployableList=
|
|
@ -0,0 +1,6 @@
|
||||||
|
#Fri Nov 11 14:47:02 BRST 2011
|
||||||
|
eclipse.preferences.version=1
|
||||||
|
setting.zk_facet_install_history=<history>\n</history>\n
|
||||||
|
visualeditor.custom_web_content_path=/ventaboletosadm/web
|
||||||
|
visualeditor.custom_zk_package=zk-bin-eval-5.0.7.1
|
||||||
|
visualeditor.is_use_zks_lib=true
|
|
@ -0,0 +1,2 @@
|
||||||
|
Manifest-Version: 1.0
|
||||||
|
|
|
@ -0,0 +1,52 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!--
|
||||||
|
- Spring namespace-based configuration
|
||||||
|
-->
|
||||||
|
|
||||||
|
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||||
|
xmlns:security="http://www.springframework.org/schema/security"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://www.springframework.org/schema/beans
|
||||||
|
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
|
||||||
|
http://www.springframework.org/schema/security
|
||||||
|
http://www.springframework.org/schema/security/spring-security-3.0.xsd">
|
||||||
|
|
||||||
|
<security:http auto-config="true" access-denied-page="/accessDenied.zul">
|
||||||
|
<security:form-login login-page="/login.zul" default-target-url="/index.zul" authentication-failure-url="/login.zul?login_error=1"/>
|
||||||
|
<security:logout logout-success-url="/login.zul"/>
|
||||||
|
|
||||||
|
<!--
|
||||||
|
<security:intercept-url pattern="/modulos/admin/**" access="ROLE_MODULO_ADMIN"/>
|
||||||
|
<security:intercept-url pattern="/modulos/secretaria/**" access="ROLE_MODULO_SECRETARIA"/>
|
||||||
|
<security:intercept-url pattern="/modulos/contabil/**" access="ROLE_MODULO_CONTABIL"/>
|
||||||
|
<security:intercept-url pattern="/modulos/locacao/**" access="ROLE_MODULO_LOCACAO"/>
|
||||||
|
<security:intercept-url pattern="/modulos/academia/**" access="ROLE_MODULO_ACADEMIA"/>
|
||||||
|
|
||||||
|
<security:intercept-url pattern="/modulos/**" access="IS_AUTHENTICATED_REMEMBERED" />
|
||||||
|
|
||||||
|
<security:intercept-url pattern="/" access="IS_AUTHENTICATED_ANONYMOUSLY"/>
|
||||||
|
<security:intercept-url pattern="/login.zul" access="IS_AUTHENTICATED_ANONYMOUSLY"/>
|
||||||
|
<security:intercept-url pattern="/index.zul" access="IS_AUTHENTICATED_REMEMBERED"/>
|
||||||
|
-->
|
||||||
|
|
||||||
|
<!--security:session-management>
|
||||||
|
<security:concurrency-control max-sessions="1" error-if-maximum-exceeded="true"/>
|
||||||
|
</security:session-management-->
|
||||||
|
|
||||||
|
<!--security:remember-me/-->
|
||||||
|
|
||||||
|
</security:http>
|
||||||
|
|
||||||
|
<bean id="passwordEncoder"
|
||||||
|
class="org.springframework.security.authentication.encoding.Md5PasswordEncoder" />
|
||||||
|
|
||||||
|
<security:authentication-manager>
|
||||||
|
<security:authentication-provider user-service-ref="usuarioService">
|
||||||
|
<security:password-encoder ref="passwordEncoder">
|
||||||
|
<security:salt-source user-property="login"/>
|
||||||
|
</security:password-encoder>
|
||||||
|
</security:authentication-provider>
|
||||||
|
</security:authentication-manager>
|
||||||
|
|
||||||
|
</beans>
|
||||||
|
|
|
@ -0,0 +1,683 @@
|
||||||
|
package com.rjconsultores.ventaboletos.web.gui.componente.esquemaoperacional;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.text.MessageFormat;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.LinkedHashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import org.apache.log4j.Logger;
|
||||||
|
import org.zkoss.util.resource.Labels;
|
||||||
|
import org.zkoss.zk.ui.WrongValueException;
|
||||||
|
import org.zkoss.zk.ui.event.Event;
|
||||||
|
import org.zkoss.zk.ui.event.EventListener;
|
||||||
|
import org.zkoss.zk.ui.event.Events;
|
||||||
|
import org.zkoss.zk.ui.util.Clients;
|
||||||
|
import org.zkoss.zkplus.databind.DataBinder;
|
||||||
|
import org.zkoss.zkplus.spring.SpringUtil;
|
||||||
|
import org.zkoss.zul.Column;
|
||||||
|
import org.zkoss.zul.Columns;
|
||||||
|
import org.zkoss.zul.Combobox;
|
||||||
|
import org.zkoss.zul.Grid;
|
||||||
|
import org.zkoss.zul.Hbox;
|
||||||
|
import org.zkoss.zul.Intbox;
|
||||||
|
import org.zkoss.zul.Label;
|
||||||
|
import org.zkoss.zul.ListModelList;
|
||||||
|
import org.zkoss.zul.Menuitem;
|
||||||
|
import org.zkoss.zul.Menupopup;
|
||||||
|
import org.zkoss.zul.RendererCtrl;
|
||||||
|
import org.zkoss.zul.Row;
|
||||||
|
import org.zkoss.zul.RowRenderer;
|
||||||
|
import org.zkoss.zul.Spinner;
|
||||||
|
import org.zkoss.zul.Textbox;
|
||||||
|
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.ClaseServicio;
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.Parada;
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.Tramo;
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.TramoServicio;
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.Via;
|
||||||
|
import com.rjconsultores.ventaboletos.service.TramoService;
|
||||||
|
import com.rjconsultores.ventaboletos.service.TramoServicioService;
|
||||||
|
import com.rjconsultores.ventaboletos.utilerias.DateUtil.Hora;
|
||||||
|
import com.rjconsultores.ventaboletos.vo.esquemaoperacional.SecuenciaRutaTramoVO;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.ConstraintNumberBD;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.PantallaUtileria;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.StringDecimalToDecimalConverter;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Grid con la representacion de los tramos y secuencias de la ruta
|
||||||
|
*
|
||||||
|
* @author gleimar
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class GridRutaTramo extends Grid implements RowRenderer, RendererCtrl {
|
||||||
|
private List<Via> lsVias;
|
||||||
|
private List<SecuenciaRutaTramoVO> lsSecuenciaRutaTramoVO;
|
||||||
|
private ClaseServicio claseServicio;
|
||||||
|
private DataBinder dataBinder;
|
||||||
|
private boolean mostraPopupGrid;
|
||||||
|
private static Logger log = Logger.getLogger(GridRutaTramo.class);
|
||||||
|
|
||||||
|
public GridRutaTramo() {
|
||||||
|
lsSecuenciaRutaTramoVO = new ArrayList<SecuenciaRutaTramoVO>();
|
||||||
|
this.setRowRenderer(this);
|
||||||
|
this.appendChild(generarColumns());
|
||||||
|
dataBinder = new DataBinder();
|
||||||
|
mostraPopupGrid = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isMostraPopupGrid() {
|
||||||
|
return mostraPopupGrid;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMostraPopupGrid(boolean mostraPopupGrid) {
|
||||||
|
this.mostraPopupGrid = mostraPopupGrid;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Informa la lista de vias disponibles
|
||||||
|
*
|
||||||
|
* @param lsVias
|
||||||
|
*/
|
||||||
|
public void setLsVias(List<Via> lsVias) {
|
||||||
|
this.lsVias = lsVias;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Cuás es la clase de servicio confiugrada
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public ClaseServicio getClaseServicio() {
|
||||||
|
return claseServicio;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Indica cuál es la clase de servicio usada para hacer la búsqueda de los tramos
|
||||||
|
*
|
||||||
|
* @param claseServicio
|
||||||
|
*/
|
||||||
|
public void setClaseServicio(ClaseServicio claseServicio) {
|
||||||
|
if (!lsSecuenciaRutaTramoVO.isEmpty()) {
|
||||||
|
lsSecuenciaRutaTramoVO.clear();
|
||||||
|
actualizaModel();
|
||||||
|
}
|
||||||
|
this.claseServicio = claseServicio;
|
||||||
|
}
|
||||||
|
|
||||||
|
private ListModelList getListViaCombobox() {
|
||||||
|
return new ListModelList(lsVias);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Limpia los registros que existen y agrega todos
|
||||||
|
*
|
||||||
|
* @param lsSecuenciaRutaTramoVO
|
||||||
|
*/
|
||||||
|
public void agregarTodos(List<SecuenciaRutaTramoVO> lsSecuenciaRutaTramoVO) {
|
||||||
|
this.lsSecuenciaRutaTramoVO.clear();
|
||||||
|
this.lsSecuenciaRutaTramoVO.addAll(lsSecuenciaRutaTramoVO);
|
||||||
|
actualizaModel();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Agrega un nuevo tramo. Si la origen es la ultima parada, agrega al fin. Sino agrega al medio de la secuencia.
|
||||||
|
*
|
||||||
|
* La parada destino es la que tienes que agregar.
|
||||||
|
*
|
||||||
|
* @param origen
|
||||||
|
* @param destino
|
||||||
|
* @throws IllegalArgumentException
|
||||||
|
* - Los parametros origen y destino son obligatorios
|
||||||
|
* @throws ParadaExisteException
|
||||||
|
* - Cuándo el destino que se intenta agregar ya está agregado
|
||||||
|
*/
|
||||||
|
public void agregarSecuencia(Parada origen, Parada destino, Via via) throws IllegalArgumentException, ParadaExisteException {
|
||||||
|
dataBinder.saveAll();
|
||||||
|
dataBinder = new DataBinder();
|
||||||
|
|
||||||
|
if ((origen == null) || (destino == null)) {
|
||||||
|
throw new IllegalArgumentException(Labels.getLabel("gridRutaSecuencia.agregarSecuencia.exception.origenDestinoObligatorio"));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (existe(destino)) {
|
||||||
|
MessageFormat mf = new MessageFormat(Labels.getLabel("gridRutaSecuencia.paradaExisteException.msg"));
|
||||||
|
Object[] o = { destino.getDescparada() };
|
||||||
|
throw new ParadaExisteException(mf.format(o));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (lsSecuenciaRutaTramoVO.isEmpty()) {
|
||||||
|
SecuenciaRutaTramoVO s = new SecuenciaRutaTramoVO(origen, destino, 1, via);
|
||||||
|
llenarTramo(s);
|
||||||
|
lsSecuenciaRutaTramoVO.add(s);
|
||||||
|
} else if ((getUltimaParada() != null) && (getUltimaParada().equals(origen))) {
|
||||||
|
Integer secuence = lsSecuenciaRutaTramoVO.size() + 1;
|
||||||
|
SecuenciaRutaTramoVO secuenciaRutaVO = new SecuenciaRutaTramoVO(origen, destino, secuence, via);
|
||||||
|
llenarTramo(secuenciaRutaVO);
|
||||||
|
lsSecuenciaRutaTramoVO.add(secuenciaRutaVO);
|
||||||
|
} else {
|
||||||
|
List<Parada> lsParadas = new ArrayList<Parada>();
|
||||||
|
|
||||||
|
for (SecuenciaRutaTramoVO s : lsSecuenciaRutaTramoVO) {
|
||||||
|
if (!lsParadas.contains(s.getOrigen())) {
|
||||||
|
lsParadas.add(s.getOrigen());
|
||||||
|
}
|
||||||
|
if (!lsParadas.contains(s.getDestino())) {
|
||||||
|
lsParadas.add(s.getDestino());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
int indexOf = lsParadas.indexOf(origen);
|
||||||
|
if (indexOf != -1) {
|
||||||
|
lsParadas.add(indexOf + 1, destino);
|
||||||
|
} else {
|
||||||
|
indexOf = lsParadas.indexOf(destino);
|
||||||
|
if (indexOf != -1) {
|
||||||
|
lsParadas.add(indexOf, origen);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
List<SecuenciaRutaTramoVO> lsSecuenciaRutaTramoNuevoVO = new ArrayList<SecuenciaRutaTramoVO>();
|
||||||
|
for (int i = 1; i < lsParadas.size(); i++) {
|
||||||
|
Parada origenTramo = lsParadas.get(i - 1);
|
||||||
|
Parada destinoTramo = lsParadas.get(i);
|
||||||
|
SecuenciaRutaTramoVO s = buscarSecuencia(origenTramo, destinoTramo);
|
||||||
|
|
||||||
|
if (s == null) {
|
||||||
|
s = new SecuenciaRutaTramoVO(origenTramo, destinoTramo, i, null);
|
||||||
|
}
|
||||||
|
s.setSecuencia(i);
|
||||||
|
lsSecuenciaRutaTramoNuevoVO.add(s);
|
||||||
|
}
|
||||||
|
lsSecuenciaRutaTramoVO.clear();
|
||||||
|
lsSecuenciaRutaTramoVO.addAll(lsSecuenciaRutaTramoNuevoVO);
|
||||||
|
}
|
||||||
|
|
||||||
|
actualizaModel();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Hace la búsqueda de una secuencia por la origen y destino
|
||||||
|
*
|
||||||
|
* @param origenTramo
|
||||||
|
* @param destinoTramo
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
private SecuenciaRutaTramoVO buscarSecuencia(Parada origenTramo, Parada destinoTramo) {
|
||||||
|
boolean fueEncontrado = false;
|
||||||
|
SecuenciaRutaTramoVO s = null;
|
||||||
|
for (int j = 0; (j < lsSecuenciaRutaTramoVO.size()) && !fueEncontrado; j++) {
|
||||||
|
if (lsSecuenciaRutaTramoVO.get(j).getOrigen().equals(origenTramo)
|
||||||
|
&& lsSecuenciaRutaTramoVO.get(j).getDestino().equals(destinoTramo)) {
|
||||||
|
s = lsSecuenciaRutaTramoVO.get(j);
|
||||||
|
|
||||||
|
fueEncontrado = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
return s;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Indica si la parada ya esta agregada
|
||||||
|
*
|
||||||
|
* @param parada
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public boolean existe(Parada parada) {
|
||||||
|
boolean fueEncontrado = false;
|
||||||
|
SecuenciaRutaTramoVO s = null;
|
||||||
|
for (int j = 0; (j < lsSecuenciaRutaTramoVO.size()) && !fueEncontrado; j++) {
|
||||||
|
if (lsSecuenciaRutaTramoVO.get(j).getOrigen().equals(parada) || lsSecuenciaRutaTramoVO.get(j).getDestino().equals(parada)) {
|
||||||
|
fueEncontrado = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
return fueEncontrado;
|
||||||
|
}
|
||||||
|
|
||||||
|
private Columns generarColumns() {
|
||||||
|
Columns columns = new Columns();
|
||||||
|
|
||||||
|
Column columnSecuencia = new Column("#");
|
||||||
|
columnSecuencia.setWidth("5%");
|
||||||
|
columns.appendChild(columnSecuencia);
|
||||||
|
|
||||||
|
Column columnOrigen = new Column(Labels.getLabel("gridRutaSecuencia.columnOrigen.label"));
|
||||||
|
columnOrigen.setWidth("10%");
|
||||||
|
columns.appendChild(columnOrigen);
|
||||||
|
|
||||||
|
Column columnDestino = new Column(Labels.getLabel("gridRutaSecuencia.columnDestino.label"));
|
||||||
|
columnDestino.setWidth("10%");
|
||||||
|
columns.appendChild(columnDestino);
|
||||||
|
|
||||||
|
Column columnVia = new Column(Labels.getLabel("gridRutaSecuencia.columnVia.label"));
|
||||||
|
columnVia.setWidth("25%");
|
||||||
|
columns.appendChild(columnVia);
|
||||||
|
|
||||||
|
Column kmsReal = new Column(Labels.getLabel("gridRutaSecuencia.columnKmsReal.label"));
|
||||||
|
kmsReal.setWidth("15%");
|
||||||
|
columns.appendChild(kmsReal);
|
||||||
|
|
||||||
|
Column kmsConductor = new Column(Labels.getLabel("gridRutaSecuencia.columnKmsConductor.label"));
|
||||||
|
kmsConductor.setWidth("15%");
|
||||||
|
columns.appendChild(kmsConductor);
|
||||||
|
|
||||||
|
Column tiempoRecorrido = new Column(Labels.getLabel("gridRutaSecuencia.columnTiempoRecorrido.label"));
|
||||||
|
tiempoRecorrido.setWidth("15%");
|
||||||
|
columns.appendChild(tiempoRecorrido);
|
||||||
|
|
||||||
|
Column columnIDTramo = new Column(Labels.getLabel("gridRutaSecuencia.columnIDTramo.label"));
|
||||||
|
columnIDTramo.setWidth("5%");
|
||||||
|
columns.appendChild(columnIDTramo);
|
||||||
|
|
||||||
|
return columns;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void render(Row row, Object obj) throws Exception {
|
||||||
|
final SecuenciaRutaTramoVO secuenciaRutaTramoVO = (SecuenciaRutaTramoVO) obj;
|
||||||
|
dataBinder.bindBean(row.getUuid(), secuenciaRutaTramoVO);// binder
|
||||||
|
// row->bean
|
||||||
|
|
||||||
|
// Cell secuencia
|
||||||
|
Intbox ibxSumSecuencia = new Intbox(secuenciaRutaTramoVO.getSecuencia());
|
||||||
|
ibxSumSecuencia.setWidth("70%");
|
||||||
|
ibxSumSecuencia.setReadonly(true);
|
||||||
|
row.appendChild(ibxSumSecuencia);
|
||||||
|
|
||||||
|
// Cell Origen
|
||||||
|
Label lblOrigen = new Label(secuenciaRutaTramoVO.getOrigen().getCveparada());
|
||||||
|
lblOrigen.setWidth("80%");
|
||||||
|
Menupopup mnuOrigen = new Menupopup();
|
||||||
|
|
||||||
|
Menuitem mniAgregarDespues = new Menuitem(Labels.getLabel("gridRutaSecuencia.msg.agregarDespues"));
|
||||||
|
mniAgregarDespues.addEventListener(Events.ON_CLICK, new EventListener() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onEvent(Event arg0) throws Exception {
|
||||||
|
Map<String, Object> params = new LinkedHashMap<String, Object>();
|
||||||
|
params.put("gridRutaSecuencia", GridRutaTramo.this);
|
||||||
|
params.put("origen", secuenciaRutaTramoVO.getOrigen());
|
||||||
|
|
||||||
|
PantallaUtileria.openWindow("/gui/esquema_operacional/generacion_tramo_ruta/nuevaParada.zul",
|
||||||
|
Labels.getLabel("nuevaParadaController.window.title"), params, PantallaUtileria.MODAL, getDesktop());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
mnuOrigen.appendChild(mniAgregarDespues);
|
||||||
|
Menuitem mniEliminarPasoOrigen = new Menuitem(Labels.getLabel("gridRutaSecuencia.msg.eliminarPaso"));
|
||||||
|
mniEliminarPasoOrigen.addEventListener(Events.ON_CLICK, new EventListener() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onEvent(Event arg0) throws Exception {
|
||||||
|
removerParada(secuenciaRutaTramoVO.getOrigen());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
mnuOrigen.appendChild(mniEliminarPasoOrigen);
|
||||||
|
mnuOrigen.setPage(getPage());
|
||||||
|
if (mostraPopupGrid) {
|
||||||
|
lblOrigen.setContext(mnuOrigen);
|
||||||
|
}
|
||||||
|
row.appendChild(lblOrigen);
|
||||||
|
|
||||||
|
// Cell Destino
|
||||||
|
Label lblDestino = new Label(secuenciaRutaTramoVO.getDestino().getCveparada());
|
||||||
|
lblDestino.setWidth("80%");
|
||||||
|
Menupopup mnuDestino = new Menupopup();
|
||||||
|
|
||||||
|
Menuitem mniEliminarPasoDestino = new Menuitem(Labels.getLabel("gridRutaSecuencia.msg.eliminarPaso"));
|
||||||
|
mniEliminarPasoDestino.addEventListener(Events.ON_CLICK, new EventListener() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onEvent(Event arg0) throws Exception {
|
||||||
|
removerParada(secuenciaRutaTramoVO.getDestino());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
mnuDestino.appendChild(mniEliminarPasoDestino);
|
||||||
|
mnuDestino.setPage(getPage());
|
||||||
|
if (mostraPopupGrid) {
|
||||||
|
lblDestino.setContext(mnuDestino);
|
||||||
|
}
|
||||||
|
row.appendChild(lblDestino);
|
||||||
|
|
||||||
|
// son creados antes pues el cboVia los estan ocupando
|
||||||
|
final MyCustomTextboxDecimal dKmsReal = new MyCustomTextboxDecimal((secuenciaRutaTramoVO.getKmReal() == null) ? BigDecimal.ZERO
|
||||||
|
: secuenciaRutaTramoVO.getKmReal());
|
||||||
|
dKmsReal.setWidth("90%");
|
||||||
|
final MyCustomTextboxDecimal dKmsConductor = new MyCustomTextboxDecimal(
|
||||||
|
(secuenciaRutaTramoVO.getKmPagoConductor() == null) ? BigDecimal.ZERO : secuenciaRutaTramoVO.getKmPagoConductor());
|
||||||
|
dKmsConductor.setWidth("90%");
|
||||||
|
final Spinner spHora = new Spinner();
|
||||||
|
final Spinner spMinuto = new Spinner();
|
||||||
|
final Label lblID = new Label("");
|
||||||
|
|
||||||
|
// Cell Via
|
||||||
|
final Combobox cboVia = new Combobox();
|
||||||
|
cboVia.setId(cboVia.getUuid());
|
||||||
|
cboVia.setReadonly(true);
|
||||||
|
ListModelList listModelList = getListViaCombobox();
|
||||||
|
if (secuenciaRutaTramoVO.getVia() != null) {
|
||||||
|
listModelList.addSelection(secuenciaRutaTramoVO.getVia());
|
||||||
|
}
|
||||||
|
cboVia.setModel(listModelList);
|
||||||
|
cboVia.setConstraint("no empty");
|
||||||
|
cboVia.addEventListener(Events.ON_CHANGE, new EventListener() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onEvent(Event evt) throws Exception {
|
||||||
|
if (cboVia.getSelectedItem() != null) {
|
||||||
|
|
||||||
|
BigDecimal kmPagoConductorAntigo = secuenciaRutaTramoVO.getKmPagoConductor();
|
||||||
|
BigDecimal kmRealAntigo = secuenciaRutaTramoVO.getKmReal();
|
||||||
|
Hora tiempoRecorridoAntigo = secuenciaRutaTramoVO.getTiempoRecorrido();
|
||||||
|
|
||||||
|
secuenciaRutaTramoVO.setVia((Via) cboVia.getSelectedItem().getValue());
|
||||||
|
llenarTramo(secuenciaRutaTramoVO);
|
||||||
|
|
||||||
|
boolean tramoEditable = (secuenciaRutaTramoVO.getTramoId() == null);
|
||||||
|
boolean tramoServicioEditable = (secuenciaRutaTramoVO.getTramoServicioId() == null);
|
||||||
|
|
||||||
|
if (!tramoEditable) {// cuando el tramo no es editable, es porque ya existe. Entonces lleno la pantalla con los nuevos
|
||||||
|
// valores
|
||||||
|
dKmsReal.setValueBigDecimal(secuenciaRutaTramoVO.getKmReal());
|
||||||
|
dKmsConductor.setValueBigDecimal(secuenciaRutaTramoVO.getKmPagoConductor());
|
||||||
|
|
||||||
|
} else {
|
||||||
|
secuenciaRutaTramoVO.setKmPagoConductor(kmPagoConductorAntigo);
|
||||||
|
secuenciaRutaTramoVO.setKmReal(kmRealAntigo);
|
||||||
|
}
|
||||||
|
|
||||||
|
lblID.setValue((secuenciaRutaTramoVO.getTramoId() != null) ? secuenciaRutaTramoVO.getTramoId().toString() : "");
|
||||||
|
|
||||||
|
if (!tramoServicioEditable) {// cuando el tramoServicio no es editable, es porque ya existe. Entonces lleno la pantalla
|
||||||
|
// con los nuevos valores
|
||||||
|
spHora.setValue(secuenciaRutaTramoVO.getTiempoRecorrido().getHora());
|
||||||
|
spMinuto.setValue(secuenciaRutaTramoVO.getTiempoRecorrido().getMinuto());
|
||||||
|
} else {
|
||||||
|
secuenciaRutaTramoVO.setTiempoRecorrido(tiempoRecorridoAntigo);
|
||||||
|
}
|
||||||
|
|
||||||
|
dKmsReal.setReadonly(!tramoEditable);
|
||||||
|
dKmsConductor.setReadonly(!tramoEditable);
|
||||||
|
spHora.setDisabled(!tramoServicioEditable);
|
||||||
|
spMinuto.setDisabled(!tramoServicioEditable);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
row.appendChild(cboVia);
|
||||||
|
boolean esTramoEditable = (secuenciaRutaTramoVO.getTramoId() == null);
|
||||||
|
boolean esTramoServicioEditable = (secuenciaRutaTramoVO.getTramoServicioId() == null);
|
||||||
|
|
||||||
|
// Cell Kms Real
|
||||||
|
dKmsReal.setReadonly(!esTramoEditable);
|
||||||
|
dataBinder.addBinding(dKmsReal, "value", row.getUuid() + ".kmReal", null, null, "save",
|
||||||
|
"com.rjconsultores.ventaboletos.web.utilerias.StringDecimalToDecimalConverter", null, null, null);
|
||||||
|
|
||||||
|
row.appendChild(dKmsReal);
|
||||||
|
|
||||||
|
// Cell Kms Conductor
|
||||||
|
dKmsConductor.setReadonly(!esTramoEditable);
|
||||||
|
dataBinder.addBinding(dKmsConductor, "value", row.getUuid() + ".kmPagoConductor", null, null, "save",
|
||||||
|
"com.rjconsultores.ventaboletos.web.utilerias.StringDecimalToDecimalConverter", null, null, null);
|
||||||
|
row.appendChild(dKmsConductor);
|
||||||
|
|
||||||
|
// Cell Tiempo Recorrido
|
||||||
|
Hbox hbox = new Hbox();
|
||||||
|
|
||||||
|
spHora.setWidth("40px");
|
||||||
|
spHora.setConstraint("max 99,no negative,no empty");
|
||||||
|
spHora.setReadonly(!esTramoServicioEditable);
|
||||||
|
spHora.setButtonVisible(esTramoServicioEditable);
|
||||||
|
|
||||||
|
hbox.appendChild(spHora);
|
||||||
|
Label lbl = new Label(":");
|
||||||
|
hbox.appendChild(lbl);
|
||||||
|
|
||||||
|
spMinuto.setWidth("40px");
|
||||||
|
spMinuto.setConstraint("max 59,no negative,no empty");
|
||||||
|
spMinuto.setReadonly(!esTramoServicioEditable);
|
||||||
|
spMinuto.setButtonVisible(esTramoServicioEditable);
|
||||||
|
hbox.appendChild(spMinuto);
|
||||||
|
|
||||||
|
if (secuenciaRutaTramoVO.getTiempoRecorrido() != null) {
|
||||||
|
Hora hora = secuenciaRutaTramoVO.getTiempoRecorrido();
|
||||||
|
spHora.setValue(hora.getHora());
|
||||||
|
spMinuto.setValue(hora.getMinuto());
|
||||||
|
}
|
||||||
|
dataBinder.addBinding(spHora, "value", row.getUuid() + ".tiempoRecorrido.hora", null, null, "save", null, null, null, null);
|
||||||
|
dataBinder.addBinding(spMinuto, "value", row.getUuid() + ".tiempoRecorrido.minuto", null, null, "save", null, null, null, null);
|
||||||
|
row.appendChild(hbox);
|
||||||
|
|
||||||
|
// Cell ID Tramo
|
||||||
|
if (secuenciaRutaTramoVO.getTramoId() != null) {
|
||||||
|
lblID.setValue(secuenciaRutaTramoVO.getTramoId().toString());
|
||||||
|
} else {
|
||||||
|
lblID.setValue("");
|
||||||
|
}
|
||||||
|
row.appendChild(lblID);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Quita la parada de la lista de tramos
|
||||||
|
*
|
||||||
|
* @param parada
|
||||||
|
*/
|
||||||
|
private void removerParada(Parada parada) {
|
||||||
|
dataBinder.saveAll();
|
||||||
|
dataBinder = new DataBinder();
|
||||||
|
|
||||||
|
// ADICIONAR VALIDAÇÃO DO TRAMANHO DA LISTA
|
||||||
|
List<Parada> lsParadas = new ArrayList<Parada>();
|
||||||
|
|
||||||
|
BigDecimal totalKmRealRemovido = BigDecimal.ZERO;
|
||||||
|
BigDecimal totalKmConductorRemovido = BigDecimal.ZERO;
|
||||||
|
Hora totalTiempoRecorridoRemovido = new Hora();
|
||||||
|
|
||||||
|
for (SecuenciaRutaTramoVO s : lsSecuenciaRutaTramoVO) {
|
||||||
|
if (!s.getOrigen().equals(parada)) {
|
||||||
|
if (!lsParadas.contains(s.getOrigen())) {
|
||||||
|
lsParadas.add(s.getOrigen());
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
totalKmConductorRemovido = totalKmConductorRemovido.add(s.getKmPagoConductor());
|
||||||
|
totalKmRealRemovido = totalKmRealRemovido.add(s.getKmReal());
|
||||||
|
totalTiempoRecorridoRemovido = totalTiempoRecorridoRemovido.sumar(s.getTiempoRecorrido());
|
||||||
|
}
|
||||||
|
if (!s.getDestino().equals(parada)) {
|
||||||
|
if (!lsParadas.contains(s.getDestino())) {
|
||||||
|
lsParadas.add(s.getDestino());
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
totalKmConductorRemovido = totalKmConductorRemovido.add(s.getKmPagoConductor());
|
||||||
|
totalKmRealRemovido = totalKmRealRemovido.add(s.getKmReal());
|
||||||
|
totalTiempoRecorridoRemovido = totalTiempoRecorridoRemovido.sumar(s.getTiempoRecorrido());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
List<SecuenciaRutaTramoVO> lsSecuenciaRutaTramoNuevoVO = new ArrayList<SecuenciaRutaTramoVO>();
|
||||||
|
|
||||||
|
for (int i = 1; i < lsParadas.size(); i++) {
|
||||||
|
Parada origenTramo = lsParadas.get(i - 1);
|
||||||
|
Parada destinoTramo = lsParadas.get(i);
|
||||||
|
|
||||||
|
SecuenciaRutaTramoVO s = buscarSecuencia(origenTramo, destinoTramo);
|
||||||
|
if (s == null) {
|
||||||
|
s = new SecuenciaRutaTramoVO(origenTramo, destinoTramo, i, null);
|
||||||
|
// si no existe, es el tramo nuevo. Entonces agrego los valores eliminados
|
||||||
|
s.setKmPagoConductor(totalKmConductorRemovido);
|
||||||
|
s.setKmReal(totalKmRealRemovido);
|
||||||
|
s.setTiempoRecorrido(totalTiempoRecorridoRemovido);
|
||||||
|
}
|
||||||
|
s.setSecuencia(i);
|
||||||
|
lsSecuenciaRutaTramoNuevoVO.add(s);
|
||||||
|
}
|
||||||
|
lsSecuenciaRutaTramoVO.clear();
|
||||||
|
lsSecuenciaRutaTramoVO.addAll(lsSecuenciaRutaTramoNuevoVO);
|
||||||
|
|
||||||
|
actualizaModel();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Actualiza el modelo de grid
|
||||||
|
*/
|
||||||
|
private void actualizaModel() {
|
||||||
|
this.setModel(new ListModelList(lsSecuenciaRutaTramoVO, false));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Indica si hay tramos
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public boolean isEmpty() {
|
||||||
|
return lsSecuenciaRutaTramoVO.isEmpty();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Regresa la primera parada de los tramos
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public Parada getPrimeraParada() {
|
||||||
|
if (lsSecuenciaRutaTramoVO.isEmpty()) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return lsSecuenciaRutaTramoVO.get(0).getOrigen();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Regresa la ultima parada de los tramos
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public Parada getUltimaParada() {
|
||||||
|
if (lsSecuenciaRutaTramoVO.isEmpty()) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return lsSecuenciaRutaTramoVO.get(lsSecuenciaRutaTramoVO.size() - 1).getDestino();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Llena el tramo con los datos de un busqueda
|
||||||
|
*
|
||||||
|
* @param secuenciaRutaTramoVO
|
||||||
|
*/
|
||||||
|
private void llenarTramo(SecuenciaRutaTramoVO secuenciaRutaTramoVO) {
|
||||||
|
TramoServicioService tramoServicioService = (TramoServicioService) SpringUtil.getBean("tramoServicioService");
|
||||||
|
|
||||||
|
Parada destino = secuenciaRutaTramoVO.getDestino();
|
||||||
|
Parada origen = secuenciaRutaTramoVO.getOrigen();
|
||||||
|
Via via = secuenciaRutaTramoVO.getVia();
|
||||||
|
|
||||||
|
TramoServicio tramoServicio = null;
|
||||||
|
if ((destino != null) && (origen != null) && (via != null) && (claseServicio != null)) {
|
||||||
|
tramoServicio = tramoServicioService.buscar(origen, destino, via, claseServicio);
|
||||||
|
}
|
||||||
|
|
||||||
|
Tramo tramo = null;
|
||||||
|
if (tramoServicio != null) {
|
||||||
|
tramo = tramoServicio.getTramo();
|
||||||
|
} else {
|
||||||
|
TramoService tramoService = (TramoService) SpringUtil.getBean("tramoService");
|
||||||
|
if ((destino != null) && (origen != null) && (via != null)) {
|
||||||
|
tramo = tramoService.buscar(origen, destino, via);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (tramoServicio != null) {
|
||||||
|
Hora hora = new Hora(tramoServicio.getTiemporecorrido());
|
||||||
|
secuenciaRutaTramoVO.setTiempoRecorrido(hora);
|
||||||
|
secuenciaRutaTramoVO.setTramoServicioId(tramoServicio.getTramoservicioId());
|
||||||
|
} else {
|
||||||
|
secuenciaRutaTramoVO.setTiempoRecorrido(null);
|
||||||
|
secuenciaRutaTramoVO.setTramoServicioId(null);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (tramo != null) {
|
||||||
|
secuenciaRutaTramoVO.setKmPagoConductor(tramo.getKmPagoConductor());
|
||||||
|
secuenciaRutaTramoVO.setKmReal(tramo.getKmReal());
|
||||||
|
secuenciaRutaTramoVO.setTramoId(tramo.getTramoId());
|
||||||
|
} else {
|
||||||
|
secuenciaRutaTramoVO.setKmPagoConductor(BigDecimal.ZERO);
|
||||||
|
secuenciaRutaTramoVO.setKmReal(BigDecimal.ZERO);
|
||||||
|
secuenciaRutaTramoVO.setTramoId(null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void doCatch(Throwable arg0) throws Throwable {
|
||||||
|
throw arg0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void doFinally() {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void doTry() {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void debugList() {
|
||||||
|
dataBinder.saveAll();
|
||||||
|
for (SecuenciaRutaTramoVO s : lsSecuenciaRutaTramoVO) {
|
||||||
|
log.debug(s);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<SecuenciaRutaTramoVO> getLsSecuenciaRutaTramoVO() {
|
||||||
|
dataBinder.saveAll();
|
||||||
|
return lsSecuenciaRutaTramoVO;
|
||||||
|
}
|
||||||
|
|
||||||
|
class MyCustomTextboxDecimal extends Textbox {
|
||||||
|
|
||||||
|
public MyCustomTextboxDecimal() {
|
||||||
|
super();
|
||||||
|
this.setConstraint(new ConstraintNumberBD(8, 2, true));
|
||||||
|
ejecutaJavaScript();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setValueBigDecimal(BigDecimal kmPagoConductor) {
|
||||||
|
this.setValue(getBigDecimal(kmPagoConductor));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public MyCustomTextboxDecimal(String value) throws WrongValueException {
|
||||||
|
super(value);
|
||||||
|
this.setConstraint(new ConstraintNumberBD(8, 2, true));
|
||||||
|
ejecutaJavaScript();
|
||||||
|
}
|
||||||
|
|
||||||
|
public MyCustomTextboxDecimal(BigDecimal value) throws WrongValueException {
|
||||||
|
super();
|
||||||
|
this.setValue(getBigDecimal(value));
|
||||||
|
this.setConstraint(new ConstraintNumberBD(8, 2, true));
|
||||||
|
ejecutaJavaScript();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ejecutaJavaScript() {
|
||||||
|
Clients.evalJavaScript("jQuery('#" + this.getUuid()
|
||||||
|
+ "').format({allow_negative:false,precision: 2,decimal:'.',autofix:true});");
|
||||||
|
}
|
||||||
|
|
||||||
|
private String getBigDecimal(BigDecimal val) {
|
||||||
|
return (String) new StringDecimalToDecimalConverter().coerceToUi(val, this);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public BigDecimal getValueBigDecimal() {
|
||||||
|
return getBigDecimal(this.getValue());
|
||||||
|
}
|
||||||
|
|
||||||
|
private BigDecimal getBigDecimal(String val) {
|
||||||
|
return (BigDecimal) new StringDecimalToDecimalConverter().coerceToBean(val, this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,10 @@
|
||||||
|
package com.rjconsultores.ventaboletos.web.gui.componente.esquemaoperacional;
|
||||||
|
|
||||||
|
|
||||||
|
public class ParadaExisteException extends Exception {
|
||||||
|
|
||||||
|
public ParadaExisteException(String msg) {
|
||||||
|
super(msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,118 @@
|
||||||
|
/*
|
||||||
|
* To change this template, choose Tools | Templates
|
||||||
|
* and open the template in the editor.
|
||||||
|
*/
|
||||||
|
package com.rjconsultores.ventaboletos.web.gui.controladores;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import org.apache.log4j.Logger;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.context.annotation.Scope;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.zkoss.util.resource.Labels;
|
||||||
|
import org.zkoss.zk.ui.Component;
|
||||||
|
import org.zkoss.zk.ui.event.Event;
|
||||||
|
import org.zkoss.zul.Caption;
|
||||||
|
import org.zkoss.zul.Menubar;
|
||||||
|
import org.zkoss.zul.Toolbarbutton;
|
||||||
|
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.Usuario;
|
||||||
|
import com.rjconsultores.ventaboletos.service.ConstanteService;
|
||||||
|
import com.rjconsultores.ventaboletos.service.UsuarioService;
|
||||||
|
import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.MyGenericForwardComposer;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.menu.MenuFactory;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.menu.MenuFactoryPropertiesImpl;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Administrador
|
||||||
|
*/
|
||||||
|
@Controller("indexController")
|
||||||
|
@Scope("prototype")
|
||||||
|
public class IndexController extends MyGenericForwardComposer {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private UsuarioService usuarioService;
|
||||||
|
@Autowired
|
||||||
|
private ConstanteService constanteService;
|
||||||
|
private static Logger log = Logger.getLogger(IndexController.class);
|
||||||
|
private Usuario usuario;
|
||||||
|
private Toolbarbutton toolBar;
|
||||||
|
private Toolbarbutton toolBarUser;
|
||||||
|
private Menubar menubar;
|
||||||
|
private Caption lblNombreAplicacion;
|
||||||
|
|
||||||
|
public Toolbarbutton getToolBar() {
|
||||||
|
return toolBar;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setToolBar(Toolbarbutton toolBar) {
|
||||||
|
this.toolBar = toolBar;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Toolbarbutton getToolBarUser() {
|
||||||
|
return toolBarUser;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setToolBarUser(Toolbarbutton toolBarUser) {
|
||||||
|
this.toolBarUser = toolBarUser;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Usuario getUsuario() {
|
||||||
|
return usuario;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUsuario(Usuario usuario) {
|
||||||
|
this.usuario = usuario;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void cargarNombreAmbiente() {
|
||||||
|
String strNombre = lblNombreAplicacion.getLabel();
|
||||||
|
strNombre = strNombre + " - " + constanteService.buscarNombreAmbiente();
|
||||||
|
lblNombreAplicacion.setLabel(strNombre);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void doAfterCompose(Component comp) throws Exception {
|
||||||
|
super.doAfterCompose(comp);
|
||||||
|
cargarNombreAmbiente();
|
||||||
|
|
||||||
|
usuario = UsuarioLogado.getUsuarioLogado();
|
||||||
|
|
||||||
|
if (usuario == null) {
|
||||||
|
toolBarUser.setVisible(Boolean.FALSE);
|
||||||
|
|
||||||
|
openWindow("/login.zul", Labels.getLabel("winLogin.title"), arg, MODAL, Boolean.FALSE);
|
||||||
|
} else {
|
||||||
|
usuario = usuarioService.obtenerID(usuario.getUsuarioId());
|
||||||
|
|
||||||
|
toolBarUser.setVisible(Boolean.TRUE);
|
||||||
|
toolBarUser.setLabel(usuario.getNombusuario());
|
||||||
|
|
||||||
|
if (usuario.getUsuarioPerfilList().isEmpty()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
MenuFactory menuFactory = new MenuFactoryPropertiesImpl(desktop, usuario.getUsuarioPerfilList());
|
||||||
|
menuFactory.construirMenu(menubar);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onClick$toolBar(Event ev) {
|
||||||
|
UsuarioLogado.setUsuarioLogado(null);
|
||||||
|
|
||||||
|
desktop.getExecution().sendRedirect("/index.zul");
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onClick$toolBarUser(Event ev) {
|
||||||
|
Map args = new HashMap();
|
||||||
|
args.put("usuario", usuario);
|
||||||
|
args.put("usuarioList", null);
|
||||||
|
args.put("usrAdmin", Boolean.FALSE);
|
||||||
|
|
||||||
|
openWindow("/gui/seguridad/editarUsuario.zul", Labels.getLabel("editarUsuarioController.window.title"), args, MODAL);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,91 @@
|
||||||
|
/*
|
||||||
|
* To change this template, choose Tools | Templates
|
||||||
|
* and open the template in the editor.
|
||||||
|
*/
|
||||||
|
package com.rjconsultores.ventaboletos.web.gui.controladores;
|
||||||
|
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.Usuario;
|
||||||
|
import com.rjconsultores.ventaboletos.service.UsuarioService;
|
||||||
|
import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.Base64;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.MyGenericForwardComposer;
|
||||||
|
import java.security.MessageDigest;
|
||||||
|
import org.apache.log4j.Logger;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.context.annotation.Scope;
|
||||||
|
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.zkoss.util.resource.Labels;
|
||||||
|
import org.zkoss.zhtml.Messagebox;
|
||||||
|
import org.zkoss.zk.ui.event.Event;
|
||||||
|
import org.zkoss.zul.Textbox;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author rodrigo
|
||||||
|
*/
|
||||||
|
@Controller("loginController")
|
||||||
|
@Scope("prototype")
|
||||||
|
public class LoginController extends MyGenericForwardComposer {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private UsuarioService usuarioService;
|
||||||
|
private Usuario usuario;
|
||||||
|
private Textbox txtUsuario;
|
||||||
|
private Textbox txtSenha;
|
||||||
|
private Logger log = Logger.getLogger(LoginController.class);
|
||||||
|
|
||||||
|
public Textbox getTxtSenha() {
|
||||||
|
return txtSenha;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTxtSenha(Textbox txtSenha) {
|
||||||
|
this.txtSenha = txtSenha;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Textbox getTxtUsuario() {
|
||||||
|
return txtUsuario;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTxtUsuario(Textbox txtUsuario) {
|
||||||
|
this.txtUsuario = txtUsuario;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onOK$txtSenha(Event ev) {
|
||||||
|
onClick$btnAcessar(ev);
|
||||||
|
}
|
||||||
|
public void onClick$btnAcessar(Event ev) {
|
||||||
|
String stUsuario = txtUsuario.getText();
|
||||||
|
String senha = txtSenha.getText();
|
||||||
|
|
||||||
|
try {
|
||||||
|
if ((stUsuario != null) && (senha != null)) {
|
||||||
|
MessageDigest md = MessageDigest.getInstance("MD5");
|
||||||
|
byte[] pass = md.digest(senha.getBytes());
|
||||||
|
senha = Base64.byteArrayToBase64(pass);
|
||||||
|
|
||||||
|
usuario = usuarioService.buscarPeloNomeSenha(stUsuario, senha);
|
||||||
|
|
||||||
|
if (usuario != null) {
|
||||||
|
UsuarioLogado.setUsuarioLogado(usuario);
|
||||||
|
|
||||||
|
desktop.getExecution().sendRedirect("/index.zul");
|
||||||
|
|
||||||
|
closeWindow();
|
||||||
|
} else {
|
||||||
|
Messagebox.show(
|
||||||
|
Labels.getLabel("winLogin.lblloginIncorreto"),
|
||||||
|
Labels.getLabel("winLogin.title"),
|
||||||
|
Messagebox.OK, Messagebox.INFORMATION);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
Messagebox.show(
|
||||||
|
Labels.getLabel("winLogin.lblloginIncorreto"),
|
||||||
|
Labels.getLabel("winLogin.title"),
|
||||||
|
Messagebox.OK, Messagebox.INFORMATION);
|
||||||
|
}
|
||||||
|
} catch (Exception ex) {
|
||||||
|
log.error(ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,132 @@
|
||||||
|
/*
|
||||||
|
* To change this template, choose Tools | Templates
|
||||||
|
* and open the template in the editor.
|
||||||
|
*/
|
||||||
|
package com.rjconsultores.ventaboletos.web.gui.controladores.catalogos;
|
||||||
|
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.Articulo;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.MyGenericForwardComposer;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.MyListbox;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.paginacion.HibernateSearchObject;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.paginacion.PagedListWrapper;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.render.RenderArticulo;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.context.annotation.Scope;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.zkoss.util.resource.Labels;
|
||||||
|
import org.zkoss.zhtml.Messagebox;
|
||||||
|
import org.zkoss.zk.ui.Component;
|
||||||
|
import org.zkoss.zk.ui.event.Event;
|
||||||
|
import org.zkoss.zk.ui.event.EventListener;
|
||||||
|
import org.zkoss.zul.Paging;
|
||||||
|
import org.zkoss.zul.Textbox;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Administrador
|
||||||
|
*/
|
||||||
|
@Controller("busquedaArticuloController")
|
||||||
|
@Scope("prototype")
|
||||||
|
public class BusquedaArticuloController extends MyGenericForwardComposer {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private transient PagedListWrapper<Articulo> plwArticulo;
|
||||||
|
private MyListbox articuloList;
|
||||||
|
private Paging pagingArticulo;
|
||||||
|
private Textbox txtNome;
|
||||||
|
|
||||||
|
public MyListbox getArticuloList() {
|
||||||
|
return articuloList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setArticuloList(MyListbox articuloList) {
|
||||||
|
this.articuloList = articuloList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Paging getPagingArticulo() {
|
||||||
|
return pagingArticulo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPagingArticulo(Paging pagingArticulo) {
|
||||||
|
this.pagingArticulo = pagingArticulo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Textbox getTxtNome() {
|
||||||
|
return txtNome;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTxtNome(Textbox txtNome) {
|
||||||
|
this.txtNome = txtNome;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void doAfterCompose(Component comp) throws Exception {
|
||||||
|
super.doAfterCompose(comp);
|
||||||
|
|
||||||
|
articuloList.setItemRenderer(new RenderArticulo());
|
||||||
|
articuloList.addEventListener("onDoubleClick", new EventListener() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onEvent(Event event) throws Exception {
|
||||||
|
Articulo a = (Articulo) articuloList.getSelected();
|
||||||
|
verArticulo(a);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
refreshLista();
|
||||||
|
|
||||||
|
txtNome.focus();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void verArticulo(Articulo a) {
|
||||||
|
if (a == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Map args = new HashMap();
|
||||||
|
args.put("articulo", a);
|
||||||
|
args.put("articuloList", articuloList);
|
||||||
|
|
||||||
|
openWindow("/gui/catalogos/editarArticulo.zul",
|
||||||
|
Labels.getLabel("editarArticuloController.window.title"), args, MODAL);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void refreshLista() {
|
||||||
|
HibernateSearchObject<Articulo> articuloBusqueda =
|
||||||
|
new HibernateSearchObject<Articulo>(Articulo.class,
|
||||||
|
pagingArticulo.getPageSize());
|
||||||
|
|
||||||
|
articuloBusqueda.addFilterLike("descarticulo",
|
||||||
|
"%" + txtNome.getText().trim().concat("%"));
|
||||||
|
|
||||||
|
articuloBusqueda.addSortAsc("descarticulo");
|
||||||
|
articuloBusqueda.addFilterNotEqual("articuloId", -1);
|
||||||
|
|
||||||
|
articuloBusqueda.addFilterEqual("activo", Boolean.TRUE);
|
||||||
|
|
||||||
|
plwArticulo.init(articuloBusqueda, articuloList, pagingArticulo);
|
||||||
|
|
||||||
|
if (articuloList.getData().length == 0) {
|
||||||
|
try {
|
||||||
|
Messagebox.show(Labels.getLabel("MSG.ningunRegistro"),
|
||||||
|
Labels.getLabel("busquedaArticuloController.window.title"),
|
||||||
|
Messagebox.OK, Messagebox.INFORMATION);
|
||||||
|
} catch (InterruptedException ex) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onClick$btnPesquisa(Event ev) {
|
||||||
|
refreshLista();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onClick$btnRefresh(Event ev) {
|
||||||
|
refreshLista();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onClick$btnNovo(Event ev) {
|
||||||
|
verArticulo(new Articulo());
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,194 @@
|
||||||
|
/*
|
||||||
|
* To change this template, choose Tools | Templates
|
||||||
|
* and open the template in the editor.
|
||||||
|
*/
|
||||||
|
package com.rjconsultores.ventaboletos.web.gui.controladores.catalogos;
|
||||||
|
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.ClaseServicio;
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.Marca;
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.MarcaClaseServicio;
|
||||||
|
import com.rjconsultores.ventaboletos.service.ClaseServicioService;
|
||||||
|
import com.rjconsultores.ventaboletos.service.MarcaService;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.MyGenericForwardComposer;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.MyListbox;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.paginacion.HibernateSearchObject;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.paginacion.PagedListWrapper;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.render.RenderClaseServicioMarca;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.context.annotation.Scope;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.zkoss.util.resource.Labels;
|
||||||
|
import org.zkoss.zhtml.Messagebox;
|
||||||
|
import org.zkoss.zk.ui.Component;
|
||||||
|
import org.zkoss.zk.ui.event.Event;
|
||||||
|
import org.zkoss.zk.ui.event.EventListener;
|
||||||
|
import org.zkoss.zul.Combobox;
|
||||||
|
import org.zkoss.zul.Paging;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author rodrigo
|
||||||
|
*/
|
||||||
|
@Controller("busquedaAsociacionClaseServicioMarcaController")
|
||||||
|
@Scope("prototype")
|
||||||
|
public class BusquedaAsociacionClaseServicioMarcaController extends MyGenericForwardComposer {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private transient PagedListWrapper<MarcaClaseServicio> plwMarcaClaseServicio;
|
||||||
|
@Autowired
|
||||||
|
private MarcaService marcaService;
|
||||||
|
@Autowired
|
||||||
|
private ClaseServicioService claseServicioService;
|
||||||
|
private List<Marca> lsMarcas;
|
||||||
|
private List<ClaseServicio> lsClaseServicios;
|
||||||
|
private MyListbox marcaClaseServicioList;
|
||||||
|
private Paging pagingMarcaClaseServicio;
|
||||||
|
private Combobox cmbMarca;
|
||||||
|
private Combobox cmbProducto;
|
||||||
|
|
||||||
|
public MyListbox getMarcaClaseServicioList() {
|
||||||
|
return marcaClaseServicioList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMarcaClaseServicioList(MyListbox marcaClaseServicioList) {
|
||||||
|
this.marcaClaseServicioList = marcaClaseServicioList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Paging getPagingMarcaClaseServicio() {
|
||||||
|
return pagingMarcaClaseServicio;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPagingMarcaClaseServicio(Paging pagingMarcaClaseServicio) {
|
||||||
|
this.pagingMarcaClaseServicio = pagingMarcaClaseServicio;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Combobox getCmbMarca() {
|
||||||
|
return cmbMarca;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCmbMarca(Combobox cmbMarca) {
|
||||||
|
this.cmbMarca = cmbMarca;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Combobox getCmbProducto() {
|
||||||
|
return cmbProducto;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCmbProducto(Combobox cmbProducto) {
|
||||||
|
this.cmbProducto = cmbProducto;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ClaseServicioService getClaseServicioService() {
|
||||||
|
return claseServicioService;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setClaseServicioService(ClaseServicioService claseServicioService) {
|
||||||
|
this.claseServicioService = claseServicioService;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<ClaseServicio> getLsClaseServicios() {
|
||||||
|
return lsClaseServicios;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLsClaseServicios(List<ClaseServicio> lsClaseServicios) {
|
||||||
|
this.lsClaseServicios = lsClaseServicios;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<Marca> getLsMarcas() {
|
||||||
|
return lsMarcas;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLsMarcas(List<Marca> lsMarcas) {
|
||||||
|
this.lsMarcas = lsMarcas;
|
||||||
|
}
|
||||||
|
|
||||||
|
public MarcaService getMarcaService() {
|
||||||
|
return marcaService;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMarcaService(MarcaService marcaService) {
|
||||||
|
this.marcaService = marcaService;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void doAfterCompose(Component comp) throws Exception {
|
||||||
|
lsMarcas = marcaService.obtenerTodos();
|
||||||
|
lsClaseServicios = claseServicioService.obtenerTodos();
|
||||||
|
|
||||||
|
super.doAfterCompose(comp);
|
||||||
|
|
||||||
|
marcaClaseServicioList.setItemRenderer(new RenderClaseServicioMarca());
|
||||||
|
marcaClaseServicioList.addEventListener("onDoubleClick", new EventListener() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onEvent(Event event) throws Exception {
|
||||||
|
MarcaClaseServicio m = (MarcaClaseServicio) marcaClaseServicioList.getSelected();
|
||||||
|
verMarcaClaseServicio(m);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
refreshLista();
|
||||||
|
|
||||||
|
cmbMarca.focus();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void verMarcaClaseServicio(MarcaClaseServicio m) {
|
||||||
|
if (m == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Map args = new HashMap();
|
||||||
|
args.put("marcaClaseServicio", m);
|
||||||
|
args.put("marcaClaseServicioList", marcaClaseServicioList);
|
||||||
|
|
||||||
|
openWindow("/gui/catalogos/editarAsociacionClaseServicioMarca.zul",
|
||||||
|
Labels.getLabel("editarAsociacionClaseServicioMarcaController.window.title"),
|
||||||
|
args, MODAL);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void refreshLista() {
|
||||||
|
HibernateSearchObject<MarcaClaseServicio> marcaClaseServicioBusqueda =
|
||||||
|
new HibernateSearchObject<MarcaClaseServicio>(MarcaClaseServicio.class, pagingMarcaClaseServicio.getPageSize());
|
||||||
|
|
||||||
|
String marca = cmbMarca.getText().trim();
|
||||||
|
String tipoServico = cmbProducto.getText().trim();
|
||||||
|
|
||||||
|
if ((marca != null) && (!marca.isEmpty())) {
|
||||||
|
marcaClaseServicioBusqueda.addFilterLike("marcaClaseservicioPK.marca.descmarca", "%" + cmbMarca.getText().toUpperCase().trim().concat("%"));
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((tipoServico != null) && (!tipoServico.isEmpty())) {
|
||||||
|
marcaClaseServicioBusqueda.addFilterLike("marcaClaseservicioPK.claseservicio.descclase", "%" + cmbProducto.getText().toUpperCase().trim().concat("%"));
|
||||||
|
}
|
||||||
|
marcaClaseServicioBusqueda.addFilterNotEqual("marcaClaseservicioPK.claseservicio.claseservicioId", -1);
|
||||||
|
|
||||||
|
marcaClaseServicioBusqueda.addFilterEqual("activo", Boolean.TRUE);
|
||||||
|
marcaClaseServicioBusqueda.addSortAsc("marcaClaseservicioPK.marca.descmarca");
|
||||||
|
|
||||||
|
plwMarcaClaseServicio.init(marcaClaseServicioBusqueda, marcaClaseServicioList, pagingMarcaClaseServicio);
|
||||||
|
|
||||||
|
if (marcaClaseServicioList.getData().length == 0) {
|
||||||
|
try {
|
||||||
|
Messagebox.show(Labels.getLabel("MSG.ningunRegistro"),
|
||||||
|
Labels.getLabel("busquedaAsociacionClaseServicioMarcaController.window.title"),
|
||||||
|
Messagebox.OK, Messagebox.INFORMATION);
|
||||||
|
} catch (InterruptedException ex) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onClick$btnPesquisa(Event ev) throws InterruptedException {
|
||||||
|
refreshLista();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onClick$btnRefresh(Event ev) {
|
||||||
|
refreshLista();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onClick$btnNovo(Event ev) {
|
||||||
|
verMarcaClaseServicio(new MarcaClaseServicio());
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,127 @@
|
||||||
|
/*
|
||||||
|
* To change this template, choose Tools | Templates
|
||||||
|
* and open the template in the editor.
|
||||||
|
*/
|
||||||
|
package com.rjconsultores.ventaboletos.web.gui.controladores.catalogos;
|
||||||
|
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.Categoria;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.MyGenericForwardComposer;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.MyListbox;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.paginacion.HibernateSearchObject;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.paginacion.PagedListWrapper;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.render.RenderCategoria;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.context.annotation.Scope;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.zkoss.util.resource.Labels;
|
||||||
|
import org.zkoss.zhtml.Messagebox;
|
||||||
|
import org.zkoss.zk.ui.Component;
|
||||||
|
import org.zkoss.zk.ui.event.Event;
|
||||||
|
import org.zkoss.zk.ui.event.EventListener;
|
||||||
|
import org.zkoss.zul.Paging;
|
||||||
|
import org.zkoss.zul.Textbox;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Rafius
|
||||||
|
*/
|
||||||
|
@Controller("busquedaCategoriaController")
|
||||||
|
@Scope("prototype")
|
||||||
|
public class BusquedaCategoriaController extends MyGenericForwardComposer {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private transient PagedListWrapper<Categoria> plwCategoria;
|
||||||
|
private MyListbox categoriaList;
|
||||||
|
private Paging pagingCategoria;
|
||||||
|
private Textbox txtNombre;
|
||||||
|
|
||||||
|
public Paging getPagingCategoria() {
|
||||||
|
return pagingCategoria;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPagingCategoria(Paging pagingCategoria) {
|
||||||
|
this.pagingCategoria = pagingCategoria;
|
||||||
|
}
|
||||||
|
|
||||||
|
public MyListbox getCategoriaList() {
|
||||||
|
return categoriaList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCategoriaList(MyListbox categoriaList) {
|
||||||
|
this.categoriaList = categoriaList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public PagedListWrapper<Categoria> getPlwCategoria() {
|
||||||
|
return plwCategoria;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPlwCategoria(PagedListWrapper<Categoria> plwCategoria) {
|
||||||
|
this.plwCategoria = plwCategoria;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onClick$btnPesquisa(Event ev) throws InterruptedException {
|
||||||
|
refreshLista();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onClick$btnRefresh(Event ev) {
|
||||||
|
refreshLista();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onClick$btnNovo(Event ev) {
|
||||||
|
verPeriodo(new Categoria());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void doAfterCompose(Component comp) throws Exception {
|
||||||
|
super.doAfterCompose(comp);
|
||||||
|
|
||||||
|
categoriaList.setItemRenderer(new RenderCategoria());
|
||||||
|
categoriaList.addEventListener("onDoubleClick", new EventListener() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onEvent(Event event) throws Exception {
|
||||||
|
Categoria c = (Categoria) categoriaList.getSelected();
|
||||||
|
verPeriodo(c);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
refreshLista();
|
||||||
|
|
||||||
|
txtNombre.focus();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void verPeriodo(Categoria c) {
|
||||||
|
if (c == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Map args = new HashMap();
|
||||||
|
args.put("categoria", c);
|
||||||
|
args.put("categoriaList", categoriaList);
|
||||||
|
|
||||||
|
openWindow("/gui/catalogos/editarCategoria.zul",
|
||||||
|
Labels.getLabel("editarCategoriaController.window.title"), args, MODAL);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void refreshLista() {
|
||||||
|
HibernateSearchObject<Categoria> claseServicioBusqueda =
|
||||||
|
new HibernateSearchObject<Categoria>(Categoria.class, pagingCategoria.getPageSize());
|
||||||
|
|
||||||
|
claseServicioBusqueda.addFilterLike("desccategoria", "%" + txtNombre.getText().trim().concat("%"));
|
||||||
|
claseServicioBusqueda.addFilterEqual("activo", Boolean.TRUE);
|
||||||
|
claseServicioBusqueda.addFilterNotEqual("categoriaId", -1);
|
||||||
|
claseServicioBusqueda.addSortAsc("desccategoria");
|
||||||
|
|
||||||
|
plwCategoria.init(claseServicioBusqueda, categoriaList, pagingCategoria);
|
||||||
|
if (categoriaList.getData().length == 0) {
|
||||||
|
try {
|
||||||
|
Messagebox.show(Labels.getLabel("MSG.ningunRegistro"),
|
||||||
|
Labels.getLabel("busquedaCategoriaController.window.title"),
|
||||||
|
Messagebox.OK, Messagebox.INFORMATION);
|
||||||
|
} catch (InterruptedException ex) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,244 @@
|
||||||
|
/*
|
||||||
|
* To change this template, choose Tools | Templates
|
||||||
|
* and open the template in the editor.
|
||||||
|
*/
|
||||||
|
package com.rjconsultores.ventaboletos.web.gui.controladores.catalogos;
|
||||||
|
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.Ciudad;
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.Estado;
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.Plaza;
|
||||||
|
import com.rjconsultores.ventaboletos.service.EstadoService;
|
||||||
|
import com.rjconsultores.ventaboletos.service.PlazaService;
|
||||||
|
import com.rjconsultores.ventaboletos.utilerias.ApplicationProperties;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.MyGenericForwardComposer;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.MyListbox;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.paginacion.HibernateSearchObject;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.paginacion.PagedListWrapper;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.render.RenderCiudad;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.context.annotation.Scope;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.zkoss.util.resource.Labels;
|
||||||
|
import org.zkoss.zhtml.Messagebox;
|
||||||
|
import org.zkoss.zk.ui.Component;
|
||||||
|
import org.zkoss.zk.ui.event.Event;
|
||||||
|
import org.zkoss.zk.ui.event.EventListener;
|
||||||
|
import org.zkoss.zul.Combobox;
|
||||||
|
import org.zkoss.zul.Comboitem;
|
||||||
|
import org.zkoss.zul.Intbox;
|
||||||
|
import org.zkoss.zul.Listheader;
|
||||||
|
import org.zkoss.zul.Paging;
|
||||||
|
import org.zkoss.zul.Row;
|
||||||
|
import org.zkoss.zul.Textbox;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author MCosso
|
||||||
|
*/
|
||||||
|
@Controller("busquedaCiudadController")
|
||||||
|
@Scope("prototype")
|
||||||
|
public class BusquedaCiudadController extends MyGenericForwardComposer {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private transient PagedListWrapper<Ciudad> plwCiudad;
|
||||||
|
@Autowired
|
||||||
|
private EstadoService estadoService;
|
||||||
|
@Autowired
|
||||||
|
private PlazaService plazaService;
|
||||||
|
private MyListbox ciudadList;
|
||||||
|
private Paging pagingCiudad;
|
||||||
|
private List<Estado> lsEstado;
|
||||||
|
private List<Plaza> lsPlaza;
|
||||||
|
private Textbox txtNombre;
|
||||||
|
private Textbox txtEquivalencia;
|
||||||
|
private Combobox cmbEstado;
|
||||||
|
private Combobox cmbPlaza;
|
||||||
|
private Row rowEquivalencia;
|
||||||
|
private Listheader headerEquivalencia;
|
||||||
|
private Intbox txtZonaHoraria;
|
||||||
|
|
||||||
|
public MyListbox getCiudadList() {
|
||||||
|
return ciudadList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCiudadList(MyListbox ciudadList) {
|
||||||
|
this.ciudadList = ciudadList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Combobox getCmbEstado() {
|
||||||
|
return cmbEstado;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCmbEstado(Combobox cmbEstado) {
|
||||||
|
this.cmbEstado = cmbEstado;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Combobox getCmbPlaza() {
|
||||||
|
return cmbPlaza;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCmbPlaza(Combobox cmbPlaza) {
|
||||||
|
this.cmbPlaza = cmbPlaza;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<Estado> getLsEstado() {
|
||||||
|
return lsEstado;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLsEstado(List<Estado> lsEstado) {
|
||||||
|
this.lsEstado = lsEstado;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<Plaza> getLsPlaza() {
|
||||||
|
return lsPlaza;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLsPlaza(List<Plaza> lsPlaza) {
|
||||||
|
this.lsPlaza = lsPlaza;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Paging getPagingCiudad() {
|
||||||
|
return pagingCiudad;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPagingCiudad(Paging pagingCiudad) {
|
||||||
|
this.pagingCiudad = pagingCiudad;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Textbox getTxtNombre() {
|
||||||
|
return txtNombre;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTxtNombre(Textbox txtNombre) {
|
||||||
|
this.txtNombre = txtNombre;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Textbox getTxtEquivalencia() {
|
||||||
|
return txtEquivalencia;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTxtEquivalencia(Textbox txtEquivalencia) {
|
||||||
|
this.txtEquivalencia = txtEquivalencia;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Intbox getTxtZonaHoraria() {
|
||||||
|
return txtZonaHoraria;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTxtZonaHoraria(Intbox txtZonaHoraria) {
|
||||||
|
this.txtZonaHoraria = txtZonaHoraria;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onClick$btnPesquisa(Event ev) throws InterruptedException {
|
||||||
|
refreshLista();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onClick$btnRefresh(Event ev) {
|
||||||
|
refreshLista();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onClick$btnNovo(Event ev) {
|
||||||
|
verCiudad(new Ciudad());
|
||||||
|
}
|
||||||
|
|
||||||
|
public Listheader getHeaderEquivalencia() {
|
||||||
|
return headerEquivalencia;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setHeaderEquivalencia(Listheader headerEquivalencia) {
|
||||||
|
this.headerEquivalencia = headerEquivalencia;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Row getRowEquivalencia() {
|
||||||
|
return rowEquivalencia;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRowEquivalencia(Row rowEquivalencia) {
|
||||||
|
this.rowEquivalencia = rowEquivalencia;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void doAfterCompose(Component comp) throws Exception {
|
||||||
|
lsEstado = estadoService.obtenerTodos();
|
||||||
|
lsPlaza = plazaService.obtenerTodos();
|
||||||
|
super.doAfterCompose(comp);
|
||||||
|
|
||||||
|
ciudadList.setItemRenderer(new RenderCiudad());
|
||||||
|
ciudadList.addEventListener("onDoubleClick", new EventListener() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onEvent(Event event) throws Exception {
|
||||||
|
Ciudad ciu = (Ciudad) ciudadList.getSelected();
|
||||||
|
verCiudad(ciu);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
refreshLista();
|
||||||
|
|
||||||
|
if (!ApplicationProperties.getInstance().mostrarEquivalencia()) {
|
||||||
|
rowEquivalencia.setVisible(Boolean.FALSE);
|
||||||
|
headerEquivalencia.setVisible(Boolean.FALSE);
|
||||||
|
}
|
||||||
|
|
||||||
|
txtNombre.focus();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void verCiudad(Ciudad ci) {
|
||||||
|
if (ci == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Map args = new HashMap();
|
||||||
|
args.put("ciudad", ci);
|
||||||
|
args.put("ciudadList", ciudadList);
|
||||||
|
|
||||||
|
openWindow("/gui/catalogos/editarCiudad.zul",
|
||||||
|
Labels.getLabel("editarCiudadController.window.title"), args, MODAL);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void refreshLista() {
|
||||||
|
HibernateSearchObject<Ciudad> ciudadBusqueda =
|
||||||
|
new HibernateSearchObject<Ciudad>(Ciudad.class, pagingCiudad.getPageSize());
|
||||||
|
|
||||||
|
ciudadBusqueda.addFilterEqual("activo", true);
|
||||||
|
ciudadBusqueda.addFilterLike("nombciudad", txtNombre.getText().trim().concat("%"));
|
||||||
|
ciudadBusqueda.addFilterNotEqual("ciudadId", -1);
|
||||||
|
|
||||||
|
if (!txtEquivalencia.getText().isEmpty()) {
|
||||||
|
ciudadBusqueda.addFilterLike("equivalenciaId", "%" + txtEquivalencia.getText().trim().concat("%"));
|
||||||
|
}
|
||||||
|
|
||||||
|
Comboitem cbiEstado = cmbEstado.getSelectedItem();
|
||||||
|
Comboitem cbiPlaza = cmbPlaza.getSelectedItem();
|
||||||
|
|
||||||
|
if (cbiEstado != null) {
|
||||||
|
Estado estado = (Estado) cbiEstado.getValue();
|
||||||
|
ciudadBusqueda.addFilterEqual("estado", estado);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (cbiPlaza != null) {
|
||||||
|
Plaza plaza = (Plaza) cbiPlaza.getValue();
|
||||||
|
ciudadBusqueda.addFilterEqual("plaza", plaza);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (txtZonaHoraria.getValue() != null) {
|
||||||
|
ciudadBusqueda.addFilterEqual("zonaHoraria", txtZonaHoraria.getValue());
|
||||||
|
}
|
||||||
|
|
||||||
|
ciudadBusqueda.addSortAsc("nombciudad");
|
||||||
|
|
||||||
|
plwCiudad.init(ciudadBusqueda, ciudadList, pagingCiudad);
|
||||||
|
|
||||||
|
if (ciudadList.getData().length == 0) {
|
||||||
|
try {
|
||||||
|
Messagebox.show(Labels.getLabel("MSG.ningunRegistro"),
|
||||||
|
Labels.getLabel("busquedaCiudadController.window.title"),
|
||||||
|
Messagebox.OK, Messagebox.INFORMATION);
|
||||||
|
} catch (InterruptedException ex) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,131 @@
|
||||||
|
/*
|
||||||
|
* To change this template, choose Tools | Templates
|
||||||
|
* and open the template in the editor.
|
||||||
|
*/
|
||||||
|
package com.rjconsultores.ventaboletos.web.gui.controladores.catalogos;
|
||||||
|
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.ClaseServicio;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.MyGenericForwardComposer;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.MyListbox;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.paginacion.HibernateSearchObject;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.paginacion.PagedListWrapper;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.render.RenderClaseServicio;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.context.annotation.Scope;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.zkoss.util.resource.Labels;
|
||||||
|
import org.zkoss.zhtml.Messagebox;
|
||||||
|
import org.zkoss.zk.ui.Component;
|
||||||
|
import org.zkoss.zk.ui.event.Event;
|
||||||
|
import org.zkoss.zk.ui.event.EventListener;
|
||||||
|
import org.zkoss.zul.Paging;
|
||||||
|
import org.zkoss.zul.Textbox;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Administrador
|
||||||
|
*/
|
||||||
|
@Controller("busquedaClaseServicioController")
|
||||||
|
@Scope("prototype")
|
||||||
|
public class BusquedaClaseServicioController extends MyGenericForwardComposer {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private transient PagedListWrapper<ClaseServicio> plwClaseServico;
|
||||||
|
private MyListbox claseServicioList;
|
||||||
|
private Paging pagingClaseServicio;
|
||||||
|
private Textbox txtNome;
|
||||||
|
|
||||||
|
public MyListbox getClaseServicioList() {
|
||||||
|
return claseServicioList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setClaseServicioList(MyListbox claseServicioList) {
|
||||||
|
this.claseServicioList = claseServicioList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Paging getPagingClaseServicio() {
|
||||||
|
return pagingClaseServicio;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPagingClaseServicio(Paging pagingClaseServicio) {
|
||||||
|
this.pagingClaseServicio = pagingClaseServicio;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Textbox getTxtNome() {
|
||||||
|
return txtNome;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTxtNome(Textbox txtNome) {
|
||||||
|
this.txtNome = txtNome;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void doAfterCompose(Component comp) throws Exception {
|
||||||
|
super.doAfterCompose(comp);
|
||||||
|
|
||||||
|
claseServicioList.setItemRenderer(new RenderClaseServicio());
|
||||||
|
claseServicioList.addEventListener("onDoubleClick", new EventListener() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onEvent(Event event) throws Exception {
|
||||||
|
ClaseServicio c = (ClaseServicio) claseServicioList.getSelected();
|
||||||
|
verClaseServicio(c);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
refreshLista();
|
||||||
|
|
||||||
|
txtNome.focus();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void verClaseServicio(ClaseServicio c) {
|
||||||
|
if (c == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Map args = new HashMap();
|
||||||
|
args.put("claseServicio", c);
|
||||||
|
args.put("claseServicioList", claseServicioList);
|
||||||
|
|
||||||
|
openWindow("/gui/catalogos/editarClaseServicio.zul",
|
||||||
|
Labels.getLabel("editarClaseServicioController.window.title"), args, MODAL);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void refreshLista() {
|
||||||
|
HibernateSearchObject<ClaseServicio> claseServicioBusqueda =
|
||||||
|
new HibernateSearchObject<ClaseServicio>(ClaseServicio.class,
|
||||||
|
pagingClaseServicio.getPageSize());
|
||||||
|
|
||||||
|
claseServicioBusqueda.addFilterLike("descclase",
|
||||||
|
"%" + txtNome.getText().trim().concat("%"));
|
||||||
|
claseServicioBusqueda.addFilterNotEqual("claseservicioId", -1);
|
||||||
|
|
||||||
|
claseServicioBusqueda.addSortAsc("descclase");
|
||||||
|
claseServicioBusqueda.addFilterEqual("activo", Boolean.TRUE);
|
||||||
|
|
||||||
|
plwClaseServico.init(claseServicioBusqueda, claseServicioList, pagingClaseServicio);
|
||||||
|
|
||||||
|
if (claseServicioList.getData().length == 0) {
|
||||||
|
try {
|
||||||
|
Messagebox.show(Labels.getLabel("MSG.ningunRegistro"),
|
||||||
|
Labels.getLabel("busquedaClaseServicioController.window.title"),
|
||||||
|
Messagebox.OK, Messagebox.INFORMATION);
|
||||||
|
} catch (InterruptedException ex) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onClick$btnPesquisa(Event ev) {
|
||||||
|
refreshLista();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onClick$btnRefresh(Event ev) {
|
||||||
|
refreshLista();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onClick$btnNovo(Event ev) {
|
||||||
|
verClaseServicio(new ClaseServicio());
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,161 @@
|
||||||
|
/*
|
||||||
|
* To change this template, choose Tools | Templates
|
||||||
|
* and open the template in the editor.
|
||||||
|
*/
|
||||||
|
package com.rjconsultores.ventaboletos.web.gui.controladores.catalogos;
|
||||||
|
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.Ciudad;
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.Colonia;
|
||||||
|
import com.rjconsultores.ventaboletos.service.CiudadService;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.MyGenericForwardComposer;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.MyListbox;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.paginacion.HibernateSearchObject;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.paginacion.PagedListWrapper;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.render.RenderColonia;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.context.annotation.Scope;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.zkoss.util.resource.Labels;
|
||||||
|
import org.zkoss.zhtml.Messagebox;
|
||||||
|
import org.zkoss.zk.ui.Component;
|
||||||
|
import org.zkoss.zk.ui.event.Event;
|
||||||
|
import org.zkoss.zk.ui.event.EventListener;
|
||||||
|
import org.zkoss.zul.Combobox;
|
||||||
|
import org.zkoss.zul.Comboitem;
|
||||||
|
import org.zkoss.zul.Paging;
|
||||||
|
import org.zkoss.zul.Textbox;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Rafius
|
||||||
|
*/
|
||||||
|
@Controller("busquedaColoniaController")
|
||||||
|
@Scope("prototype")
|
||||||
|
public class BusquedaColoniaController extends MyGenericForwardComposer {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private transient PagedListWrapper<Colonia> plwColonia;
|
||||||
|
private MyListbox coloniaList;
|
||||||
|
private Paging pagingColonia;
|
||||||
|
private Textbox txtNombre;
|
||||||
|
private Combobox cmbCiudad;
|
||||||
|
|
||||||
|
public MyListbox getColoniaList() {
|
||||||
|
return coloniaList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setColoniaList(MyListbox coloniaList) {
|
||||||
|
this.coloniaList = coloniaList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Paging getPagingColonia() {
|
||||||
|
return pagingColonia;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPagingColonia(Paging pagingColonia) {
|
||||||
|
this.pagingColonia = pagingColonia;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Textbox getTxtNombre() {
|
||||||
|
return txtNombre;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTxtNombre(Textbox txtNombre) {
|
||||||
|
this.txtNombre = txtNombre;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onClick$btnPesquisa(Event ev) throws InterruptedException {
|
||||||
|
refreshLista();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onClick$btnRefresh(Event ev) {
|
||||||
|
refreshLista();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onClick$btnNovo(Event ev) {
|
||||||
|
verColonia(new Colonia());
|
||||||
|
}
|
||||||
|
|
||||||
|
public Combobox getCmbCiudad() {
|
||||||
|
return cmbCiudad;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCmbCiudad(Combobox cmbCiudad) {
|
||||||
|
this.cmbCiudad = cmbCiudad;
|
||||||
|
}
|
||||||
|
|
||||||
|
public PagedListWrapper<Colonia> getPlwColonia() {
|
||||||
|
return plwColonia;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPlwColonia(PagedListWrapper<Colonia> plwColonia) {
|
||||||
|
this.plwColonia = plwColonia;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void doAfterCompose(Component comp) throws Exception {
|
||||||
|
|
||||||
|
|
||||||
|
super.doAfterCompose(comp);
|
||||||
|
|
||||||
|
coloniaList.setItemRenderer(new RenderColonia());
|
||||||
|
coloniaList.addEventListener("onDoubleClick", new EventListener() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onEvent(Event event) throws Exception {
|
||||||
|
Colonia ciu = (Colonia) coloniaList.getSelected();
|
||||||
|
verColonia(ciu);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
refreshLista();
|
||||||
|
|
||||||
|
txtNombre.focus();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void verColonia(Colonia ci) {
|
||||||
|
if (ci == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Map args = new HashMap();
|
||||||
|
args.put("colonia", ci);
|
||||||
|
args.put("coloniaList", coloniaList);
|
||||||
|
|
||||||
|
openWindow("/gui/catalogos/editarColonia.zul",
|
||||||
|
Labels.getLabel("editarColoniaController.window.title"), args, MODAL);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void refreshLista() {
|
||||||
|
HibernateSearchObject<Colonia> coloniaBusqueda =
|
||||||
|
new HibernateSearchObject<Colonia>(Colonia.class, pagingColonia.getPageSize());
|
||||||
|
|
||||||
|
coloniaBusqueda.addFilterEqual("activo", true);
|
||||||
|
coloniaBusqueda.addFilterLike("desccolonia", "%" + txtNombre.getText().trim().concat("%"));
|
||||||
|
coloniaBusqueda.addFilterNotEqual("coloniaId", -1);
|
||||||
|
|
||||||
|
|
||||||
|
Comboitem cbiCiudad = cmbCiudad.getSelectedItem();
|
||||||
|
|
||||||
|
if (cbiCiudad != null) {
|
||||||
|
Ciudad ciudad = (Ciudad) cbiCiudad.getValue();
|
||||||
|
coloniaBusqueda.addFilterEqual("ciudad", ciudad);
|
||||||
|
}
|
||||||
|
|
||||||
|
coloniaBusqueda.addSortAsc("desccolonia");
|
||||||
|
|
||||||
|
plwColonia.init(coloniaBusqueda, coloniaList, pagingColonia);
|
||||||
|
|
||||||
|
if (coloniaList.getData().length == 0) {
|
||||||
|
try {
|
||||||
|
Messagebox.show(Labels.getLabel("MSG.ningunRegistro"),
|
||||||
|
Labels.getLabel("busquedaColoniaController.window.title"),
|
||||||
|
Messagebox.OK, Messagebox.INFORMATION);
|
||||||
|
} catch (InterruptedException ex) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,162 @@
|
||||||
|
/*
|
||||||
|
* To change this template, choose Tools | Templates
|
||||||
|
* and open the template in the editor.
|
||||||
|
*/
|
||||||
|
package com.rjconsultores.ventaboletos.web.gui.controladores.catalogos;
|
||||||
|
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.CuponConvenio;
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.TipoConvenio;
|
||||||
|
import com.rjconsultores.ventaboletos.service.CuponConvenioService;
|
||||||
|
import com.rjconsultores.ventaboletos.service.TipoConvenioService;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.MyGenericForwardComposer;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.MyListbox;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.paginacion.HibernateSearchObject;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.paginacion.PagedListWrapper;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.render.RenderCuponConvenio;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.context.annotation.Scope;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.zkoss.util.resource.Labels;
|
||||||
|
import org.zkoss.zk.ui.Component;
|
||||||
|
import org.zkoss.zk.ui.event.Event;
|
||||||
|
import org.zkoss.zk.ui.event.EventListener;
|
||||||
|
import org.zkoss.zul.Combobox;
|
||||||
|
import org.zkoss.zul.Paging;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Shiro
|
||||||
|
*/
|
||||||
|
@Controller("busquedaCuponConvenioController")
|
||||||
|
@Scope("prototype")
|
||||||
|
public class BusquedaCuponConvenioController extends MyGenericForwardComposer {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private transient PagedListWrapper<CuponConvenio> plwCuponConvenio;
|
||||||
|
@Autowired
|
||||||
|
private TipoConvenioService tipoConService;
|
||||||
|
@Autowired
|
||||||
|
private CuponConvenioService cuponConService;
|
||||||
|
private MyListbox CuponConvenioList;
|
||||||
|
private Paging pagingCuponC;
|
||||||
|
private Combobox cmbTipoConvenio;
|
||||||
|
private List<TipoConvenio> tipoConList;
|
||||||
|
|
||||||
|
public CuponConvenioService getCuponConService() {
|
||||||
|
return cuponConService;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCuponConService(CuponConvenioService cuponConService) {
|
||||||
|
this.cuponConService = cuponConService;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<TipoConvenio> getTipoConList() {
|
||||||
|
return tipoConList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTipoConList(List<TipoConvenio> tipoConList) {
|
||||||
|
this.tipoConList = tipoConList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public TipoConvenioService getTipoConService() {
|
||||||
|
return tipoConService;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTipoConService(TipoConvenioService tipoConService) {
|
||||||
|
this.tipoConService = tipoConService;
|
||||||
|
}
|
||||||
|
|
||||||
|
public MyListbox getCuponConvenioList() {
|
||||||
|
return CuponConvenioList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCuponConvenioList(MyListbox CuponConvenioList) {
|
||||||
|
this.CuponConvenioList = CuponConvenioList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Combobox getCmbTipoConvenio() {
|
||||||
|
return cmbTipoConvenio;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCmbTipoConvenio(Combobox cmbTipoConvenio) {
|
||||||
|
this.cmbTipoConvenio = cmbTipoConvenio;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Paging getPagingCuponC() {
|
||||||
|
return pagingCuponC;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPagingCuponC(Paging pagingCuponC) {
|
||||||
|
this.pagingCuponC = pagingCuponC;
|
||||||
|
}
|
||||||
|
|
||||||
|
public PagedListWrapper<CuponConvenio> getPlwCuponConvenio() {
|
||||||
|
return plwCuponConvenio;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPlwCuponConvenio(PagedListWrapper<CuponConvenio> plwCuponConvenio) {
|
||||||
|
this.plwCuponConvenio = plwCuponConvenio;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onClick$btnPesquisa(Event ev) throws InterruptedException {
|
||||||
|
TipoConvenio tipoConvenio = (TipoConvenio) (cmbTipoConvenio.getSelectedItem() != null ? cmbTipoConvenio.getSelectedItem().getValue() : null);
|
||||||
|
|
||||||
|
List<CuponConvenio> cuponConveniosList = cuponConService.pesquisar(tipoConvenio);
|
||||||
|
CuponConvenioList.setData(cuponConveniosList);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onClick$btnRefresh(Event ev) {
|
||||||
|
refreshLista();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onClick$btnNovo(Event ev) {
|
||||||
|
verCuponConvenio(new CuponConvenio());
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void doAfterCompose(Component comp) throws Exception {
|
||||||
|
|
||||||
|
tipoConList = tipoConService.obtenerTodos();
|
||||||
|
super.doAfterCompose(comp);
|
||||||
|
|
||||||
|
CuponConvenioList.setItemRenderer(new RenderCuponConvenio());
|
||||||
|
CuponConvenioList.addEventListener("onDoubleClick", new EventListener() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onEvent(Event event) throws Exception {
|
||||||
|
CuponConvenio cc = (CuponConvenio) CuponConvenioList.getSelected();
|
||||||
|
verCuponConvenio(cc);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
refreshLista();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void verCuponConvenio(CuponConvenio cc) {
|
||||||
|
if (cc == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Map args = new HashMap();
|
||||||
|
args.put("cc", cc);
|
||||||
|
args.put("CuponConvenioList", CuponConvenioList);
|
||||||
|
|
||||||
|
openWindow("/gui/catalogos/editarCuponConvenio.zul",
|
||||||
|
Labels.getLabel("editarProductoServicioController.window.title"), args, MODAL);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void refreshLista() {
|
||||||
|
HibernateSearchObject<CuponConvenio> cupon =
|
||||||
|
new HibernateSearchObject<CuponConvenio>(CuponConvenio.class, pagingCuponC.getPageSize());
|
||||||
|
|
||||||
|
cupon.addFilterEqual("activo", Boolean.TRUE);
|
||||||
|
cupon.addFilterNotEqual("cuponConvenioID", -1);
|
||||||
|
|
||||||
|
cupon.addSortAsc("tipoConvenio.descTipo");
|
||||||
|
|
||||||
|
plwCuponConvenio.init(cupon, CuponConvenioList, pagingCuponC);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,229 @@
|
||||||
|
/*
|
||||||
|
* To change this template, choose Tools | Templates
|
||||||
|
* and open the template in the editor.
|
||||||
|
*/
|
||||||
|
package com.rjconsultores.ventaboletos.web.gui.controladores.catalogos;
|
||||||
|
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.Empresa;
|
||||||
|
import com.rjconsultores.ventaboletos.utilerias.ApplicationProperties;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.MyGenericForwardComposer;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.MyListbox;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.paginacion.HibernateSearchObject;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.paginacion.PagedListWrapper;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.render.RenderEmpresa;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.context.annotation.Scope;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.zkoss.util.resource.Labels;
|
||||||
|
import org.zkoss.zhtml.Messagebox;
|
||||||
|
import org.zkoss.zk.ui.Component;
|
||||||
|
import org.zkoss.zk.ui.event.Event;
|
||||||
|
import org.zkoss.zk.ui.event.EventListener;
|
||||||
|
import org.zkoss.zul.Combobox;
|
||||||
|
import org.zkoss.zul.Comboitem;
|
||||||
|
import org.zkoss.zul.Listheader;
|
||||||
|
import org.zkoss.zul.Paging;
|
||||||
|
import org.zkoss.zul.Row;
|
||||||
|
import org.zkoss.zul.Textbox;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Rafius
|
||||||
|
*/
|
||||||
|
@Controller("busquedaEmpresaController")
|
||||||
|
@Scope("prototype")
|
||||||
|
public class BusquedaEmpresaController extends MyGenericForwardComposer {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private transient PagedListWrapper<Empresa> plwEmpresa;
|
||||||
|
private MyListbox empresaList;
|
||||||
|
private Paging pagingEmpresa;
|
||||||
|
private Textbox txtNombre;
|
||||||
|
private Textbox txtEquivalencia;
|
||||||
|
private Textbox txtRFC;
|
||||||
|
private Combobox cmbExterna;
|
||||||
|
private Combobox cmbIndTipo;
|
||||||
|
private Row rowEquivalencia;
|
||||||
|
private Listheader headerEquivalencia;
|
||||||
|
|
||||||
|
public Combobox getCmbExterna() {
|
||||||
|
return cmbExterna;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCmbExterna(Combobox cmbExterna) {
|
||||||
|
this.cmbExterna = cmbExterna;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Paging getPagingEmpresa() {
|
||||||
|
return pagingEmpresa;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPagingEmpresa(Paging pagingEmpresa) {
|
||||||
|
this.pagingEmpresa = pagingEmpresa;
|
||||||
|
}
|
||||||
|
|
||||||
|
public MyListbox getEmpresaList() {
|
||||||
|
return empresaList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEmpresaList(MyListbox empresaList) {
|
||||||
|
this.empresaList = empresaList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public PagedListWrapper<Empresa> getPlwEmpresa() {
|
||||||
|
return plwEmpresa;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPlwEmpresa(PagedListWrapper<Empresa> plwEmpresa) {
|
||||||
|
this.plwEmpresa = plwEmpresa;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Textbox getTxtEquivalencia() {
|
||||||
|
return txtEquivalencia;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTxtEquivalencia(Textbox txtEquivalencia) {
|
||||||
|
this.txtEquivalencia = txtEquivalencia;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Listheader getHeaderEquivalencia() {
|
||||||
|
return headerEquivalencia;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setHeaderEquivalencia(Listheader headerEquivalencia) {
|
||||||
|
this.headerEquivalencia = headerEquivalencia;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Row getRowEquivalencia() {
|
||||||
|
return rowEquivalencia;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRowEquivalencia(Row rowEquivalencia) {
|
||||||
|
this.rowEquivalencia = rowEquivalencia;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Textbox getTxtRFC() {
|
||||||
|
return txtRFC;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTxtRFC(Textbox txtRFC) {
|
||||||
|
this.txtRFC = txtRFC;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onClick$btnPesquisa(Event ev) throws InterruptedException {
|
||||||
|
refreshLista();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onClick$btnRefresh(Event ev) {
|
||||||
|
refreshLista();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onClick$btnNovo(Event ev) {
|
||||||
|
verPeriodo(new Empresa());
|
||||||
|
}
|
||||||
|
|
||||||
|
public Combobox getCmbIndTipo() {
|
||||||
|
return cmbIndTipo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCmbIndTipo(Combobox cmbIndTipo) {
|
||||||
|
this.cmbIndTipo = cmbIndTipo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Textbox getTxtNombre() {
|
||||||
|
return txtNombre;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTxtNombre(Textbox txtNombre) {
|
||||||
|
this.txtNombre = txtNombre;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void doAfterCompose(Component comp) throws Exception {
|
||||||
|
super.doAfterCompose(comp);
|
||||||
|
|
||||||
|
empresaList.setItemRenderer(new RenderEmpresa());
|
||||||
|
empresaList.addEventListener("onDoubleClick", new EventListener() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onEvent(Event event) throws Exception {
|
||||||
|
Empresa emp = (Empresa) empresaList.getSelected();
|
||||||
|
verPeriodo(emp);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
refreshLista();
|
||||||
|
|
||||||
|
|
||||||
|
if (!ApplicationProperties.getInstance().mostrarEquivalencia()) {
|
||||||
|
rowEquivalencia.setVisible(Boolean.FALSE);
|
||||||
|
headerEquivalencia.setVisible(Boolean.FALSE);
|
||||||
|
}
|
||||||
|
|
||||||
|
txtNombre.focus();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void verPeriodo(Empresa emp) {
|
||||||
|
if (emp == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Map args = new HashMap();
|
||||||
|
args.put("empresa", emp);
|
||||||
|
args.put("empresaList", empresaList);
|
||||||
|
|
||||||
|
openWindow("/gui/catalogos/editarEmpresa.zul",
|
||||||
|
Labels.getLabel("editarEmpresaController.window.title"), args, MODAL);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void refreshLista() {
|
||||||
|
HibernateSearchObject<Empresa> empresaBusqueda =
|
||||||
|
new HibernateSearchObject<Empresa>(Empresa.class, pagingEmpresa.getPageSize());
|
||||||
|
|
||||||
|
Comboitem ci = cmbExterna.getSelectedItem();
|
||||||
|
String value;
|
||||||
|
if (ci != null) {
|
||||||
|
value = (String) ci.getValue();
|
||||||
|
|
||||||
|
if (value.equals("1")) {
|
||||||
|
empresaBusqueda.addFilterEqual("indExterna", Boolean.TRUE);
|
||||||
|
} else {
|
||||||
|
empresaBusqueda.addFilterEqual("indExterna", Boolean.FALSE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Comboitem cbiTipo = cmbIndTipo.getSelectedItem();
|
||||||
|
Short tipo = null;
|
||||||
|
if (cbiTipo != null) {
|
||||||
|
tipo = Short.parseShort(cbiTipo.getValue().toString());
|
||||||
|
empresaBusqueda.addFilterEqual("indTipo", tipo);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!txtRFC.getText().isEmpty()) {
|
||||||
|
empresaBusqueda.addFilterEqual("rfc", txtRFC.getText());
|
||||||
|
}
|
||||||
|
|
||||||
|
empresaBusqueda.addFilterNotEqual("empresaId", -1);
|
||||||
|
empresaBusqueda.addFilterLike("nombempresa", "%" + txtNombre.getText().trim().concat("%"));
|
||||||
|
|
||||||
|
if (!txtEquivalencia.getText().isEmpty()) {
|
||||||
|
empresaBusqueda.addFilterEqual("equivalenciaId", txtEquivalencia.getText());
|
||||||
|
}
|
||||||
|
|
||||||
|
empresaBusqueda.addFilterEqual("activo", Boolean.TRUE);
|
||||||
|
empresaBusqueda.addSortAsc("nombempresa");
|
||||||
|
|
||||||
|
plwEmpresa.init(empresaBusqueda, empresaList, pagingEmpresa);
|
||||||
|
|
||||||
|
if (empresaList.getData().length == 0) {
|
||||||
|
try {
|
||||||
|
Messagebox.show(Labels.getLabel("MSG.ningunRegistro"),
|
||||||
|
Labels.getLabel("busquedaEmpresaController.window.title"),
|
||||||
|
Messagebox.OK, Messagebox.INFORMATION);
|
||||||
|
} catch (InterruptedException ex) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,208 @@
|
||||||
|
/*
|
||||||
|
* To change this template, choose Tools | Templates
|
||||||
|
* and open the template in the editor.
|
||||||
|
*/
|
||||||
|
package com.rjconsultores.ventaboletos.web.gui.controladores.catalogos;
|
||||||
|
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.Estado;
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.Pais;
|
||||||
|
import com.rjconsultores.ventaboletos.service.PaisService;
|
||||||
|
import com.rjconsultores.ventaboletos.utilerias.ApplicationProperties;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.MyGenericForwardComposer;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.MyListbox;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.paginacion.HibernateSearchObject;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.paginacion.PagedListWrapper;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.render.RenderEstado;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.context.annotation.Scope;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.zkoss.util.resource.Labels;
|
||||||
|
import org.zkoss.zk.ui.Component;
|
||||||
|
import org.zkoss.zk.ui.event.Event;
|
||||||
|
import org.zkoss.zk.ui.event.EventListener;
|
||||||
|
import org.zkoss.zul.Combobox;
|
||||||
|
import org.zkoss.zul.Comboitem;
|
||||||
|
import org.zkoss.zul.Listheader;
|
||||||
|
import org.zkoss.zul.Messagebox;
|
||||||
|
import org.zkoss.zul.Paging;
|
||||||
|
import org.zkoss.zul.Row;
|
||||||
|
import org.zkoss.zul.Textbox;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Rafius
|
||||||
|
*/
|
||||||
|
@Controller("busquedaEstadoController")
|
||||||
|
@Scope("prototype")
|
||||||
|
public class BusquedaEstadoController extends MyGenericForwardComposer {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private PaisService paisService;
|
||||||
|
@Autowired
|
||||||
|
private transient PagedListWrapper<Estado> plwEstado;
|
||||||
|
private MyListbox estadoList;
|
||||||
|
private Paging pagingEstado;
|
||||||
|
private Textbox txtNombre;
|
||||||
|
private Textbox txtEquivalencia;
|
||||||
|
private Combobox cmbPais;
|
||||||
|
private List<Pais> lsPais;
|
||||||
|
private Row rowEquivalencia;
|
||||||
|
private Listheader headerEquivalencia;
|
||||||
|
|
||||||
|
public Combobox getCmbPais() {
|
||||||
|
return cmbPais;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCmbPais(Combobox cmbPais) {
|
||||||
|
this.cmbPais = cmbPais;
|
||||||
|
}
|
||||||
|
|
||||||
|
public MyListbox getEstadoList() {
|
||||||
|
return estadoList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEstadoList(MyListbox estadoList) {
|
||||||
|
this.estadoList = estadoList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<Pais> getLsPais() {
|
||||||
|
return lsPais;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLsPais(List<Pais> lsPais) {
|
||||||
|
this.lsPais = lsPais;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Paging getPagingEstado() {
|
||||||
|
return pagingEstado;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPagingEstado(Paging pagingEstado) {
|
||||||
|
this.pagingEstado = pagingEstado;
|
||||||
|
}
|
||||||
|
|
||||||
|
public PaisService getPaisService() {
|
||||||
|
return paisService;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPaisService(PaisService paisService) {
|
||||||
|
this.paisService = paisService;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Textbox getTxtNombre() {
|
||||||
|
return txtNombre;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTxtNombre(Textbox txtNombre) {
|
||||||
|
this.txtNombre = txtNombre;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Textbox getTxtEquivalencia() {
|
||||||
|
return txtEquivalencia;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTxtEquivalencia(Textbox txtEquivalencia) {
|
||||||
|
this.txtEquivalencia = txtEquivalencia;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Listheader getHeaderEquivalencia() {
|
||||||
|
return headerEquivalencia;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setHeaderEquivalencia(Listheader headerEquivalencia) {
|
||||||
|
this.headerEquivalencia = headerEquivalencia;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Row getRowEquivalencia() {
|
||||||
|
return rowEquivalencia;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRowEquivalencia(Row rowEquivalencia) {
|
||||||
|
this.rowEquivalencia = rowEquivalencia;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void doAfterCompose(Component comp) throws Exception {
|
||||||
|
|
||||||
|
lsPais = paisService.obtenerTodos();
|
||||||
|
super.doAfterCompose(comp);
|
||||||
|
|
||||||
|
estadoList.setItemRenderer(new RenderEstado());
|
||||||
|
estadoList.addEventListener("onDoubleClick", new EventListener() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onEvent(Event event) throws Exception {
|
||||||
|
Estado est = (Estado) estadoList.getSelected();
|
||||||
|
verPeriodo(est);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
refreshLista();
|
||||||
|
|
||||||
|
|
||||||
|
if (!ApplicationProperties.getInstance().mostrarEquivalencia()) {
|
||||||
|
rowEquivalencia.setVisible(Boolean.FALSE);
|
||||||
|
headerEquivalencia.setVisible(Boolean.FALSE);
|
||||||
|
}
|
||||||
|
|
||||||
|
txtNombre.focus();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onClick$btnRefresh(Event ev) throws InterruptedException {
|
||||||
|
refreshLista();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onClick$btnPesquisa(Event ev) throws InterruptedException {
|
||||||
|
refreshLista();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onClick$btnNovo(Event ev) throws InterruptedException {
|
||||||
|
verPeriodo(new Estado());
|
||||||
|
}
|
||||||
|
|
||||||
|
private void verPeriodo(Estado e) {
|
||||||
|
if (e == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Map args = new HashMap();
|
||||||
|
args.put("estado", e);
|
||||||
|
args.put("estadoList", estadoList);
|
||||||
|
|
||||||
|
openWindow("/gui/catalogos/editarEstado.zul",
|
||||||
|
Labels.getLabel("editarEstadoController.window.title"), args, MODAL);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void refreshLista() throws InterruptedException {
|
||||||
|
HibernateSearchObject<Estado> estadoBusqueda =
|
||||||
|
new HibernateSearchObject<Estado>(Estado.class, pagingEstado.getPageSize());
|
||||||
|
|
||||||
|
estadoBusqueda.addFilterLike("nombestado", "%" + txtNombre.getText().trim().concat("%"));
|
||||||
|
|
||||||
|
Comboitem itemPais = cmbPais.getSelectedItem();
|
||||||
|
if (itemPais != null) {
|
||||||
|
Pais pais = (Pais) itemPais.getValue();
|
||||||
|
estadoBusqueda.addFilterEqual("pais", pais);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!txtEquivalencia.getText().isEmpty()) {
|
||||||
|
estadoBusqueda.addFilterLike("equivalenciaId", txtEquivalencia.getText().trim().concat("%"));
|
||||||
|
}
|
||||||
|
|
||||||
|
estadoBusqueda.addFilterEqual("activo", Boolean.TRUE);
|
||||||
|
estadoBusqueda.addSortAsc("nombestado");
|
||||||
|
estadoBusqueda.addFilterNotEqual("estadoId", -1);
|
||||||
|
|
||||||
|
plwEstado.init(estadoBusqueda, estadoList, pagingEstado);
|
||||||
|
|
||||||
|
if (estadoList.getData().length == 0) {
|
||||||
|
Messagebox.show(
|
||||||
|
Labels.getLabel("MSG.ningunRegistro"),
|
||||||
|
Labels.getLabel("busquedaEstadoController.window.title"),
|
||||||
|
Messagebox.OK, Messagebox.INFORMATION);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,170 @@
|
||||||
|
/*
|
||||||
|
* To change this template, choose Tools | Templates
|
||||||
|
* and open the template in the editor.
|
||||||
|
*/
|
||||||
|
package com.rjconsultores.ventaboletos.web.gui.controladores.catalogos;
|
||||||
|
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.FormaPago;
|
||||||
|
import com.rjconsultores.ventaboletos.utilerias.ApplicationProperties;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.MyGenericForwardComposer;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.MyListbox;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.paginacion.HibernateSearchObject;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.paginacion.PagedListWrapper;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.render.RenderFormaPago;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
import org.zkoss.zk.ui.Component;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.context.annotation.Scope;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.zkoss.util.resource.Labels;
|
||||||
|
import org.zkoss.zhtml.Messagebox;
|
||||||
|
import org.zkoss.zk.ui.event.Event;
|
||||||
|
import org.zkoss.zk.ui.event.EventListener;
|
||||||
|
import org.zkoss.zul.Listheader;
|
||||||
|
import org.zkoss.zul.Paging;
|
||||||
|
import org.zkoss.zul.Row;
|
||||||
|
import org.zkoss.zul.Textbox;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Administrador
|
||||||
|
*/
|
||||||
|
@Controller("busquedaFormaPagoController")
|
||||||
|
@Scope("prototype")
|
||||||
|
public class BusquedaFormaPagoController extends MyGenericForwardComposer {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private transient PagedListWrapper<FormaPago> plwFormaPago;
|
||||||
|
private MyListbox formaPagoList;
|
||||||
|
private Paging pagingFormaPago;
|
||||||
|
private Textbox txtNome;
|
||||||
|
private Textbox txtEquivalencia;
|
||||||
|
private Row rowEquivalencia;
|
||||||
|
private Listheader headerEquivalencia;
|
||||||
|
|
||||||
|
public MyListbox getFormaPagoList() {
|
||||||
|
return formaPagoList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFormaPagoList(MyListbox formaPagoList) {
|
||||||
|
this.formaPagoList = formaPagoList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Paging getPagingFormaPago() {
|
||||||
|
return pagingFormaPago;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPagingFormaPago(Paging pagingFormaPago) {
|
||||||
|
this.pagingFormaPago = pagingFormaPago;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Textbox getTxtNome() {
|
||||||
|
return txtNome;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTxtNome(Textbox txtNome) {
|
||||||
|
this.txtNome = txtNome;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Textbox getTxtEquivalencia() {
|
||||||
|
return txtEquivalencia;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTxtEquivalencia(Textbox txtEquivalencia) {
|
||||||
|
this.txtEquivalencia = txtEquivalencia;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Listheader getHeaderEquivalencia() {
|
||||||
|
return headerEquivalencia;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setHeaderEquivalencia(Listheader headerEquivalencia) {
|
||||||
|
this.headerEquivalencia = headerEquivalencia;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Row getRowEquivalencia() {
|
||||||
|
return rowEquivalencia;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRowEquivalencia(Row rowEquivalencia) {
|
||||||
|
this.rowEquivalencia = rowEquivalencia;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void doAfterCompose(Component comp) throws Exception {
|
||||||
|
super.doAfterCompose(comp);
|
||||||
|
|
||||||
|
formaPagoList.setItemRenderer(new RenderFormaPago());
|
||||||
|
formaPagoList.addEventListener("onDoubleClick", new EventListener() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onEvent(Event event) throws Exception {
|
||||||
|
FormaPago c = (FormaPago) formaPagoList.getSelected();
|
||||||
|
verFormaPago(c);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
refreshLista();
|
||||||
|
|
||||||
|
if (!ApplicationProperties.getInstance().mostrarEquivalencia()) {
|
||||||
|
rowEquivalencia.setVisible(Boolean.FALSE);
|
||||||
|
headerEquivalencia.setVisible(Boolean.FALSE);
|
||||||
|
}
|
||||||
|
|
||||||
|
txtNome.focus();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void verFormaPago(FormaPago f) {
|
||||||
|
if (f == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Map args = new HashMap();
|
||||||
|
args.put("formaPago", f);
|
||||||
|
args.put("busquedaFormaPagoController", this);
|
||||||
|
args.put("formaPagoList", formaPagoList);
|
||||||
|
|
||||||
|
openWindow("/gui/catalogos/editarFormaPago.zul",
|
||||||
|
Labels.getLabel("editarFormaPagoController.window.title"), args, MODAL);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void refreshLista() {
|
||||||
|
HibernateSearchObject<FormaPago> formaPagoBusqueda =
|
||||||
|
new HibernateSearchObject<FormaPago>(FormaPago.class,
|
||||||
|
pagingFormaPago.getPageSize());
|
||||||
|
|
||||||
|
formaPagoBusqueda.addFilterLike("descpago", "%" + txtNome.getText().trim().concat("%"));
|
||||||
|
|
||||||
|
if (!txtEquivalencia.getText().isEmpty()) {
|
||||||
|
formaPagoBusqueda.addFilterLike("equivalenciaId", txtEquivalencia.getText().trim().concat("%"));
|
||||||
|
}
|
||||||
|
|
||||||
|
formaPagoBusqueda.addFilterNotEqual("formapagoId", -1);
|
||||||
|
formaPagoBusqueda.addSortAsc("descpago");
|
||||||
|
formaPagoBusqueda.addFilterEqual("activo", Boolean.TRUE);
|
||||||
|
|
||||||
|
plwFormaPago.init(formaPagoBusqueda, formaPagoList, pagingFormaPago);
|
||||||
|
|
||||||
|
if (formaPagoList.getData().length == 0) {
|
||||||
|
try {
|
||||||
|
Messagebox.show(Labels.getLabel("MSG.ningunRegistro"),
|
||||||
|
Labels.getLabel("busquedaFormaPagoController.window.title"),
|
||||||
|
Messagebox.OK, Messagebox.INFORMATION);
|
||||||
|
} catch (InterruptedException ex) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onClick$btnPesquisa(Event ev) {
|
||||||
|
refreshLista();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onClick$btnRefresh(Event ev) {
|
||||||
|
refreshLista();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onClick$btnNovo(Event ev) {
|
||||||
|
verFormaPago(new FormaPago());
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,172 @@
|
||||||
|
/*
|
||||||
|
* To change this template, choose Tools | Templates
|
||||||
|
* and open the template in the editor.
|
||||||
|
*/
|
||||||
|
package com.rjconsultores.ventaboletos.web.gui.controladores.catalogos;
|
||||||
|
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.Marca;
|
||||||
|
import com.rjconsultores.ventaboletos.utilerias.ApplicationProperties;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.MyGenericForwardComposer;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.MyListbox;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.paginacion.HibernateSearchObject;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.paginacion.PagedListWrapper;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.render.RenderMarca;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.context.annotation.Scope;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.zkoss.util.resource.Labels;
|
||||||
|
import org.zkoss.zhtml.Messagebox;
|
||||||
|
import org.zkoss.zk.ui.Component;
|
||||||
|
import org.zkoss.zk.ui.event.Event;
|
||||||
|
import org.zkoss.zk.ui.event.EventListener;
|
||||||
|
import org.zkoss.zul.Listheader;
|
||||||
|
import org.zkoss.zul.Paging;
|
||||||
|
import org.zkoss.zul.Row;
|
||||||
|
import org.zkoss.zul.Textbox;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Administrador
|
||||||
|
*/
|
||||||
|
@Controller("busquedaMarcaController")
|
||||||
|
@Scope("prototype")
|
||||||
|
public class BusquedaMarcaController extends MyGenericForwardComposer {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private transient PagedListWrapper<Marca> plwMarca;
|
||||||
|
private MyListbox marcaList;
|
||||||
|
private Paging pagingMarca;
|
||||||
|
private Textbox txtNome;
|
||||||
|
private Textbox txtEquivalencia;
|
||||||
|
private Row rowEquivalencia;
|
||||||
|
private Listheader headerEquivalencia;
|
||||||
|
|
||||||
|
public MyListbox getMarcaList() {
|
||||||
|
return marcaList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMarcaList(MyListbox marcaList) {
|
||||||
|
this.marcaList = marcaList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Paging getPagingMarca() {
|
||||||
|
return pagingMarca;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPagingMarca(Paging pagingMarca) {
|
||||||
|
this.pagingMarca = pagingMarca;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Textbox getTxtNome() {
|
||||||
|
return txtNome;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTxtNome(Textbox txtNome) {
|
||||||
|
this.txtNome = txtNome;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Textbox getTxtEquivalencia() {
|
||||||
|
return txtEquivalencia;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTxtEquivalencia(Textbox txtEquivalencia) {
|
||||||
|
this.txtEquivalencia = txtEquivalencia;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Listheader getHeaderEquivalencia() {
|
||||||
|
return headerEquivalencia;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setHeaderEquivalencia(Listheader headerEquivalencia) {
|
||||||
|
this.headerEquivalencia = headerEquivalencia;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Row getRowEquivalencia() {
|
||||||
|
return rowEquivalencia;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRowEquivalencia(Row rowEquivalencia) {
|
||||||
|
this.rowEquivalencia = rowEquivalencia;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void doAfterCompose(Component comp) throws Exception {
|
||||||
|
super.doAfterCompose(comp);
|
||||||
|
|
||||||
|
marcaList.setItemRenderer(new RenderMarca());
|
||||||
|
marcaList.addEventListener("onDoubleClick", new EventListener() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onEvent(Event event) throws Exception {
|
||||||
|
Marca c = (Marca) marcaList.getSelected();
|
||||||
|
verMarca(c);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
refreshLista();
|
||||||
|
|
||||||
|
if (!ApplicationProperties.getInstance().mostrarEquivalencia()) {
|
||||||
|
rowEquivalencia.setVisible(Boolean.FALSE);
|
||||||
|
headerEquivalencia.setVisible(Boolean.FALSE);
|
||||||
|
}
|
||||||
|
|
||||||
|
txtNome.focus();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void verMarca(Marca m) {
|
||||||
|
if (m == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Map args = new HashMap();
|
||||||
|
args.put("busquedaMarcaController", this);
|
||||||
|
args.put("marca", m);
|
||||||
|
args.put("marcaList", marcaList);
|
||||||
|
|
||||||
|
openWindow("/gui/catalogos/editarMarca.zul",
|
||||||
|
Labels.getLabel("editarMarcaController.window.title"), args, MODAL);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void refreshLista() {
|
||||||
|
HibernateSearchObject<Marca> marcaBusqueda =
|
||||||
|
new HibernateSearchObject<Marca>(Marca.class,
|
||||||
|
pagingMarca.getPageSize());
|
||||||
|
|
||||||
|
marcaBusqueda.addFilterLike("descmarca",
|
||||||
|
"%" + txtNome.getText().trim().concat("%"));
|
||||||
|
|
||||||
|
if (!txtEquivalencia.getText().isEmpty()) {
|
||||||
|
marcaBusqueda.addFilterEqual("equivalenciaId", txtEquivalencia.getText());
|
||||||
|
}
|
||||||
|
|
||||||
|
marcaBusqueda.addSortAsc("descmarca");
|
||||||
|
marcaBusqueda.addFilterEqual("activo", Boolean.TRUE);
|
||||||
|
|
||||||
|
marcaBusqueda.addFilterNotEqual("marcaId", -1);
|
||||||
|
|
||||||
|
plwMarca.init(marcaBusqueda, marcaList, pagingMarca);
|
||||||
|
|
||||||
|
if (marcaList.getData().length == 0) {
|
||||||
|
try {
|
||||||
|
Messagebox.show(Labels.getLabel("MSG.ningunRegistro"),
|
||||||
|
Labels.getLabel("busquedaMarcaController.window.title"),
|
||||||
|
Messagebox.OK, Messagebox.INFORMATION);
|
||||||
|
} catch (InterruptedException ex) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onClick$btnPesquisa(Event ev) {
|
||||||
|
refreshLista();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onClick$btnRefresh(Event ev) {
|
||||||
|
refreshLista();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onClick$btnNovo(Event ev) {
|
||||||
|
verMarca(new Marca());
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,174 @@
|
||||||
|
/*
|
||||||
|
* To change this template, choose Tools | Templates
|
||||||
|
* and open the template in the editor.
|
||||||
|
*/
|
||||||
|
package com.rjconsultores.ventaboletos.web.gui.controladores.catalogos;
|
||||||
|
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.Moneda;
|
||||||
|
import com.rjconsultores.ventaboletos.utilerias.ApplicationProperties;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.MyGenericForwardComposer;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.MyListbox;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.paginacion.HibernateSearchObject;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.paginacion.PagedListWrapper;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.render.RenderMoneda;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.context.annotation.Scope;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.zkoss.util.resource.Labels;
|
||||||
|
import org.zkoss.zk.ui.Component;
|
||||||
|
import org.zkoss.zk.ui.event.Event;
|
||||||
|
import org.zkoss.zk.ui.event.EventListener;
|
||||||
|
import org.zkoss.zul.Listheader;
|
||||||
|
import org.zkoss.zul.Messagebox;
|
||||||
|
import org.zkoss.zul.Paging;
|
||||||
|
import org.zkoss.zul.Row;
|
||||||
|
import org.zkoss.zul.Textbox;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Rafius
|
||||||
|
*/
|
||||||
|
@Controller("busquedaMonedaController")
|
||||||
|
@Scope("prototype")
|
||||||
|
public class BusquedaMonedaController extends MyGenericForwardComposer {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private transient PagedListWrapper<Moneda> plwMoneda;
|
||||||
|
private MyListbox monedaList;
|
||||||
|
private Paging pagingMoneda;
|
||||||
|
private Textbox txtNombre;
|
||||||
|
private Textbox txtEquivalencia;
|
||||||
|
private Row rowEquivalencia;
|
||||||
|
private Listheader headerEquivalencia;
|
||||||
|
|
||||||
|
public Paging getPagingMoneda() {
|
||||||
|
return pagingMoneda;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPagingMoneda(Paging pagingMoneda) {
|
||||||
|
this.pagingMoneda = pagingMoneda;
|
||||||
|
}
|
||||||
|
|
||||||
|
public MyListbox getMonedaList() {
|
||||||
|
return monedaList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMonedaList(MyListbox monedaList) {
|
||||||
|
this.monedaList = monedaList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public PagedListWrapper<Moneda> getPlwMoneda() {
|
||||||
|
return plwMoneda;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPlwMoneda(PagedListWrapper<Moneda> plwMoneda) {
|
||||||
|
this.plwMoneda = plwMoneda;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Textbox getTxtEquivalencia() {
|
||||||
|
return txtEquivalencia;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTxtEquivalencia(Textbox txtEquivalencia) {
|
||||||
|
this.txtEquivalencia = txtEquivalencia;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Textbox getTxtNombre() {
|
||||||
|
return txtNombre;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTxtNombre(Textbox txtNombre) {
|
||||||
|
this.txtNombre = txtNombre;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Listheader getHeaderEquivalencia() {
|
||||||
|
return headerEquivalencia;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setHeaderEquivalencia(Listheader headerEquivalencia) {
|
||||||
|
this.headerEquivalencia = headerEquivalencia;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Row getRowEquivalencia() {
|
||||||
|
return rowEquivalencia;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRowEquivalencia(Row rowEquivalencia) {
|
||||||
|
this.rowEquivalencia = rowEquivalencia;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onClick$btnPesquisa(Event ev) throws InterruptedException {
|
||||||
|
refreshLista();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onClick$btnRefresh(Event ev) throws InterruptedException {
|
||||||
|
refreshLista();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onClick$btnNovo(Event ev) {
|
||||||
|
verPeriodo(new Moneda());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void doAfterCompose(Component comp) throws Exception {
|
||||||
|
super.doAfterCompose(comp);
|
||||||
|
|
||||||
|
monedaList.setItemRenderer(new RenderMoneda());
|
||||||
|
monedaList.addEventListener("onDoubleClick", new EventListener() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onEvent(Event event) throws Exception {
|
||||||
|
Moneda c = (Moneda) monedaList.getSelected();
|
||||||
|
verPeriodo(c);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
refreshLista();
|
||||||
|
|
||||||
|
if (!ApplicationProperties.getInstance().mostrarEquivalencia()) {
|
||||||
|
rowEquivalencia.setVisible(Boolean.FALSE);
|
||||||
|
headerEquivalencia.setVisible(Boolean.FALSE);
|
||||||
|
}
|
||||||
|
|
||||||
|
txtNombre.focus();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void verPeriodo(Moneda c) {
|
||||||
|
if (c == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Map args = new HashMap();
|
||||||
|
args.put("busquedaMonedaController", this);
|
||||||
|
args.put("moneda", c);
|
||||||
|
args.put("monedaList", monedaList);
|
||||||
|
|
||||||
|
openWindow("/gui/catalogos/editarMoneda.zul",
|
||||||
|
Labels.getLabel("editarMonedaController.window.title"), args, MODAL);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void refreshLista() throws InterruptedException {
|
||||||
|
HibernateSearchObject<Moneda> monedaBusqueda =
|
||||||
|
new HibernateSearchObject<Moneda>(Moneda.class, pagingMoneda.getPageSize());
|
||||||
|
|
||||||
|
monedaBusqueda.addFilterLike("descmoneda", "%" + txtNombre.getText().trim().concat("%"));
|
||||||
|
if (!txtEquivalencia.getText().isEmpty()) {
|
||||||
|
monedaBusqueda.addFilterLike("equivalenciaId", txtEquivalencia.getText().trim().concat("%"));
|
||||||
|
}
|
||||||
|
|
||||||
|
monedaBusqueda.addFilterEqual("activo", Boolean.TRUE);
|
||||||
|
monedaBusqueda.addSortAsc("descmoneda");
|
||||||
|
monedaBusqueda.addFilterNotEqual("monedaId", -1);
|
||||||
|
|
||||||
|
plwMoneda.init(monedaBusqueda, monedaList, pagingMoneda);
|
||||||
|
|
||||||
|
if (monedaList.getData().length == 0) {
|
||||||
|
Messagebox.show(
|
||||||
|
Labels.getLabel("MSG.ningunRegistro"),
|
||||||
|
Labels.getLabel("busquedaMonedaController.window.title"),
|
||||||
|
Messagebox.OK, Messagebox.INFORMATION);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,157 @@
|
||||||
|
/*
|
||||||
|
* To change this template, choose Tools | Templates
|
||||||
|
* and open the template in the editor.
|
||||||
|
*/
|
||||||
|
package com.rjconsultores.ventaboletos.web.gui.controladores.catalogos;
|
||||||
|
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.Pais;
|
||||||
|
import com.rjconsultores.ventaboletos.utilerias.ApplicationProperties;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.MyGenericForwardComposer;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.MyListbox;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.paginacion.HibernateSearchObject;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.paginacion.PagedListWrapper;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.render.RenderPais;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.context.annotation.Scope;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.zkoss.util.resource.Labels;
|
||||||
|
import org.zkoss.zk.ui.Component;
|
||||||
|
import org.zkoss.zk.ui.event.Event;
|
||||||
|
import org.zkoss.zk.ui.event.EventListener;
|
||||||
|
import org.zkoss.zul.Listheader;
|
||||||
|
import org.zkoss.zul.Messagebox;
|
||||||
|
import org.zkoss.zul.Paging;
|
||||||
|
import org.zkoss.zul.Row;
|
||||||
|
import org.zkoss.zul.Textbox;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Rafius
|
||||||
|
*/
|
||||||
|
@Controller("busquedaPaisController")
|
||||||
|
@Scope("prototype")
|
||||||
|
public class BusquedaPaisController extends MyGenericForwardComposer {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private transient PagedListWrapper<Pais> plwPais;
|
||||||
|
private MyListbox paisList;
|
||||||
|
private Paging pagingPais;
|
||||||
|
private Textbox txtNombre;
|
||||||
|
private Row rowEquivalencia;
|
||||||
|
private Listheader headerEquivalencia;
|
||||||
|
|
||||||
|
public Paging getPagingPais() {
|
||||||
|
return pagingPais;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPagingPais(Paging pagingPais) {
|
||||||
|
this.pagingPais = pagingPais;
|
||||||
|
}
|
||||||
|
|
||||||
|
public MyListbox getPaisList() {
|
||||||
|
return paisList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPaisList(MyListbox paisList) {
|
||||||
|
this.paisList = paisList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public PagedListWrapper<Pais> getPlwPais() {
|
||||||
|
return plwPais;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPlwPais(PagedListWrapper<Pais> plwPais) {
|
||||||
|
this.plwPais = plwPais;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Textbox getTxtNombre() {
|
||||||
|
return txtNombre;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTxtNombre(Textbox txtNombre) {
|
||||||
|
this.txtNombre = txtNombre;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Listheader getHeaderEquivalencia() {
|
||||||
|
return headerEquivalencia;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setHeaderEquivalencia(Listheader headerEquivalencia) {
|
||||||
|
this.headerEquivalencia = headerEquivalencia;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Row getRowEquivalencia() {
|
||||||
|
return rowEquivalencia;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRowEquivalencia(Row rowEquivalencia) {
|
||||||
|
this.rowEquivalencia = rowEquivalencia;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onClick$btnPesquisa(Event ev) throws InterruptedException {
|
||||||
|
refreshLista();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onClick$btnRefresh(Event ev) throws InterruptedException {
|
||||||
|
refreshLista();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onClick$btnNovo(Event ev) {
|
||||||
|
verPeriodo(new Pais());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void doAfterCompose(Component comp) throws Exception {
|
||||||
|
super.doAfterCompose(comp);
|
||||||
|
|
||||||
|
paisList.setItemRenderer(new RenderPais());
|
||||||
|
paisList.addEventListener("onDoubleClick", new EventListener() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onEvent(Event event) throws Exception {
|
||||||
|
Pais c = (Pais) paisList.getSelected();
|
||||||
|
verPeriodo(c);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
refreshLista();
|
||||||
|
|
||||||
|
txtNombre.focus();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void verPeriodo(Pais c) {
|
||||||
|
if (c == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Map args = new HashMap();
|
||||||
|
args.put("busquedaPaisController", this);
|
||||||
|
args.put("pais", c);
|
||||||
|
args.put("paisList", paisList);
|
||||||
|
|
||||||
|
openWindow("/gui/catalogos/editarPais.zul",
|
||||||
|
Labels.getLabel("editarPaisController.window.title"), args, MODAL);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void refreshLista() throws InterruptedException {
|
||||||
|
HibernateSearchObject<Pais> paisBusqueda =
|
||||||
|
new HibernateSearchObject<Pais>(Pais.class, pagingPais.getPageSize());
|
||||||
|
|
||||||
|
paisBusqueda.addFilterLike("nombpais", "%" + txtNombre.getText().trim().concat("%"));
|
||||||
|
|
||||||
|
paisBusqueda.addFilterEqual("activo", Boolean.TRUE);
|
||||||
|
paisBusqueda.addSortAsc("nombpais");
|
||||||
|
//paisBusqueda.addFilterNotEqual("paisId", -1);
|
||||||
|
|
||||||
|
plwPais.init(paisBusqueda, paisList, pagingPais);
|
||||||
|
|
||||||
|
if (paisList.getData().length == 0) {
|
||||||
|
Messagebox.show(
|
||||||
|
Labels.getLabel("MSG.ningunRegistro"),
|
||||||
|
Labels.getLabel("busquedaPaisController.window.title"),
|
||||||
|
Messagebox.OK, Messagebox.INFORMATION);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,132 @@
|
||||||
|
/*
|
||||||
|
* To change this template, choose Tools | Templates
|
||||||
|
* and open the template in the editor.
|
||||||
|
*/
|
||||||
|
package com.rjconsultores.ventaboletos.web.gui.controladores.catalogos;
|
||||||
|
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.Plaza;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.MyGenericForwardComposer;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.MyListbox;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.paginacion.HibernateSearchObject;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.paginacion.PagedListWrapper;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.render.RenderPlaza;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.context.annotation.Scope;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.zkoss.util.resource.Labels;
|
||||||
|
import org.zkoss.zhtml.Messagebox;
|
||||||
|
import org.zkoss.zk.ui.Component;
|
||||||
|
import org.zkoss.zk.ui.event.Event;
|
||||||
|
import org.zkoss.zk.ui.event.EventListener;
|
||||||
|
import org.zkoss.zul.Paging;
|
||||||
|
import org.zkoss.zul.Textbox;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Administrador
|
||||||
|
*/
|
||||||
|
@Controller("busquedaPlazaController")
|
||||||
|
@Scope("prototype")
|
||||||
|
public class BusquedaPlazaController extends MyGenericForwardComposer {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private transient PagedListWrapper<Plaza> plwPlaza;
|
||||||
|
private MyListbox plazaList;
|
||||||
|
private Paging pagingPlaza;
|
||||||
|
private Textbox txtNome;
|
||||||
|
|
||||||
|
public MyListbox getPlazaList() {
|
||||||
|
return plazaList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPlazaList(MyListbox plazaList) {
|
||||||
|
this.plazaList = plazaList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Paging getPagingPlaza() {
|
||||||
|
return pagingPlaza;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPagingPlaza(Paging pagingPlaza) {
|
||||||
|
this.pagingPlaza = pagingPlaza;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Textbox getTxtNome() {
|
||||||
|
return txtNome;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTxtNome(Textbox txtNome) {
|
||||||
|
this.txtNome = txtNome;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void doAfterCompose(Component comp) throws Exception {
|
||||||
|
super.doAfterCompose(comp);
|
||||||
|
|
||||||
|
plazaList.setItemRenderer(new RenderPlaza());
|
||||||
|
plazaList.addEventListener("onDoubleClick", new EventListener() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onEvent(Event event) throws Exception {
|
||||||
|
Plaza a = (Plaza) plazaList.getSelected();
|
||||||
|
verPlaza(a);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
refreshLista();
|
||||||
|
|
||||||
|
txtNome.focus();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void verPlaza(Plaza a) {
|
||||||
|
if (a == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Map args = new HashMap();
|
||||||
|
args.put("plaza", a);
|
||||||
|
args.put("plazaList", plazaList);
|
||||||
|
|
||||||
|
openWindow("/gui/catalogos/editarPlaza.zul",
|
||||||
|
Labels.getLabel("editarPlazaController.window.title"), args, MODAL);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void refreshLista() {
|
||||||
|
HibernateSearchObject<Plaza> plazaBusqueda =
|
||||||
|
new HibernateSearchObject<Plaza>(Plaza.class,
|
||||||
|
pagingPlaza.getPageSize());
|
||||||
|
|
||||||
|
plazaBusqueda.addFilterLike("nombplaza",
|
||||||
|
"%" + txtNome.getText().trim().concat("%"));
|
||||||
|
|
||||||
|
plazaBusqueda.addSortAsc("nombplaza");
|
||||||
|
plazaBusqueda.addFilterNotEqual("plazaId", -1);
|
||||||
|
|
||||||
|
plazaBusqueda.addFilterEqual("activo", Boolean.TRUE);
|
||||||
|
|
||||||
|
plwPlaza.init(plazaBusqueda, plazaList, pagingPlaza);
|
||||||
|
|
||||||
|
if (plazaList.getData().length == 0) {
|
||||||
|
try {
|
||||||
|
Messagebox.show(Labels.getLabel("MSG.ningunRegistro"),
|
||||||
|
Labels.getLabel("busquedaPlazaController.window.title"),
|
||||||
|
Messagebox.OK, Messagebox.INFORMATION);
|
||||||
|
} catch (InterruptedException ex) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onClick$btnPesquisa(Event ev) {
|
||||||
|
refreshLista();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onClick$btnRefresh(Event ev) {
|
||||||
|
refreshLista();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onClick$btnNovo(Event ev) {
|
||||||
|
verPlaza(new Plaza());
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,137 @@
|
||||||
|
/*
|
||||||
|
* To change this template, choose Tools | Templates
|
||||||
|
* and open the template in the editor.
|
||||||
|
*/
|
||||||
|
package com.rjconsultores.ventaboletos.web.gui.controladores.catalogos;
|
||||||
|
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.ProductoServicio;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.MyGenericForwardComposer;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.MyListbox;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.paginacion.HibernateSearchObject;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.paginacion.PagedListWrapper;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.render.RenderProductoServicio;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.context.annotation.Scope;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.zkoss.util.resource.Labels;
|
||||||
|
import org.zkoss.zk.ui.Component;
|
||||||
|
import org.zkoss.zk.ui.event.Event;
|
||||||
|
import org.zkoss.zk.ui.event.EventListener;
|
||||||
|
import org.zkoss.zul.Messagebox;
|
||||||
|
import org.zkoss.zul.Paging;
|
||||||
|
import org.zkoss.zul.Textbox;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Shiro
|
||||||
|
*/
|
||||||
|
@Controller("busquedaProductoServicioControllerMX")
|
||||||
|
@Scope("prototype")
|
||||||
|
public class BusquedaProductoServicioController extends MyGenericForwardComposer {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private transient PagedListWrapper<ProductoServicio> plwProductoServicio;
|
||||||
|
private MyListbox PSList;
|
||||||
|
private Paging pagingPS;
|
||||||
|
private Textbox txtNombre;
|
||||||
|
|
||||||
|
public MyListbox getPSList() {
|
||||||
|
return PSList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPSList(MyListbox PSList) {
|
||||||
|
this.PSList = PSList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Paging getPagingPS() {
|
||||||
|
return pagingPS;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPagingPS(Paging pagingPS) {
|
||||||
|
this.pagingPS = pagingPS;
|
||||||
|
}
|
||||||
|
|
||||||
|
public PagedListWrapper<ProductoServicio> getPlwProductoServicio() {
|
||||||
|
return plwProductoServicio;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPlwProductoServicio(PagedListWrapper<ProductoServicio> plwProductoServicio) {
|
||||||
|
this.plwProductoServicio = plwProductoServicio;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Textbox getTxtNombre() {
|
||||||
|
return txtNombre;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTxtNombre(Textbox txtNombre) {
|
||||||
|
this.txtNombre = txtNombre;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onClick$btnPesquisa(Event ev) throws InterruptedException {
|
||||||
|
refreshLista();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onClick$btnRefresh(Event ev) {
|
||||||
|
refreshLista();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onClick$btnNovo(Event ev) {
|
||||||
|
verProductoServicio(new ProductoServicio());
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void doAfterCompose(Component comp) throws Exception {
|
||||||
|
super.doAfterCompose(comp);
|
||||||
|
|
||||||
|
PSList.setItemRenderer(new RenderProductoServicio());
|
||||||
|
PSList.addEventListener("onDoubleClick", new EventListener() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onEvent(Event event) throws Exception {
|
||||||
|
ProductoServicio ps = (ProductoServicio) PSList.getSelected();
|
||||||
|
verProductoServicio(ps);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
refreshLista();
|
||||||
|
|
||||||
|
txtNombre.focus();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void verProductoServicio(ProductoServicio ps) {
|
||||||
|
if (ps == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Map args = new HashMap();
|
||||||
|
args.put("ps", ps);
|
||||||
|
args.put("PSList", PSList);
|
||||||
|
|
||||||
|
openWindow("/gui/catalogos/editarProductoServicio.zul",
|
||||||
|
Labels.getLabel("indexController.mniProductoServicio.label"), args, MODAL);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void refreshLista() {
|
||||||
|
HibernateSearchObject<ProductoServicio> claseServicioBusqueda =
|
||||||
|
new HibernateSearchObject<ProductoServicio>(ProductoServicio.class, pagingPS.getPageSize());
|
||||||
|
|
||||||
|
claseServicioBusqueda.addFilterLike("descproductoservicio", "%" + txtNombre.getText().trim().concat("%"));
|
||||||
|
claseServicioBusqueda.addFilterEqual("activo", Boolean.TRUE);
|
||||||
|
claseServicioBusqueda.addSortAsc("descproductoservicio");
|
||||||
|
claseServicioBusqueda.addFilterNotEqual("productoservicioId", -1);
|
||||||
|
|
||||||
|
plwProductoServicio.init(claseServicioBusqueda, PSList, pagingPS);
|
||||||
|
if (PSList.getData().length == 0) {
|
||||||
|
try {
|
||||||
|
Messagebox.show(Labels.getLabel("MSG.ningunRegistro"),
|
||||||
|
Labels.getLabel("busquedaPeriodoVacacionalController.window.title"),
|
||||||
|
Messagebox.OK, Messagebox.INFORMATION);
|
||||||
|
} catch (InterruptedException ex) {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,166 @@
|
||||||
|
/*
|
||||||
|
* To change this template, choose Tools | Templates
|
||||||
|
* and open the template in the editor.
|
||||||
|
*/
|
||||||
|
package com.rjconsultores.ventaboletos.web.gui.controladores.catalogos;
|
||||||
|
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.Empresa;
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.PtovtaEmpresa;
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.PuntoVenta;
|
||||||
|
import com.rjconsultores.ventaboletos.service.EmpresaService;
|
||||||
|
import com.rjconsultores.ventaboletos.service.PuntoVentaService;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.MyGenericForwardComposer;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.MyListbox;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.paginacion.HibernateSearchObject;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.paginacion.PagedListWrapper;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.render.RenderPtovtaEmpresa;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.context.annotation.Scope;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.zkoss.util.resource.Labels;
|
||||||
|
import org.zkoss.zhtml.Messagebox;
|
||||||
|
import org.zkoss.zk.ui.Component;
|
||||||
|
import org.zkoss.zk.ui.event.Event;
|
||||||
|
import org.zkoss.zk.ui.event.EventListener;
|
||||||
|
import org.zkoss.zul.Combobox;
|
||||||
|
import org.zkoss.zul.Paging;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Rafius
|
||||||
|
*/
|
||||||
|
@Controller("busquedaPtovtaEmpresaController")
|
||||||
|
@Scope("prototype")
|
||||||
|
public class BusquedaPtovtaEmpresaController extends MyGenericForwardComposer {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private transient PagedListWrapper<PtovtaEmpresa> plwPtovtaEmpresa;
|
||||||
|
private MyListbox ptovtaEmpresaList;
|
||||||
|
private Paging pagingPtovtaEmpresa;
|
||||||
|
@Autowired
|
||||||
|
private EmpresaService empresaService;
|
||||||
|
@Autowired
|
||||||
|
private PuntoVentaService puntoVentaService;
|
||||||
|
private List<Empresa> lsEmpresa;
|
||||||
|
private List<PuntoVenta> lsPuntoVenta;
|
||||||
|
private Combobox cmbEmpresa;
|
||||||
|
private Combobox cmbPuntoVenta;
|
||||||
|
|
||||||
|
public Paging getPagingPtovtaEmpresa() {
|
||||||
|
return pagingPtovtaEmpresa;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPagingPtovtaEmpresa(Paging pagingPtovtaEmpresa) {
|
||||||
|
this.pagingPtovtaEmpresa = pagingPtovtaEmpresa;
|
||||||
|
}
|
||||||
|
|
||||||
|
public MyListbox getPtovtaEmpresaList() {
|
||||||
|
return ptovtaEmpresaList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPtovtaEmpresaList(MyListbox ptovtaEmpresaList) {
|
||||||
|
this.ptovtaEmpresaList = ptovtaEmpresaList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public PagedListWrapper<PtovtaEmpresa> getPlwPtovtaEmpresa() {
|
||||||
|
return plwPtovtaEmpresa;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPlwPtovtaEmpresa(PagedListWrapper<PtovtaEmpresa> plwPtovtaEmpresa) {
|
||||||
|
this.plwPtovtaEmpresa = plwPtovtaEmpresa;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onClick$btnPesquisa(Event ev) throws InterruptedException {
|
||||||
|
refreshLista();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onClick$btnRefresh(Event ev) {
|
||||||
|
refreshLista();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onClick$btnNovo(Event ev) {
|
||||||
|
verPeriodo(new PtovtaEmpresa());
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<Empresa> getLsEmpresa() {
|
||||||
|
return lsEmpresa;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLsEmpresa(List<Empresa> lsEmpresa) {
|
||||||
|
this.lsEmpresa = lsEmpresa;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<PuntoVenta> getLsPuntoVenta() {
|
||||||
|
return lsPuntoVenta;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLsPuntoVenta(List<PuntoVenta> lsPuntoVenta) {
|
||||||
|
this.lsPuntoVenta = lsPuntoVenta;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void doAfterCompose(Component comp) throws Exception {
|
||||||
|
|
||||||
|
lsEmpresa = empresaService.obtenerTodos();
|
||||||
|
lsPuntoVenta = puntoVentaService.obtenerTodos();
|
||||||
|
|
||||||
|
super.doAfterCompose(comp);
|
||||||
|
|
||||||
|
ptovtaEmpresaList.setItemRenderer(new RenderPtovtaEmpresa());
|
||||||
|
ptovtaEmpresaList.addEventListener("onDoubleClick", new EventListener() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onEvent(Event event) throws Exception {
|
||||||
|
PtovtaEmpresa c = (PtovtaEmpresa) ptovtaEmpresaList.getSelected();
|
||||||
|
verPeriodo(c);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
refreshLista();
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void verPeriodo(PtovtaEmpresa c) {
|
||||||
|
if (c == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Map args = new HashMap();
|
||||||
|
args.put("ptovtaEmpresa", c);
|
||||||
|
args.put("ptovtaEmpresaList", ptovtaEmpresaList);
|
||||||
|
|
||||||
|
openWindow("/gui/catalogos/editarPtovtaEmpresa.zul",
|
||||||
|
Labels.getLabel("editarPtovtaEmpresaController.window.title"), args, MODAL);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void refreshLista() {
|
||||||
|
HibernateSearchObject<PtovtaEmpresa> ptovtaEmpresa =
|
||||||
|
new HibernateSearchObject<PtovtaEmpresa>(PtovtaEmpresa.class, pagingPtovtaEmpresa.getPageSize());
|
||||||
|
|
||||||
|
Empresa empresa = (Empresa) (cmbEmpresa.getSelectedItem() != null ? cmbEmpresa.getSelectedItem().getValue() : null);
|
||||||
|
PuntoVenta puntoVenta = (PuntoVenta) (cmbPuntoVenta.getSelectedItem() != null ? cmbPuntoVenta.getSelectedItem().getValue() : null);
|
||||||
|
|
||||||
|
if (empresa != null) {
|
||||||
|
ptovtaEmpresa.addFilterEqual("empresa", empresa);
|
||||||
|
}
|
||||||
|
if (puntoVenta != null) {
|
||||||
|
ptovtaEmpresa.addFilterEqual("puntoVenta", puntoVenta);
|
||||||
|
}
|
||||||
|
ptovtaEmpresa.addFilterEqual("activo", Boolean.TRUE);
|
||||||
|
|
||||||
|
|
||||||
|
plwPtovtaEmpresa.init(ptovtaEmpresa, ptovtaEmpresaList, pagingPtovtaEmpresa);
|
||||||
|
if (ptovtaEmpresaList.getData().length == 0) {
|
||||||
|
try {
|
||||||
|
Messagebox.show(Labels.getLabel("MSG.ningunRegistro"),
|
||||||
|
Labels.getLabel("busquedaPtovtaEmpresaController.window.title"),
|
||||||
|
Messagebox.OK, Messagebox.INFORMATION);
|
||||||
|
} catch (InterruptedException ex) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,322 @@
|
||||||
|
/*
|
||||||
|
* To change this template, choose Tools | Templates
|
||||||
|
* and open the template in the editor.
|
||||||
|
*/
|
||||||
|
package com.rjconsultores.ventaboletos.web.gui.controladores.catalogos;
|
||||||
|
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.Ciudad;
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.Empresa;
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.Moneda;
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.Nodo;
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.PuntoVenta;
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.TipoPuntoVenta;
|
||||||
|
import com.rjconsultores.ventaboletos.service.CiudadService;
|
||||||
|
import com.rjconsultores.ventaboletos.service.EmpresaService;
|
||||||
|
import com.rjconsultores.ventaboletos.service.MonedaService;
|
||||||
|
import com.rjconsultores.ventaboletos.service.NodoService;
|
||||||
|
import com.rjconsultores.ventaboletos.service.TipoPuntoVentaService;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.MyGenericForwardComposer;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.MyListbox;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.paginacion.HibernateSearchObject;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.paginacion.PagedListWrapper;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.render.RenderPuntoVenta;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.context.annotation.Scope;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.zkoss.util.resource.Labels;
|
||||||
|
import org.zkoss.zhtml.Messagebox;
|
||||||
|
import org.zkoss.zk.ui.Component;
|
||||||
|
import org.zkoss.zk.ui.event.Event;
|
||||||
|
import org.zkoss.zk.ui.event.EventListener;
|
||||||
|
import org.zkoss.zul.Combobox;
|
||||||
|
import org.zkoss.zul.Comboitem;
|
||||||
|
import org.zkoss.zul.Paging;
|
||||||
|
import org.zkoss.zul.Radio;
|
||||||
|
import org.zkoss.zul.Textbox;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Rafius
|
||||||
|
*/
|
||||||
|
@Controller("busquedaPuntoVentaController")
|
||||||
|
@Scope("prototype")
|
||||||
|
public class BusquedaPuntoVentaController extends MyGenericForwardComposer {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private transient PagedListWrapper<PuntoVenta> plwPuntoVenta;
|
||||||
|
@Autowired
|
||||||
|
private EmpresaService empresaService;
|
||||||
|
@Autowired
|
||||||
|
private TipoPuntoVentaService tipoPuntoVentaService;
|
||||||
|
@Autowired
|
||||||
|
private MonedaService monedaService;
|
||||||
|
@Autowired
|
||||||
|
private NodoService nodoService;
|
||||||
|
private MyListbox puntoVentaList;
|
||||||
|
private Paging pagingPuntoVenta;
|
||||||
|
private Textbox txtNombre;
|
||||||
|
private Textbox txtCalle;
|
||||||
|
private Textbox txtNumero;
|
||||||
|
private Textbox txtColonia;
|
||||||
|
private Textbox txtTelefonoUno;
|
||||||
|
private Textbox txtTelefonoDos;
|
||||||
|
private List<Empresa> lsEmpresas;
|
||||||
|
private List<TipoPuntoVenta> lsTipoPuntoVenta;
|
||||||
|
private List<Moneda> lsMoneda;
|
||||||
|
private List<Nodo> lsNodos;
|
||||||
|
private Combobox cmbEmpresa;
|
||||||
|
private Combobox cmbTipoPontoVenta;
|
||||||
|
private Combobox cmbMoneda;
|
||||||
|
private Combobox cmbNodo;
|
||||||
|
private Radio radAprobacionAutorizado;
|
||||||
|
private Radio radAprobacionLatente;
|
||||||
|
|
||||||
|
public Radio getRadAprobacionAutorizado() {
|
||||||
|
return radAprobacionAutorizado;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRadAprobacionAutorizado(Radio radAprobacionAutorizado) {
|
||||||
|
this.radAprobacionAutorizado = radAprobacionAutorizado;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Radio getRadAprobacionLatente() {
|
||||||
|
return radAprobacionLatente;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRadAprobacionLatente(Radio radAprobacionLatente) {
|
||||||
|
this.radAprobacionLatente = radAprobacionLatente;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Combobox getCmbEmpresa() {
|
||||||
|
return cmbEmpresa;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCmbEmpresa(Combobox cmbEmpresa) {
|
||||||
|
this.cmbEmpresa = cmbEmpresa;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Combobox getCmbMoneda() {
|
||||||
|
return cmbMoneda;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCmbMoneda(Combobox cmbMoneda) {
|
||||||
|
this.cmbMoneda = cmbMoneda;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Combobox getCmbNodo() {
|
||||||
|
return cmbNodo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCmbNodo(Combobox cmbNodo) {
|
||||||
|
this.cmbNodo = cmbNodo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Combobox getCmbTipoPontoVenta() {
|
||||||
|
return cmbTipoPontoVenta;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCmbTipoPontoVenta(Combobox cmbTipoPontoVenta) {
|
||||||
|
this.cmbTipoPontoVenta = cmbTipoPontoVenta;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Textbox getTxtNombre() {
|
||||||
|
return txtNombre;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTxtNombre(Textbox txtNombre) {
|
||||||
|
this.txtNombre = txtNombre;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Paging getPagingPuntoVenta() {
|
||||||
|
return pagingPuntoVenta;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPagingPuntoVenta(Paging pagingPuntoVenta) {
|
||||||
|
this.pagingPuntoVenta = pagingPuntoVenta;
|
||||||
|
}
|
||||||
|
|
||||||
|
public MyListbox getPuntoVentaList() {
|
||||||
|
return puntoVentaList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPuntoVentaList(MyListbox puntoVentaList) {
|
||||||
|
this.puntoVentaList = puntoVentaList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public PagedListWrapper<PuntoVenta> getPlwPuntoVenta() {
|
||||||
|
return plwPuntoVenta;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPlwPuntoVenta(PagedListWrapper<PuntoVenta> plwPuntoVenta) {
|
||||||
|
this.plwPuntoVenta = plwPuntoVenta;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onClick$btnPesquisa(Event ev) throws InterruptedException {
|
||||||
|
refreshLista();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onClick$btnRefresh(Event ev) {
|
||||||
|
refreshLista();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onClick$btnNovo(Event ev) {
|
||||||
|
verPeriodo(new PuntoVenta());
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<Empresa> getLsEmpresas() {
|
||||||
|
return lsEmpresas;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLsEmpresas(List<Empresa> lsEmpresas) {
|
||||||
|
this.lsEmpresas = lsEmpresas;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<Moneda> getLsMoneda() {
|
||||||
|
return lsMoneda;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLsMoneda(List<Moneda> lsMoneda) {
|
||||||
|
this.lsMoneda = lsMoneda;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<Nodo> getLsNodos() {
|
||||||
|
return lsNodos;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLsNodos(List<Nodo> lsNodos) {
|
||||||
|
this.lsNodos = lsNodos;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<TipoPuntoVenta> getLsTipoPuntoVenta() {
|
||||||
|
return lsTipoPuntoVenta;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLsTipoPuntoVenta(List<TipoPuntoVenta> lsTipoPuntoVenta) {
|
||||||
|
this.lsTipoPuntoVenta = lsTipoPuntoVenta;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void doAfterCompose(Component comp) throws Exception {
|
||||||
|
super.doAfterCompose(comp);
|
||||||
|
|
||||||
|
lsEmpresas = empresaService.obtenerIndTipo1();
|
||||||
|
lsTipoPuntoVenta = tipoPuntoVentaService.obtenerTodos();
|
||||||
|
lsMoneda = monedaService.obtenerTodos();
|
||||||
|
lsNodos = nodoService.obtenerTodos();
|
||||||
|
|
||||||
|
puntoVentaList.setItemRenderer(new RenderPuntoVenta());
|
||||||
|
puntoVentaList.addEventListener("onDoubleClick", new EventListener() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onEvent(Event event) throws Exception {
|
||||||
|
PuntoVenta c = (PuntoVenta) puntoVentaList.getSelected();
|
||||||
|
verPeriodo(c);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
refreshLista();
|
||||||
|
txtNombre.focus();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void verPeriodo(PuntoVenta c) {
|
||||||
|
if (c == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Map args = new HashMap();
|
||||||
|
args.put("puntoVenta", c);
|
||||||
|
args.put("puntoVentaList", puntoVentaList);
|
||||||
|
|
||||||
|
openWindow("/gui/catalogos/editarPuntoVenta.zul",
|
||||||
|
Labels.getLabel("editarPuntoVentaController.window.title"), args, MODAL);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void refreshLista() {
|
||||||
|
HibernateSearchObject<PuntoVenta> claseServicioBusqueda =
|
||||||
|
new HibernateSearchObject<PuntoVenta>(PuntoVenta.class,
|
||||||
|
pagingPuntoVenta.getPageSize());
|
||||||
|
|
||||||
|
claseServicioBusqueda.addFilterLike("nombpuntoventa",
|
||||||
|
"%" + txtNombre.getText().trim().concat("%"));
|
||||||
|
|
||||||
|
Comboitem itemEmpresa = cmbEmpresa.getSelectedItem();
|
||||||
|
Comboitem itemTipoPontoVenta = cmbTipoPontoVenta.getSelectedItem();
|
||||||
|
Comboitem itemMoneda = cmbMoneda.getSelectedItem();
|
||||||
|
Comboitem itemNodo = cmbNodo.getSelectedItem();
|
||||||
|
|
||||||
|
Empresa empresa;
|
||||||
|
TipoPuntoVenta tipoPontoVenta;
|
||||||
|
Moneda moneda;
|
||||||
|
Nodo nodo;
|
||||||
|
Ciudad ciudad;
|
||||||
|
String statusAprobacion = null;
|
||||||
|
|
||||||
|
if (radAprobacionAutorizado.isChecked()) {
|
||||||
|
statusAprobacion = "A";
|
||||||
|
} else if (radAprobacionLatente.isChecked()) {
|
||||||
|
statusAprobacion = "L";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (statusAprobacion != null) {
|
||||||
|
claseServicioBusqueda.addFilterEqual("statusaprobacion", statusAprobacion);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (itemEmpresa != null) {
|
||||||
|
empresa = (Empresa) itemEmpresa.getValue();
|
||||||
|
claseServicioBusqueda.addFilterEqual("empresa", empresa);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (itemTipoPontoVenta != null) {
|
||||||
|
tipoPontoVenta = (TipoPuntoVenta) itemTipoPontoVenta.getValue();
|
||||||
|
claseServicioBusqueda.addFilterEqual("tipoPuntoVenta", tipoPontoVenta);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (itemMoneda != null) {
|
||||||
|
moneda = (Moneda) itemMoneda.getValue();
|
||||||
|
claseServicioBusqueda.addFilterEqual("moneda", moneda);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (itemNodo != null) {
|
||||||
|
nodo = (Nodo) itemNodo.getValue();
|
||||||
|
claseServicioBusqueda.addFilterEqual("nodo", nodo);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!txtCalle.getText().isEmpty()) {
|
||||||
|
claseServicioBusqueda.addFilterLike("direccioncalle", txtCalle.getText());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!txtNumero.getText().isEmpty()) {
|
||||||
|
claseServicioBusqueda.addFilterLike("direccionnumero", txtNumero.getText());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!txtColonia.getText().isEmpty()) {
|
||||||
|
claseServicioBusqueda.addFilterLike("direccioncolonia", txtColonia.getText());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!txtTelefonoUno.getText().isEmpty()) {
|
||||||
|
claseServicioBusqueda.addFilterLike("numtelefonouno", txtTelefonoUno.getText());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!txtTelefonoDos.getText().isEmpty()) {
|
||||||
|
claseServicioBusqueda.addFilterLike("numtelefonodos", txtTelefonoDos.getText());
|
||||||
|
}
|
||||||
|
|
||||||
|
claseServicioBusqueda.addFilterEqual("activo", Boolean.TRUE);
|
||||||
|
claseServicioBusqueda.addSortAsc("nombpuntoventa");
|
||||||
|
claseServicioBusqueda.addFilterNotEqual("puntoventaId", -1);
|
||||||
|
|
||||||
|
plwPuntoVenta.init(claseServicioBusqueda, puntoVentaList, pagingPuntoVenta);
|
||||||
|
|
||||||
|
if (puntoVentaList.getData().length == 0) {
|
||||||
|
try {
|
||||||
|
Messagebox.show(Labels.getLabel("MSG.ningunRegistro"),
|
||||||
|
Labels.getLabel("busquedaPuntoVentaController.window.title"),
|
||||||
|
Messagebox.OK, Messagebox.INFORMATION);
|
||||||
|
} catch (InterruptedException ex) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,127 @@
|
||||||
|
/*
|
||||||
|
* To change this template, choose Tools | Templates
|
||||||
|
* and open the template in the editor.
|
||||||
|
*/
|
||||||
|
package com.rjconsultores.ventaboletos.web.gui.controladores.catalogos;
|
||||||
|
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.TipoConvenio;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.MyGenericForwardComposer;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.MyListbox;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.paginacion.HibernateSearchObject;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.paginacion.PagedListWrapper;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.render.RenderTipoConvenio;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.context.annotation.Scope;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.zkoss.util.resource.Labels;
|
||||||
|
import org.zkoss.zk.ui.Component;
|
||||||
|
import org.zkoss.zk.ui.event.Event;
|
||||||
|
import org.zkoss.zk.ui.event.EventListener;
|
||||||
|
import org.zkoss.zul.Paging;
|
||||||
|
import org.zkoss.zul.Textbox;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Shiro
|
||||||
|
*/
|
||||||
|
@Controller("busquedaTipoConvenioController")
|
||||||
|
@Scope("prototype")
|
||||||
|
public class BusquedaTipoConvenioController extends MyGenericForwardComposer {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private transient PagedListWrapper<TipoConvenio> plwTipoConvenio;
|
||||||
|
private MyListbox tConvenioList;
|
||||||
|
private Paging pagingTipoConvenio;
|
||||||
|
private Textbox txtNombre;
|
||||||
|
|
||||||
|
public Paging getPagingTipoConvenio() {
|
||||||
|
return pagingTipoConvenio;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPagingTipoConvenio(Paging pagingTipoConvenio) {
|
||||||
|
this.pagingTipoConvenio = pagingTipoConvenio;
|
||||||
|
}
|
||||||
|
|
||||||
|
public PagedListWrapper<TipoConvenio> getPlwTipoConvenio() {
|
||||||
|
return plwTipoConvenio;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPlwTipoConvenio(PagedListWrapper<TipoConvenio> plwTipoConvenio) {
|
||||||
|
this.plwTipoConvenio = plwTipoConvenio;
|
||||||
|
}
|
||||||
|
|
||||||
|
public MyListbox gettConvenioList() {
|
||||||
|
return tConvenioList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void settConvenioList(MyListbox tConvenioList) {
|
||||||
|
this.tConvenioList = tConvenioList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Textbox getTxtNombre() {
|
||||||
|
return txtNombre;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTxtNombre(Textbox txtNombre) {
|
||||||
|
this.txtNombre = txtNombre;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onClick$btnPesquisa(Event ev) throws InterruptedException {
|
||||||
|
refreshLista();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onClick$btnRefresh(Event ev) {
|
||||||
|
refreshLista();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onClick$btnNovo(Event ev) {
|
||||||
|
verTipoConvenio(new TipoConvenio());
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void doAfterCompose(Component comp) throws Exception {
|
||||||
|
super.doAfterCompose(comp);
|
||||||
|
|
||||||
|
tConvenioList.setItemRenderer(new RenderTipoConvenio());
|
||||||
|
tConvenioList.addEventListener("onDoubleClick", new EventListener() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onEvent(Event event) throws Exception {
|
||||||
|
TipoConvenio tc = (TipoConvenio) tConvenioList.getSelected();
|
||||||
|
verTipoConvenio(tc);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
refreshLista();
|
||||||
|
|
||||||
|
txtNombre.focus();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void verTipoConvenio(TipoConvenio tc) {
|
||||||
|
if (tc == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Map args = new HashMap();
|
||||||
|
args.put("tc", tc);
|
||||||
|
args.put("tConvenioList", tConvenioList);
|
||||||
|
|
||||||
|
openWindow("/gui/catalogos/editarTipoConvenio.zul",
|
||||||
|
Labels.getLabel("busquedaTipoConvenioController.window.title"), args, MODAL);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void refreshLista() {
|
||||||
|
HibernateSearchObject<TipoConvenio> claseServicioBusqueda =
|
||||||
|
new HibernateSearchObject<TipoConvenio>(TipoConvenio.class, pagingTipoConvenio.getPageSize());
|
||||||
|
|
||||||
|
claseServicioBusqueda.addFilterLike("descTipo", "%" + txtNombre.getText().trim().concat("%"));
|
||||||
|
claseServicioBusqueda.addFilterEqual("activo", Boolean.TRUE);
|
||||||
|
claseServicioBusqueda.addFilterNotEqual("tipoConvenioID", -1);
|
||||||
|
claseServicioBusqueda.addSortAsc("descTipo");
|
||||||
|
|
||||||
|
plwTipoConvenio.init(claseServicioBusqueda, tConvenioList, pagingTipoConvenio);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,131 @@
|
||||||
|
/*
|
||||||
|
* To change this template, choose Tools | Templates
|
||||||
|
* and open the template in the editor.
|
||||||
|
*/
|
||||||
|
package com.rjconsultores.ventaboletos.web.gui.controladores.catalogos;
|
||||||
|
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.TipoCorte;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.MyGenericForwardComposer;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.MyListbox;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.paginacion.HibernateSearchObject;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.paginacion.PagedListWrapper;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.render.RenderTipoCorte;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.context.annotation.Scope;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.zkoss.util.resource.Labels;
|
||||||
|
import org.zkoss.zhtml.Messagebox;
|
||||||
|
import org.zkoss.zk.ui.Component;
|
||||||
|
import org.zkoss.zk.ui.event.Event;
|
||||||
|
import org.zkoss.zk.ui.event.EventListener;
|
||||||
|
import org.zkoss.zul.Paging;
|
||||||
|
import org.zkoss.zul.Textbox;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Administrador
|
||||||
|
*/
|
||||||
|
@Controller("busquedaTipoCorteController")
|
||||||
|
@Scope("prototype")
|
||||||
|
public class BusquedaTipoCorteController extends MyGenericForwardComposer {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private transient PagedListWrapper<TipoCorte> plwTipoCorte;
|
||||||
|
private MyListbox tipoCorteList;
|
||||||
|
private Paging pagingTipoCorte;
|
||||||
|
private Textbox txtNome;
|
||||||
|
|
||||||
|
public Paging getPagingTipoCorte() {
|
||||||
|
return pagingTipoCorte;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPagingTipoCorte(Paging pagingTipoCorte) {
|
||||||
|
this.pagingTipoCorte = pagingTipoCorte;
|
||||||
|
}
|
||||||
|
|
||||||
|
public MyListbox getTipoCorteList() {
|
||||||
|
return tipoCorteList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTipoCorteList(MyListbox tipoCorteList) {
|
||||||
|
this.tipoCorteList = tipoCorteList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Textbox getTxtNome() {
|
||||||
|
return txtNome;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTxtNome(Textbox txtNome) {
|
||||||
|
this.txtNome = txtNome;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void doAfterCompose(Component comp) throws Exception {
|
||||||
|
super.doAfterCompose(comp);
|
||||||
|
|
||||||
|
tipoCorteList.setItemRenderer(new RenderTipoCorte());
|
||||||
|
tipoCorteList.addEventListener("onDoubleClick", new EventListener() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onEvent(Event event) throws Exception {
|
||||||
|
TipoCorte a = (TipoCorte) tipoCorteList.getSelected();
|
||||||
|
verTipoCorte(a);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
refreshLista();
|
||||||
|
|
||||||
|
txtNome.focus();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void verTipoCorte(TipoCorte a) {
|
||||||
|
if (a == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Map args = new HashMap();
|
||||||
|
args.put("tipoCorte", a);
|
||||||
|
args.put("tipoCorteList", tipoCorteList);
|
||||||
|
|
||||||
|
openWindow("/gui/catalogos/editarTipoCorte.zul",
|
||||||
|
Labels.getLabel("editarTipoCorteController.window.title"), args, MODAL);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void refreshLista() {
|
||||||
|
HibernateSearchObject<TipoCorte> tipoCorteBusqueda =
|
||||||
|
new HibernateSearchObject<TipoCorte>(TipoCorte.class,
|
||||||
|
pagingTipoCorte.getPageSize());
|
||||||
|
|
||||||
|
tipoCorteBusqueda.addFilterLike("desctipo",
|
||||||
|
"%" + txtNome.getText().trim().concat("%"));
|
||||||
|
|
||||||
|
tipoCorteBusqueda.addSortAsc("desctipo");
|
||||||
|
tipoCorteBusqueda.addFilterEqual("activo", Boolean.TRUE);
|
||||||
|
tipoCorteBusqueda.addFilterNotEqual("tipocorteId", -1);
|
||||||
|
|
||||||
|
plwTipoCorte.init(tipoCorteBusqueda, tipoCorteList, pagingTipoCorte);
|
||||||
|
|
||||||
|
if (tipoCorteList.getData().length == 0) {
|
||||||
|
try {
|
||||||
|
Messagebox.show(Labels.getLabel("MSG.ningunRegistro"),
|
||||||
|
Labels.getLabel("busquedaArticuloController.window.title"),
|
||||||
|
Messagebox.OK, Messagebox.INFORMATION);
|
||||||
|
} catch (InterruptedException ex) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onClick$btnPesquisa(Event ev) {
|
||||||
|
refreshLista();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onClick$btnRefresh(Event ev) {
|
||||||
|
refreshLista();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onClick$btnNovo(Event ev) {
|
||||||
|
verTipoCorte(new TipoCorte());
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,171 @@
|
||||||
|
/*
|
||||||
|
* To change this template, choose Tools | Templates
|
||||||
|
* and open the template in the editor.
|
||||||
|
*/
|
||||||
|
package com.rjconsultores.ventaboletos.web.gui.controladores.catalogos;
|
||||||
|
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.TipoPuntoVenta;
|
||||||
|
import com.rjconsultores.ventaboletos.utilerias.ApplicationProperties;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.MyGenericForwardComposer;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.MyListbox;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.paginacion.HibernateSearchObject;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.paginacion.PagedListWrapper;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.render.RenderTipoPuntoVenta;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.context.annotation.Scope;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.zkoss.util.resource.Labels;
|
||||||
|
import org.zkoss.zhtml.Messagebox;
|
||||||
|
import org.zkoss.zk.ui.Component;
|
||||||
|
import org.zkoss.zk.ui.event.Event;
|
||||||
|
import org.zkoss.zk.ui.event.EventListener;
|
||||||
|
import org.zkoss.zul.Listheader;
|
||||||
|
import org.zkoss.zul.Paging;
|
||||||
|
import org.zkoss.zul.Row;
|
||||||
|
import org.zkoss.zul.Textbox;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Administrador
|
||||||
|
*/
|
||||||
|
@Controller("busquedaTipoPuntoVentaController")
|
||||||
|
@Scope("prototype")
|
||||||
|
public class BusquedaTipoPuntoVentaController extends MyGenericForwardComposer {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private transient PagedListWrapper<TipoPuntoVenta> plwTipoPuntoVenta;
|
||||||
|
private MyListbox tipoPuntoVentaList;
|
||||||
|
private Paging pagingTipoPuntoVenta;
|
||||||
|
private Textbox txtNome;
|
||||||
|
private Textbox txtEquivalenciaTPV;
|
||||||
|
private Row rowEquivalencia;
|
||||||
|
private Listheader headerEquivalencia;
|
||||||
|
|
||||||
|
public Paging getPagingTipoPuntoVenta() {
|
||||||
|
return pagingTipoPuntoVenta;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPagingTipoPuntoVenta(Paging pagingTipoPuntoVenta) {
|
||||||
|
this.pagingTipoPuntoVenta = pagingTipoPuntoVenta;
|
||||||
|
}
|
||||||
|
|
||||||
|
public MyListbox getTipoPuntoVentaList() {
|
||||||
|
return tipoPuntoVentaList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTipoPuntoVentaList(MyListbox tipoPuntoVentaList) {
|
||||||
|
this.tipoPuntoVentaList = tipoPuntoVentaList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Textbox getTxtNome() {
|
||||||
|
return txtNome;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTxtNome(Textbox txtNome) {
|
||||||
|
this.txtNome = txtNome;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Listheader getHeaderEquivalencia() {
|
||||||
|
return headerEquivalencia;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setHeaderEquivalencia(Listheader headerEquivalencia) {
|
||||||
|
this.headerEquivalencia = headerEquivalencia;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Row getRowEquivalencia() {
|
||||||
|
return rowEquivalencia;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRowEquivalencia(Row rowEquivalencia) {
|
||||||
|
this.rowEquivalencia = rowEquivalencia;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Textbox getTxtEquivalenciaTPV() {
|
||||||
|
return txtEquivalenciaTPV;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTxtEquivalenciaTPV(Textbox txtEquivalenciaTPV) {
|
||||||
|
this.txtEquivalenciaTPV = txtEquivalenciaTPV;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void doAfterCompose(Component comp) throws Exception {
|
||||||
|
super.doAfterCompose(comp);
|
||||||
|
|
||||||
|
tipoPuntoVentaList.setItemRenderer(new RenderTipoPuntoVenta());
|
||||||
|
tipoPuntoVentaList.addEventListener("onDoubleClick", new EventListener() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onEvent(Event event) throws Exception {
|
||||||
|
TipoPuntoVenta tpv = (TipoPuntoVenta) tipoPuntoVentaList.getSelected();
|
||||||
|
verTipoPuntoVenta(tpv);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
refreshLista();
|
||||||
|
|
||||||
|
if (!ApplicationProperties.getInstance().mostrarEquivalencia()) {
|
||||||
|
rowEquivalencia.setVisible(Boolean.FALSE);
|
||||||
|
headerEquivalencia.setVisible(Boolean.FALSE);
|
||||||
|
}
|
||||||
|
|
||||||
|
txtNome.focus();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void verTipoPuntoVenta(TipoPuntoVenta tpv) {
|
||||||
|
if (tpv == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Map args = new HashMap();
|
||||||
|
args.put("tipoPuntoVenta", tpv);
|
||||||
|
args.put("tipoPuntoVentaList", tipoPuntoVentaList);
|
||||||
|
|
||||||
|
openWindow("/gui/catalogos/editarTipoPuntoVenta.zul",
|
||||||
|
Labels.getLabel("editarTipoPuntoVentaController.window.title"), args, MODAL);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void refreshLista() {
|
||||||
|
HibernateSearchObject<TipoPuntoVenta> claseServicioBusqueda =
|
||||||
|
new HibernateSearchObject<TipoPuntoVenta>(TipoPuntoVenta.class,
|
||||||
|
pagingTipoPuntoVenta.getPageSize());
|
||||||
|
|
||||||
|
claseServicioBusqueda.addFilterLike("desctipo",
|
||||||
|
"%" + txtNome.getText().trim().concat("%"));
|
||||||
|
|
||||||
|
if (!txtEquivalenciaTPV.getText().isEmpty()) {
|
||||||
|
claseServicioBusqueda.addFilterLike("equivalenciaId", txtEquivalenciaTPV.getText().trim().concat("%"));
|
||||||
|
}
|
||||||
|
|
||||||
|
claseServicioBusqueda.addFilterEqual("activo", Boolean.TRUE);
|
||||||
|
claseServicioBusqueda.addSortAsc("desctipo");
|
||||||
|
claseServicioBusqueda.addFilterNotEqual("tipoptovtaId", -1);
|
||||||
|
|
||||||
|
plwTipoPuntoVenta.init(claseServicioBusqueda, tipoPuntoVentaList,
|
||||||
|
pagingTipoPuntoVenta);
|
||||||
|
|
||||||
|
if (tipoPuntoVentaList.getData().length == 0) {
|
||||||
|
try {
|
||||||
|
Messagebox.show(Labels.getLabel("MSG.ningunRegistro"),
|
||||||
|
Labels.getLabel("busquedaTipoPuntoVentaController.window.title"),
|
||||||
|
Messagebox.OK, Messagebox.INFORMATION);
|
||||||
|
} catch (InterruptedException ex) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onClick$btnPesquisa(Event ev) {
|
||||||
|
refreshLista();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onClick$btnRefresh(Event ev) {
|
||||||
|
refreshLista();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onClick$btnNovo(Event ev) {
|
||||||
|
verTipoPuntoVenta(new TipoPuntoVenta());
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,129 @@
|
||||||
|
/*
|
||||||
|
* To change this template, choose Tools | Templates
|
||||||
|
* and open the template in the editor.
|
||||||
|
*/
|
||||||
|
package com.rjconsultores.ventaboletos.web.gui.controladores.catalogos;
|
||||||
|
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.TipoServicio;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.MyGenericForwardComposer;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.MyListbox;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.paginacion.HibernateSearchObject;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.paginacion.PagedListWrapper;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.render.RenderTipoServicio;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.context.annotation.Scope;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.zkoss.util.resource.Labels;
|
||||||
|
import org.zkoss.zhtml.Messagebox;
|
||||||
|
import org.zkoss.zk.ui.Component;
|
||||||
|
import org.zkoss.zk.ui.event.Event;
|
||||||
|
import org.zkoss.zk.ui.event.EventListener;
|
||||||
|
import org.zkoss.zul.Paging;
|
||||||
|
import org.zkoss.zul.Textbox;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Rafius
|
||||||
|
*/
|
||||||
|
@Controller("busquedaTipoServicioController")
|
||||||
|
@Scope("prototype")
|
||||||
|
public class BusquedaTipoServicioController extends MyGenericForwardComposer {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private transient PagedListWrapper<TipoServicio> plwTipoServicio;
|
||||||
|
private MyListbox tipoServicioList;
|
||||||
|
private Paging pagingTipoServicio;
|
||||||
|
private Textbox txtNombre;
|
||||||
|
|
||||||
|
public Paging getPagingTipoServicio() {
|
||||||
|
return pagingTipoServicio;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPagingTipoServicio(Paging pagingTipoServicio) {
|
||||||
|
this.pagingTipoServicio = pagingTipoServicio;
|
||||||
|
}
|
||||||
|
|
||||||
|
public MyListbox getTipoServicioList() {
|
||||||
|
return tipoServicioList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTipoServicioList(MyListbox tipoServicioList) {
|
||||||
|
this.tipoServicioList = tipoServicioList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public PagedListWrapper<TipoServicio> getPlwTipoServicio() {
|
||||||
|
return plwTipoServicio;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPlwTipoServicio(PagedListWrapper<TipoServicio> plwTipoServicio) {
|
||||||
|
this.plwTipoServicio = plwTipoServicio;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onClick$btnPesquisa(Event ev) throws InterruptedException {
|
||||||
|
refreshLista();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onClick$btnRefresh(Event ev) {
|
||||||
|
refreshLista();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onClick$btnNovo(Event ev) {
|
||||||
|
verPeriodo(new TipoServicio());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void doAfterCompose(Component comp) throws Exception {
|
||||||
|
super.doAfterCompose(comp);
|
||||||
|
|
||||||
|
tipoServicioList.setItemRenderer(new RenderTipoServicio());
|
||||||
|
tipoServicioList.addEventListener("onDoubleClick", new EventListener() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onEvent(Event event) throws Exception {
|
||||||
|
TipoServicio ts = (TipoServicio) tipoServicioList.getSelected();
|
||||||
|
verPeriodo(ts);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
refreshLista();
|
||||||
|
|
||||||
|
txtNombre.focus();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void verPeriodo(TipoServicio ts) {
|
||||||
|
if (ts == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Map args = new HashMap();
|
||||||
|
args.put("tipoServicio", ts);
|
||||||
|
args.put("tipoServicioList", tipoServicioList);
|
||||||
|
|
||||||
|
openWindow("/gui/catalogos/editarTipoServicio.zul",
|
||||||
|
Labels.getLabel("editarTipoServicioController.window.title"), args, MODAL);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void refreshLista() {
|
||||||
|
HibernateSearchObject<TipoServicio> claseServicioBusqueda =
|
||||||
|
new HibernateSearchObject<TipoServicio>(TipoServicio.class, pagingTipoServicio.getPageSize());
|
||||||
|
|
||||||
|
claseServicioBusqueda.addFilterLike("descservicio", "%" + txtNombre.getText().trim().concat("%"));
|
||||||
|
claseServicioBusqueda.addFilterEqual("activo", Boolean.TRUE);
|
||||||
|
claseServicioBusqueda.addSortAsc("descservicio");
|
||||||
|
claseServicioBusqueda.addFilterNotEqual("tiposervicioId", -1);
|
||||||
|
|
||||||
|
plwTipoServicio.init(claseServicioBusqueda, tipoServicioList, pagingTipoServicio);
|
||||||
|
|
||||||
|
if (tipoServicioList.getData().length == 0) {
|
||||||
|
try {
|
||||||
|
Messagebox.show(Labels.getLabel("MSG.ningunRegistro"),
|
||||||
|
Labels.getLabel("busquedaTipoServicioController.window.title"),
|
||||||
|
Messagebox.OK, Messagebox.INFORMATION);
|
||||||
|
} catch (InterruptedException ex) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,136 @@
|
||||||
|
/*
|
||||||
|
* To change this template, choose Tools | Templates
|
||||||
|
* and open the template in the editor.
|
||||||
|
*/
|
||||||
|
package com.rjconsultores.ventaboletos.web.gui.controladores.catalogos;
|
||||||
|
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.TipoVenta;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.MyGenericForwardComposer;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.MyListbox;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.paginacion.HibernateSearchObject;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.paginacion.PagedListWrapper;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.render.RenderTipoVenta;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.context.annotation.Scope;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.zkoss.util.resource.Labels;
|
||||||
|
import org.zkoss.zhtml.Messagebox;
|
||||||
|
import org.zkoss.zk.ui.Component;
|
||||||
|
import org.zkoss.zk.ui.event.Event;
|
||||||
|
import org.zkoss.zk.ui.event.EventListener;
|
||||||
|
import org.zkoss.zul.Paging;
|
||||||
|
import org.zkoss.zul.Textbox;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Rafius
|
||||||
|
*/
|
||||||
|
@Controller("busquedaTipoVentaController")
|
||||||
|
@Scope("prototype")
|
||||||
|
public class BusquedaTipoVentaController extends MyGenericForwardComposer {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private transient PagedListWrapper<TipoVenta> plwTipoVenta;
|
||||||
|
private MyListbox tipoVentaList;
|
||||||
|
private Paging pagingTipoVenta;
|
||||||
|
private Textbox txtNombre;
|
||||||
|
|
||||||
|
public Textbox getTxtNombre() {
|
||||||
|
return txtNombre;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTxtNombre(Textbox txtNombre) {
|
||||||
|
this.txtNombre = txtNombre;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Paging getPagingTipoVenta() {
|
||||||
|
return pagingTipoVenta;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPagingTipoVenta(Paging pagingTipoVenta) {
|
||||||
|
this.pagingTipoVenta = pagingTipoVenta;
|
||||||
|
}
|
||||||
|
|
||||||
|
public MyListbox getTipoVentaList() {
|
||||||
|
return tipoVentaList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTipoVentaList(MyListbox tipoVentaList) {
|
||||||
|
this.tipoVentaList = tipoVentaList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public PagedListWrapper<TipoVenta> getPlwTipoVenta() {
|
||||||
|
return plwTipoVenta;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPlwTipoVenta(PagedListWrapper<TipoVenta> plwTipoVenta) {
|
||||||
|
this.plwTipoVenta = plwTipoVenta;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onClick$btnPesquisa(Event ev) throws InterruptedException {
|
||||||
|
refreshLista();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onClick$btnRefresh(Event ev) {
|
||||||
|
refreshLista();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onClick$btnNovo(Event ev) {
|
||||||
|
verPeriodo(new TipoVenta());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void doAfterCompose(Component comp) throws Exception {
|
||||||
|
super.doAfterCompose(comp);
|
||||||
|
|
||||||
|
tipoVentaList.setItemRenderer(new RenderTipoVenta());
|
||||||
|
tipoVentaList.addEventListener("onDoubleClick", new EventListener() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onEvent(Event event) throws Exception {
|
||||||
|
TipoVenta ts = (TipoVenta) tipoVentaList.getSelected();
|
||||||
|
verPeriodo(ts);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
refreshLista();
|
||||||
|
|
||||||
|
txtNombre.focus();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void verPeriodo(TipoVenta ts) {
|
||||||
|
if (ts == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Map args = new HashMap();
|
||||||
|
args.put("tipoVenta", ts);
|
||||||
|
args.put("tipoVentaList", tipoVentaList);
|
||||||
|
|
||||||
|
openWindow("/gui/catalogos/editarTipoVenta.zul",
|
||||||
|
Labels.getLabel("editarTipoVentaController.window.title"), args, MODAL);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void refreshLista() {
|
||||||
|
HibernateSearchObject<TipoVenta> claseVentaBusqueda =
|
||||||
|
new HibernateSearchObject<TipoVenta>(TipoVenta.class, pagingTipoVenta.getPageSize());
|
||||||
|
|
||||||
|
claseVentaBusqueda.addFilterLike("desctipoventa", "%" + txtNombre.getText().trim().concat("%"));
|
||||||
|
claseVentaBusqueda.addFilterEqual("activo", Boolean.TRUE);
|
||||||
|
claseVentaBusqueda.addSortAsc("desctipoventa");
|
||||||
|
claseVentaBusqueda.addFilterNotEqual("tipoventaId", -1);
|
||||||
|
|
||||||
|
plwTipoVenta.init(claseVentaBusqueda, tipoVentaList, pagingTipoVenta);
|
||||||
|
|
||||||
|
if (tipoVentaList.getData().length == 0) {
|
||||||
|
try {
|
||||||
|
Messagebox.show(Labels.getLabel("MSG.ningunRegistro"),
|
||||||
|
Labels.getLabel("busquedaTipoVentaController.window.title"),
|
||||||
|
Messagebox.OK, Messagebox.INFORMATION);
|
||||||
|
} catch (InterruptedException ex) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,130 @@
|
||||||
|
/*
|
||||||
|
* To change this template, choose Tools | Templates
|
||||||
|
* and open the template in the editor.
|
||||||
|
*/
|
||||||
|
package com.rjconsultores.ventaboletos.web.gui.controladores.catalogos;
|
||||||
|
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.Turno;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.MyGenericForwardComposer;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.MyListbox;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.paginacion.HibernateSearchObject;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.paginacion.PagedListWrapper;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.render.RenderTurno;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.context.annotation.Scope;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.zkoss.util.resource.Labels;
|
||||||
|
import org.zkoss.zhtml.Messagebox;
|
||||||
|
import org.zkoss.zk.ui.Component;
|
||||||
|
import org.zkoss.zk.ui.event.Event;
|
||||||
|
import org.zkoss.zk.ui.event.EventListener;
|
||||||
|
import org.zkoss.zul.Paging;
|
||||||
|
import org.zkoss.zul.Textbox;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Administrador
|
||||||
|
*/
|
||||||
|
@Controller("busquedaTurnoController")
|
||||||
|
@Scope("prototype")
|
||||||
|
public class BusquedaTurnoController extends MyGenericForwardComposer {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private transient PagedListWrapper<Turno> plwTurno;
|
||||||
|
private MyListbox turnoList;
|
||||||
|
private Paging pagingTurno;
|
||||||
|
private Textbox txtNome;
|
||||||
|
|
||||||
|
public Paging getPagingTurno() {
|
||||||
|
return pagingTurno;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPagingTurno(Paging pagingTurno) {
|
||||||
|
this.pagingTurno = pagingTurno;
|
||||||
|
}
|
||||||
|
|
||||||
|
public MyListbox getTurnoList() {
|
||||||
|
return turnoList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTurnoList(MyListbox turnoList) {
|
||||||
|
this.turnoList = turnoList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Textbox getTxtNome() {
|
||||||
|
return txtNome;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTxtNome(Textbox txtNome) {
|
||||||
|
this.txtNome = txtNome;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void doAfterCompose(Component comp) throws Exception {
|
||||||
|
super.doAfterCompose(comp);
|
||||||
|
|
||||||
|
turnoList.setItemRenderer(new RenderTurno());
|
||||||
|
turnoList.addEventListener("onDoubleClick", new EventListener() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onEvent(Event event) throws Exception {
|
||||||
|
Turno a = (Turno) turnoList.getSelected();
|
||||||
|
verTurno(a);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
refreshLista();
|
||||||
|
|
||||||
|
txtNome.focus();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void verTurno(Turno t) {
|
||||||
|
if (t == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Map args = new HashMap();
|
||||||
|
args.put("turno", t);
|
||||||
|
args.put("turnoList", turnoList);
|
||||||
|
|
||||||
|
openWindow("/gui/catalogos/editarTurno.zul",
|
||||||
|
Labels.getLabel("editarTurnoController.window.title"), args, MODAL);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void refreshLista() {
|
||||||
|
HibernateSearchObject<Turno> turnoBusqueda =
|
||||||
|
new HibernateSearchObject<Turno>(Turno.class,
|
||||||
|
pagingTurno.getPageSize());
|
||||||
|
|
||||||
|
turnoBusqueda.addFilterLike("descturno",
|
||||||
|
"%" + txtNome.getText().trim().concat("%"));
|
||||||
|
|
||||||
|
turnoBusqueda.addSortAsc("descturno");
|
||||||
|
turnoBusqueda.addFilterEqual("activo", Boolean.TRUE);
|
||||||
|
turnoBusqueda.addFilterNotEqual("turnoId", -1);
|
||||||
|
plwTurno.init(turnoBusqueda, turnoList, pagingTurno);
|
||||||
|
|
||||||
|
if (turnoList.getData().length == 0) {
|
||||||
|
try {
|
||||||
|
Messagebox.show(Labels.getLabel("MSG.ningunRegistro"),
|
||||||
|
Labels.getLabel("busquedaTurnoController.window.title"),
|
||||||
|
Messagebox.OK, Messagebox.INFORMATION);
|
||||||
|
} catch (InterruptedException ex) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onClick$btnPesquisa(Event ev) {
|
||||||
|
refreshLista();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onClick$btnRefresh(Event ev) {
|
||||||
|
refreshLista();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onClick$btnNovo(Event ev) {
|
||||||
|
verTurno(new Turno());
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,145 @@
|
||||||
|
/*
|
||||||
|
* To change this template, choose Tools | Templates
|
||||||
|
* and open the template in the editor.
|
||||||
|
*/
|
||||||
|
package com.rjconsultores.ventaboletos.web.gui.controladores.catalogos;
|
||||||
|
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.Articulo;
|
||||||
|
import com.rjconsultores.ventaboletos.service.ArticuloService;
|
||||||
|
import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.MyGenericForwardComposer;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.MyListbox;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.MyTextbox;
|
||||||
|
import java.util.Calendar;
|
||||||
|
import java.util.List;
|
||||||
|
import org.apache.log4j.Logger;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.context.annotation.Scope;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.zkoss.util.resource.Labels;
|
||||||
|
import org.zkoss.zhtml.Messagebox;
|
||||||
|
import org.zkoss.zk.ui.Component;
|
||||||
|
import org.zkoss.zk.ui.Executions;
|
||||||
|
import org.zkoss.zk.ui.event.Event;
|
||||||
|
import org.zkoss.zul.Button;
|
||||||
|
import org.zkoss.zul.Textbox;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Administrador
|
||||||
|
*/
|
||||||
|
@Controller("editarArticuloController")
|
||||||
|
@Scope("prototype")
|
||||||
|
public class EditarArticuloController extends MyGenericForwardComposer {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ArticuloService articuloService;
|
||||||
|
private Articulo articulo;
|
||||||
|
private MyListbox articuloList;
|
||||||
|
private Button btnApagar;
|
||||||
|
private MyTextbox txtNome;
|
||||||
|
private static Logger log = Logger.getLogger(EditarArticuloController.class);
|
||||||
|
|
||||||
|
public Articulo getArticulo() {
|
||||||
|
return articulo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setArticulo(Articulo articulo) {
|
||||||
|
this.articulo = articulo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Button getBtnApagar() {
|
||||||
|
return btnApagar;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBtnApagar(Button btnApagar) {
|
||||||
|
this.btnApagar = btnApagar;
|
||||||
|
}
|
||||||
|
|
||||||
|
public MyTextbox getTxtNome() {
|
||||||
|
return txtNome;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTxtNome(MyTextbox txtNome) {
|
||||||
|
this.txtNome = txtNome;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void doAfterCompose(Component comp) throws Exception {
|
||||||
|
super.doAfterCompose(comp);
|
||||||
|
|
||||||
|
articulo = (Articulo) Executions.getCurrent().getArg().get("articulo");
|
||||||
|
articuloList = (MyListbox) Executions.getCurrent().getArg().get("articuloList");
|
||||||
|
|
||||||
|
if (articulo.getArticuloId() == null) {
|
||||||
|
btnApagar.setVisible(Boolean.FALSE);
|
||||||
|
}
|
||||||
|
|
||||||
|
txtNome.focus();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onClick$btnSalvar(Event ev) throws InterruptedException {
|
||||||
|
txtNome.getValue();
|
||||||
|
|
||||||
|
try {
|
||||||
|
articulo.setActivo(Boolean.TRUE);
|
||||||
|
articulo.setFecmodif(Calendar.getInstance().getTime());
|
||||||
|
articulo.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
|
||||||
|
|
||||||
|
List<Articulo> lsArticulo = articuloService.buscar(articulo.getDescarticulo());
|
||||||
|
|
||||||
|
if (!lsArticulo.isEmpty()) {
|
||||||
|
Messagebox.show(
|
||||||
|
Labels.getLabel("MSG.Registro.Existe"),
|
||||||
|
Labels.getLabel("editarArticuloController.window.title"),
|
||||||
|
Messagebox.OK, Messagebox.EXCLAMATION);
|
||||||
|
} else {
|
||||||
|
if (articulo.getArticuloId() == null) {
|
||||||
|
articuloService.suscribir(articulo);
|
||||||
|
articuloList.addItem(articulo);
|
||||||
|
} else {
|
||||||
|
articuloService.actualizacion(articulo);
|
||||||
|
articuloList.updateItem(articulo);
|
||||||
|
}
|
||||||
|
|
||||||
|
Messagebox.show(
|
||||||
|
Labels.getLabel("editarArticuloController.MSG.suscribirOK"),
|
||||||
|
Labels.getLabel("editarArticuloController.window.title"),
|
||||||
|
Messagebox.OK, Messagebox.INFORMATION);
|
||||||
|
|
||||||
|
closeWindow();
|
||||||
|
}
|
||||||
|
} catch (Exception ex) {
|
||||||
|
log.error("editarArticuloController: " + ex);
|
||||||
|
Messagebox.show(
|
||||||
|
Labels.getLabel("MSG.Error"),
|
||||||
|
Labels.getLabel("editarArticuloController.window.title"),
|
||||||
|
Messagebox.OK, Messagebox.ERROR);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onClick$btnApagar(Event ev) {
|
||||||
|
try {
|
||||||
|
int resp = Messagebox.show(
|
||||||
|
Labels.getLabel("editarArticuloController.MSG.borrarPergunta"),
|
||||||
|
Labels.getLabel("editarArticuloController.window.title"),
|
||||||
|
Messagebox.YES | Messagebox.NO, Messagebox.QUESTION);
|
||||||
|
|
||||||
|
if (resp == Messagebox.YES) {
|
||||||
|
|
||||||
|
articuloService.borrar(articulo);
|
||||||
|
|
||||||
|
Messagebox.show(
|
||||||
|
Labels.getLabel("editarArticuloController.MSG.borrarOK"),
|
||||||
|
Labels.getLabel("editarArticuloController.window.title"),
|
||||||
|
Messagebox.OK, Messagebox.INFORMATION);
|
||||||
|
|
||||||
|
articuloList.removeItem(articulo);
|
||||||
|
|
||||||
|
closeWindow();
|
||||||
|
}
|
||||||
|
} catch (Exception ex) {
|
||||||
|
log.error(ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,215 @@
|
||||||
|
/*
|
||||||
|
* To change this template, choose Tools | Templates
|
||||||
|
* and open the template in the editor.
|
||||||
|
*/
|
||||||
|
package com.rjconsultores.ventaboletos.web.gui.controladores.catalogos;
|
||||||
|
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.ClaseServicio;
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.Marca;
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.MarcaClaseServicio;
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.MarcaClaseServicioPK;
|
||||||
|
import com.rjconsultores.ventaboletos.service.ClaseServicioService;
|
||||||
|
import com.rjconsultores.ventaboletos.service.MarcaClaseServicioService;
|
||||||
|
import com.rjconsultores.ventaboletos.service.MarcaService;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.MyGenericForwardComposer;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.MyListbox;
|
||||||
|
import java.util.List;
|
||||||
|
import org.apache.log4j.Logger;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.context.annotation.Scope;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.zkoss.util.resource.Labels;
|
||||||
|
import org.zkoss.zk.ui.Component;
|
||||||
|
import org.zkoss.zk.ui.Executions;
|
||||||
|
import org.zkoss.zk.ui.event.Event;
|
||||||
|
import org.zkoss.zul.Button;
|
||||||
|
import org.zkoss.zul.Combobox;
|
||||||
|
import org.zkoss.zul.Messagebox;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author rodrigo
|
||||||
|
*/
|
||||||
|
@Controller("editarAsociacionClaseServicioMarcaController")
|
||||||
|
@Scope("prototype")
|
||||||
|
public class EditarAsociacionClaseServicioMarcaController extends MyGenericForwardComposer {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private MarcaClaseServicioService marcaClaseServicioService;
|
||||||
|
@Autowired
|
||||||
|
private MarcaService marcaService;
|
||||||
|
@Autowired
|
||||||
|
private ClaseServicioService claseServicioService;
|
||||||
|
private MarcaClaseServicio marcaClaseServicio;
|
||||||
|
private List<Marca> lsMarcas;
|
||||||
|
private List<ClaseServicio> lsClaseServicios;
|
||||||
|
private MyListbox marcaClaseServicioList;
|
||||||
|
private Combobox cmbMarca;
|
||||||
|
private Combobox cmbClaseServicio;
|
||||||
|
private Button btnApagar;
|
||||||
|
private static Logger log =
|
||||||
|
Logger.getLogger(EditarAsociacionClaseServicioMarcaController.class);
|
||||||
|
|
||||||
|
public List<ClaseServicio> getLsClaseServicios() {
|
||||||
|
return lsClaseServicios;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLsClaseServicios(List<ClaseServicio> lsClaseServicios) {
|
||||||
|
this.lsClaseServicios = lsClaseServicios;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<Marca> getLsMarcas() {
|
||||||
|
return lsMarcas;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLsMarcas(List<Marca> lsMarcas) {
|
||||||
|
this.lsMarcas = lsMarcas;
|
||||||
|
}
|
||||||
|
|
||||||
|
public MarcaClaseServicio getMarcaClaseServicio() {
|
||||||
|
return marcaClaseServicio;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMarcaClaseServicio(MarcaClaseServicio marcaClaseServicio) {
|
||||||
|
this.marcaClaseServicio = marcaClaseServicio;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Combobox getCmbClaseServicio() {
|
||||||
|
return cmbClaseServicio;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCmbClaseServicio(Combobox cmbClaseServicio) {
|
||||||
|
this.cmbClaseServicio = cmbClaseServicio;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Combobox getCmbMarca() {
|
||||||
|
return cmbMarca;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCmbMarca(Combobox cmbMarca) {
|
||||||
|
this.cmbMarca = cmbMarca;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Button getBtnApagar() {
|
||||||
|
return btnApagar;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBtnApagar(Button btnApagar) {
|
||||||
|
this.btnApagar = btnApagar;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void doAfterCompose(Component comp) throws Exception {
|
||||||
|
lsMarcas = marcaService.obtenerTodos();
|
||||||
|
lsClaseServicios = claseServicioService.obtenerTodos();
|
||||||
|
|
||||||
|
marcaClaseServicioList = (MyListbox) Executions.getCurrent().getArg().get("marcaClaseServicioList");
|
||||||
|
marcaClaseServicio = (MarcaClaseServicio) Executions.getCurrent().getArg().get("marcaClaseServicio");
|
||||||
|
|
||||||
|
super.doAfterCompose(comp);
|
||||||
|
|
||||||
|
if (marcaClaseServicio.getMarcaClaseservicioPK() == null) {
|
||||||
|
btnApagar.setVisible(Boolean.FALSE);
|
||||||
|
}
|
||||||
|
|
||||||
|
cmbMarca.focus();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onClick$btnSalvar(Event ev) throws InterruptedException {
|
||||||
|
cmbMarca.getSelectedItem().getValue();
|
||||||
|
cmbClaseServicio.getSelectedItem().getValue();
|
||||||
|
|
||||||
|
try {
|
||||||
|
if (marcaClaseServicio.getMarcaClaseservicioPK() != null) {
|
||||||
|
MarcaClaseServicioPK marcaClaseServicioPK = new MarcaClaseServicioPK();
|
||||||
|
marcaClaseServicioPK.setMarca((Marca) cmbMarca.getSelectedItem().getValue());
|
||||||
|
marcaClaseServicioPK.setClaseservicio((ClaseServicio) cmbClaseServicio.getSelectedItem().getValue());
|
||||||
|
|
||||||
|
MarcaClaseServicio mcs = marcaClaseServicioService.obtenerID(marcaClaseServicioPK);
|
||||||
|
|
||||||
|
|
||||||
|
if (mcs != null && !mcs.getMarcaClaseservicioPK().equals(marcaClaseServicio.getMarcaClaseservicioPK())) {
|
||||||
|
Messagebox.show(
|
||||||
|
Labels.getLabel("MSG.Registro.Existe"),
|
||||||
|
Labels.getLabel("editarAsociacionClaseServicioMarcaController.window.title"),
|
||||||
|
Messagebox.OK, Messagebox.EXCLAMATION);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (marcaClaseServicio.getMarcaClaseservicioPK() == null) {
|
||||||
|
MarcaClaseServicioPK marcaClaseServicioPK = new MarcaClaseServicioPK();
|
||||||
|
marcaClaseServicioPK.setMarca((Marca) cmbMarca.getSelectedItem().getValue());
|
||||||
|
marcaClaseServicioPK.setClaseservicio((ClaseServicio) cmbClaseServicio.getSelectedItem().getValue());
|
||||||
|
|
||||||
|
MarcaClaseServicio mcs = marcaClaseServicioService.obtenerID(marcaClaseServicioPK);
|
||||||
|
|
||||||
|
|
||||||
|
if (mcs == null || !mcs.getActivo()) {
|
||||||
|
marcaClaseServicio.setMarcaClaseservicioPK(marcaClaseServicioPK);
|
||||||
|
if (mcs == null) {
|
||||||
|
marcaClaseServicio.setActivo(true);
|
||||||
|
marcaClaseServicioService.suscribir(marcaClaseServicio);
|
||||||
|
marcaClaseServicioList.addItem(marcaClaseServicio);
|
||||||
|
} else {
|
||||||
|
mcs.setActivo(true);
|
||||||
|
marcaClaseServicioService.suscribir(mcs);
|
||||||
|
marcaClaseServicioList.addItem(mcs);
|
||||||
|
}
|
||||||
|
|
||||||
|
Messagebox.show(
|
||||||
|
Labels.getLabel("editarAsociacionClaseServicioMarcaController.MSG.suscribirOK"),
|
||||||
|
Labels.getLabel("editarAsociacionClaseServicioMarcaController.window.title"),
|
||||||
|
Messagebox.OK, Messagebox.INFORMATION);
|
||||||
|
} else {
|
||||||
|
Messagebox.show(
|
||||||
|
Labels.getLabel("MSG.Registro.Existe"),
|
||||||
|
Labels.getLabel("editarAsociacionClaseServicioMarcaController.window.title"),
|
||||||
|
Messagebox.OK, Messagebox.EXCLAMATION);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
marcaClaseServicio.getMarcaClaseservicioPK().setMarca((Marca) cmbMarca.getSelectedItem().getValue());
|
||||||
|
marcaClaseServicio.getMarcaClaseservicioPK().setClaseservicio((ClaseServicio) cmbClaseServicio.getSelectedItem().getValue());
|
||||||
|
|
||||||
|
marcaClaseServicioService.actualizacion(marcaClaseServicio);
|
||||||
|
marcaClaseServicioList.updateItem(marcaClaseServicio);
|
||||||
|
|
||||||
|
Messagebox.show(
|
||||||
|
Labels.getLabel("editarAsociacionClaseServicioMarcaController.MSG.suscribirOK"),
|
||||||
|
Labels.getLabel("editarAsociacionClaseServicioMarcaController.window.title"),
|
||||||
|
Messagebox.OK, Messagebox.INFORMATION);
|
||||||
|
}
|
||||||
|
|
||||||
|
closeWindow();
|
||||||
|
} catch (Exception ex) {
|
||||||
|
log.error("editarAsociacionClaseServicioMarcaController: " + ex);
|
||||||
|
Messagebox.show(
|
||||||
|
Labels.getLabel("MSG.Error"),
|
||||||
|
Labels.getLabel("editarAsociacionClaseServicioMarcaController.window.title"),
|
||||||
|
Messagebox.OK, Messagebox.ERROR);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onClick$btnApagar(Event ev) {
|
||||||
|
try {
|
||||||
|
int resp = Messagebox.show(
|
||||||
|
Labels.getLabel("editarAsociacionClaseServicioMarcaController.MSG.borrarPergunta"),
|
||||||
|
Labels.getLabel("editarAsociacionClaseServicioMarcaController.window.title"),
|
||||||
|
Messagebox.YES | Messagebox.NO, Messagebox.QUESTION);
|
||||||
|
|
||||||
|
if (resp == Messagebox.YES) {
|
||||||
|
marcaClaseServicioService.borrar(marcaClaseServicio);
|
||||||
|
|
||||||
|
Messagebox.show(
|
||||||
|
Labels.getLabel("editarAsociacionClaseServicioMarcaController.MSG.borrarOK"),
|
||||||
|
Labels.getLabel("editarAsociacionClaseServicioMarcaController.window.title"),
|
||||||
|
Messagebox.OK, Messagebox.INFORMATION);
|
||||||
|
|
||||||
|
marcaClaseServicioList.removeItem(marcaClaseServicio);
|
||||||
|
|
||||||
|
closeWindow();
|
||||||
|
}
|
||||||
|
} catch (Exception ex) {
|
||||||
|
log.error(ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,171 @@
|
||||||
|
/*
|
||||||
|
* To change this template, choose Tools | Templates
|
||||||
|
* and open the template in the editor.
|
||||||
|
*/
|
||||||
|
package com.rjconsultores.ventaboletos.web.gui.controladores.catalogos;
|
||||||
|
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.Categoria;
|
||||||
|
import com.rjconsultores.ventaboletos.service.CategoriaService;
|
||||||
|
import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.MyGenericForwardComposer;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.MyListbox;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.MyTextbox;
|
||||||
|
import org.apache.log4j.Logger;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.context.annotation.Scope;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import java.util.Calendar;
|
||||||
|
import java.util.List;
|
||||||
|
import org.zkoss.util.resource.Labels;
|
||||||
|
import org.zkoss.zk.ui.Component;
|
||||||
|
import org.zkoss.zk.ui.Executions;
|
||||||
|
import org.zkoss.zk.ui.event.Event;
|
||||||
|
import org.zkoss.zul.Button;
|
||||||
|
import org.zkoss.zul.Messagebox;
|
||||||
|
import org.zkoss.zul.Textbox;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Rafius
|
||||||
|
*/
|
||||||
|
@Controller("editarCategoriaController")
|
||||||
|
@Scope("prototype")
|
||||||
|
public class EditarCategoriaController extends MyGenericForwardComposer {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private CategoriaService categoriaService;
|
||||||
|
private Categoria categoria;
|
||||||
|
private MyListbox categoriaList;
|
||||||
|
private Button btnApagar;
|
||||||
|
private static Logger log = Logger.getLogger(EditarCategoriaController.class);
|
||||||
|
private MyTextbox txtNome;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void doAfterCompose(Component comp) throws Exception {
|
||||||
|
super.doAfterCompose(comp);
|
||||||
|
|
||||||
|
categoria = (Categoria) Executions.getCurrent().getArg().get("categoria");
|
||||||
|
categoriaList = (MyListbox) Executions.getCurrent().getArg().get("categoriaList");
|
||||||
|
|
||||||
|
if (categoria.getCategoriaId() == null) {
|
||||||
|
btnApagar.setVisible(Boolean.FALSE);
|
||||||
|
} else {
|
||||||
|
if (categoria.getCategoriaId() == 1) {
|
||||||
|
btnApagar.setVisible(Boolean.FALSE);
|
||||||
|
txtNome.setDisabled(Boolean.TRUE);
|
||||||
|
|
||||||
|
Messagebox.show(
|
||||||
|
Labels.getLabel("MSG.noEditabled"),
|
||||||
|
Labels.getLabel("editarCategoriaController.window.title"),
|
||||||
|
Messagebox.OK, Messagebox.INFORMATION);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
txtNome.focus();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onClick$btnSalvar(Event ev) throws InterruptedException {
|
||||||
|
txtNome.getValue();
|
||||||
|
try {
|
||||||
|
categoria.setActivo(true);
|
||||||
|
categoria.setFecmodif(Calendar.getInstance().getTime());
|
||||||
|
categoria.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
|
||||||
|
|
||||||
|
if (categoria.getCategoriaId() != null) {
|
||||||
|
List<Categoria> lsCategoria = categoriaService.buscar(categoria.getDesccategoria());
|
||||||
|
if (!lsCategoria.isEmpty()) {
|
||||||
|
Messagebox.show(
|
||||||
|
Labels.getLabel("MSG.Registro.Existe"),
|
||||||
|
Labels.getLabel("editarCategoriaController.window.title"),
|
||||||
|
Messagebox.OK, Messagebox.EXCLAMATION);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (categoria.getCategoriaId() == null) {
|
||||||
|
List<Categoria> lsCategoria =
|
||||||
|
categoriaService.buscar(categoria.getDesccategoria().trim());
|
||||||
|
|
||||||
|
if (lsCategoria.isEmpty()) {
|
||||||
|
categoriaService.suscribir(categoria);
|
||||||
|
categoriaList.addItem(categoria);
|
||||||
|
|
||||||
|
Messagebox.show(
|
||||||
|
Labels.getLabel("editarCategoriaController.MSG.suscribirOK"),
|
||||||
|
Labels.getLabel("editarCategoriaController.window.title"),
|
||||||
|
Messagebox.OK, Messagebox.INFORMATION);
|
||||||
|
} else {
|
||||||
|
Messagebox.show(
|
||||||
|
Labels.getLabel("MSG.Registro.Existe"),
|
||||||
|
Labels.getLabel("editarCategoriaController.window.title"),
|
||||||
|
Messagebox.OK, Messagebox.EXCLAMATION);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
categoriaService.actualizacion(categoria);
|
||||||
|
categoriaList.updateItem(categoria);
|
||||||
|
|
||||||
|
Messagebox.show(
|
||||||
|
Labels.getLabel("editarCategoriaController.MSG.suscribirOK"),
|
||||||
|
Labels.getLabel("editarCategoriaController.window.title"),
|
||||||
|
Messagebox.OK, Messagebox.INFORMATION);
|
||||||
|
}
|
||||||
|
|
||||||
|
closeWindow();
|
||||||
|
} catch (Exception ex) {
|
||||||
|
log.error("editarCategoriaController: " + ex);
|
||||||
|
Messagebox.show(
|
||||||
|
Labels.getLabel("MSG.Error"),
|
||||||
|
Labels.getLabel("editarCategoriaController.window.title"),
|
||||||
|
Messagebox.OK, Messagebox.ERROR);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onClick$btnApagar(Event ev) {
|
||||||
|
try {
|
||||||
|
int resp = Messagebox.show(
|
||||||
|
Labels.getLabel("editarCategoriaController.MSG.borrarPergunta"),
|
||||||
|
Labels.getLabel("editarCategoriaController.window.title"),
|
||||||
|
Messagebox.YES | Messagebox.NO, Messagebox.QUESTION);
|
||||||
|
|
||||||
|
if (resp == Messagebox.YES) {
|
||||||
|
|
||||||
|
categoriaService.borrar(categoria);
|
||||||
|
|
||||||
|
Messagebox.show(
|
||||||
|
Labels.getLabel("editarCategoriaController.MSG.borrarOK"),
|
||||||
|
Labels.getLabel("editarCategoriaController.window.title"),
|
||||||
|
Messagebox.OK, Messagebox.INFORMATION);
|
||||||
|
|
||||||
|
categoriaList.removeItem(categoria);
|
||||||
|
|
||||||
|
closeWindow();
|
||||||
|
}
|
||||||
|
} catch (Exception ex) {
|
||||||
|
log.error(ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public Categoria getCategoria() {
|
||||||
|
return categoria;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCategoria(Categoria categoria) {
|
||||||
|
this.categoria = categoria;
|
||||||
|
}
|
||||||
|
|
||||||
|
public MyListbox getCategoriaList() {
|
||||||
|
return categoriaList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCategoriaList(MyListbox categoriaList) {
|
||||||
|
this.categoriaList = categoriaList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public CategoriaService getCategoriaService() {
|
||||||
|
return categoriaService;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCategoriaService(CategoriaService categoriaService) {
|
||||||
|
this.categoriaService = categoriaService;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,230 @@
|
||||||
|
/*
|
||||||
|
* To change this template, choose Tools | Templates
|
||||||
|
* and open the template in the editor.
|
||||||
|
*/
|
||||||
|
package com.rjconsultores.ventaboletos.web.gui.controladores.catalogos;
|
||||||
|
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.Ciudad;
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.Estado;
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.Plaza;
|
||||||
|
import com.rjconsultores.ventaboletos.service.CiudadService;
|
||||||
|
import com.rjconsultores.ventaboletos.service.EstadoService;
|
||||||
|
import com.rjconsultores.ventaboletos.service.PlazaService;
|
||||||
|
import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado;
|
||||||
|
import com.rjconsultores.ventaboletos.utilerias.ApplicationProperties;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.MyGenericForwardComposer;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.MyListbox;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.MyTextbox;
|
||||||
|
import java.util.Calendar;
|
||||||
|
import java.util.List;
|
||||||
|
import org.apache.log4j.Logger;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.context.annotation.Scope;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.zkoss.util.resource.Labels;
|
||||||
|
import org.zkoss.zhtml.Messagebox;
|
||||||
|
import org.zkoss.zk.ui.Component;
|
||||||
|
import org.zkoss.zk.ui.Executions;
|
||||||
|
import org.zkoss.zk.ui.event.Event;
|
||||||
|
import org.zkoss.zul.Button;
|
||||||
|
import org.zkoss.zul.Combobox;
|
||||||
|
import org.zkoss.zul.Row;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author MCosso
|
||||||
|
*/
|
||||||
|
@Controller("editarCiudadController")
|
||||||
|
@Scope("prototype")
|
||||||
|
public class EditarCiudadController extends MyGenericForwardComposer {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private CiudadService ciudadService;
|
||||||
|
@Autowired
|
||||||
|
private EstadoService estadoService;
|
||||||
|
@Autowired
|
||||||
|
private PlazaService plazaService;
|
||||||
|
private List<Estado> lsEstado;
|
||||||
|
private List<Plaza> lsPlaza;
|
||||||
|
private Ciudad ciudad;
|
||||||
|
private MyListbox ciudadList;
|
||||||
|
private static Logger log = Logger.getLogger(EditarCiudadController.class);
|
||||||
|
private MyTextbox txtNome;
|
||||||
|
private Combobox cmbEstado;
|
||||||
|
private Combobox cmbPlaza;
|
||||||
|
private Button btnApagar;
|
||||||
|
private Row rowEquivalencia;
|
||||||
|
|
||||||
|
public Ciudad getCiudad() {
|
||||||
|
return ciudad;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCiudad(Ciudad ciudad) {
|
||||||
|
this.ciudad = ciudad;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Button getBtnApagar() {
|
||||||
|
return btnApagar;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBtnApagar(Button btnApagar) {
|
||||||
|
this.btnApagar = btnApagar;
|
||||||
|
}
|
||||||
|
|
||||||
|
public MyListbox getCiudadList() {
|
||||||
|
return ciudadList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCiudadList(MyListbox ciudadList) {
|
||||||
|
this.ciudadList = ciudadList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<Estado> getLsEstado() {
|
||||||
|
return lsEstado;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLsEstado(List<Estado> lsEstado) {
|
||||||
|
this.lsEstado = lsEstado;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<Plaza> getLsPlaza() {
|
||||||
|
return lsPlaza;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLsPlaza(List<Plaza> lsPlaza) {
|
||||||
|
this.lsPlaza = lsPlaza;
|
||||||
|
}
|
||||||
|
|
||||||
|
public MyTextbox getTxtNome() {
|
||||||
|
return txtNome;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTxtNome(MyTextbox txtNome) {
|
||||||
|
this.txtNome = txtNome;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Combobox getCmbEstado() {
|
||||||
|
return cmbEstado;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCmbEstado(Combobox cmbEstado) {
|
||||||
|
this.cmbEstado = cmbEstado;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Combobox getCmbPlaza() {
|
||||||
|
return cmbPlaza;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCmbPlaza(Combobox cmbPlaza) {
|
||||||
|
this.cmbPlaza = cmbPlaza;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Row getRowEquivalencia() {
|
||||||
|
return rowEquivalencia;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRowEquivalencia(Row rowEquivalencia) {
|
||||||
|
this.rowEquivalencia = rowEquivalencia;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void doAfterCompose(Component comp) throws Exception {
|
||||||
|
lsEstado = estadoService.obtenerTodos();
|
||||||
|
lsPlaza = plazaService.obtenerTodos();
|
||||||
|
|
||||||
|
super.doAfterCompose(comp);
|
||||||
|
|
||||||
|
ciudad = (Ciudad) Executions.getCurrent().getArg().get("ciudad");
|
||||||
|
ciudadList = (MyListbox) Executions.getCurrent().getArg().get("ciudadList");
|
||||||
|
|
||||||
|
if (ciudad.getCiudadId() == null) {
|
||||||
|
btnApagar.setVisible(Boolean.FALSE);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!ApplicationProperties.getInstance().mostrarEquivalencia()) {
|
||||||
|
rowEquivalencia.setVisible(Boolean.FALSE);
|
||||||
|
}
|
||||||
|
|
||||||
|
txtNome.focus();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onClick$btnSalvar(Event ev) throws InterruptedException {
|
||||||
|
txtNome.getValue();
|
||||||
|
cmbEstado.getValue();
|
||||||
|
cmbEstado.getValue();
|
||||||
|
|
||||||
|
try {
|
||||||
|
ciudad.setActivo(Boolean.TRUE);
|
||||||
|
ciudad.setFecmodif(Calendar.getInstance().getTime());
|
||||||
|
ciudad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
|
||||||
|
|
||||||
|
List<Ciudad> lsCiudad = ciudadService.buscar(ciudad.getNombciudad(),
|
||||||
|
ciudad.getEstado(), ciudad.getPlaza());
|
||||||
|
|
||||||
|
boolean podeSalvar = false;
|
||||||
|
if (lsCiudad.isEmpty()) {
|
||||||
|
podeSalvar = true;
|
||||||
|
} else {
|
||||||
|
if (ciudad.getCiudadId() != null) {
|
||||||
|
for (Ciudad c : lsCiudad) {
|
||||||
|
if (c.getCiudadId().equals(ciudad.getCiudadId())) {
|
||||||
|
podeSalvar = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (podeSalvar) {
|
||||||
|
if (ciudad.getCiudadId() == null) {
|
||||||
|
ciudadService.suscribir(ciudad);
|
||||||
|
ciudadList.addItem(ciudad);
|
||||||
|
} else {
|
||||||
|
ciudadService.actualizacion(ciudad);
|
||||||
|
ciudadList.updateItem(ciudad);
|
||||||
|
}
|
||||||
|
|
||||||
|
Messagebox.show(
|
||||||
|
Labels.getLabel("editarCiudadController.MSG.suscribirOK"),
|
||||||
|
Labels.getLabel("editarCiudadController.window.title"),
|
||||||
|
Messagebox.OK, Messagebox.INFORMATION);
|
||||||
|
|
||||||
|
closeWindow();
|
||||||
|
} else {
|
||||||
|
Messagebox.show(
|
||||||
|
Labels.getLabel("MSG.Registro.Existe"),
|
||||||
|
Labels.getLabel("editarCiudadController.window.title"),
|
||||||
|
Messagebox.OK, Messagebox.EXCLAMATION);
|
||||||
|
}
|
||||||
|
} catch (Exception ex) {
|
||||||
|
log.error("editarCiudadController: " + ex);
|
||||||
|
Messagebox.show(
|
||||||
|
Labels.getLabel("MSG.Error"),
|
||||||
|
Labels.getLabel("editarCiudadController.window.title"),
|
||||||
|
Messagebox.OK, Messagebox.ERROR);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onClick$btnApagar(Event ev) {
|
||||||
|
try {
|
||||||
|
int resp = Messagebox.show(
|
||||||
|
Labels.getLabel("editarCiudadController.MSG.borrarPergunta"),
|
||||||
|
Labels.getLabel("editarCiudadController.window.title"),
|
||||||
|
Messagebox.YES | Messagebox.NO, Messagebox.QUESTION);
|
||||||
|
|
||||||
|
if (resp == Messagebox.YES) {
|
||||||
|
|
||||||
|
ciudadService.borrar(ciudad);
|
||||||
|
|
||||||
|
Messagebox.show(
|
||||||
|
Labels.getLabel("editarCiudadController.MSG.borrarOK"),
|
||||||
|
Labels.getLabel("editarCiudadController.window.title"),
|
||||||
|
Messagebox.OK, Messagebox.INFORMATION);
|
||||||
|
|
||||||
|
ciudadList.removeItem(ciudad);
|
||||||
|
|
||||||
|
closeWindow();
|
||||||
|
}
|
||||||
|
} catch (Exception ex) {
|
||||||
|
log.error(ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,145 @@
|
||||||
|
/*
|
||||||
|
* To change this template, choose Tools | Templates
|
||||||
|
* and open the template in the editor.
|
||||||
|
*/
|
||||||
|
package com.rjconsultores.ventaboletos.web.gui.controladores.catalogos;
|
||||||
|
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.ClaseServicio;
|
||||||
|
import com.rjconsultores.ventaboletos.service.ClaseServicioService;
|
||||||
|
import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.MyGenericForwardComposer;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.MyListbox;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.MyTextbox;
|
||||||
|
import java.util.Calendar;
|
||||||
|
import java.util.List;
|
||||||
|
import org.apache.log4j.Logger;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.context.annotation.Scope;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.zkoss.zhtml.Messagebox;
|
||||||
|
import org.zkoss.zk.ui.Component;
|
||||||
|
import org.zkoss.zk.ui.Executions;
|
||||||
|
import org.zkoss.zk.ui.event.Event;
|
||||||
|
import org.zkoss.util.resource.Labels;
|
||||||
|
import org.zkoss.zul.Button;
|
||||||
|
import org.zkoss.zul.Textbox;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Administrador
|
||||||
|
*/
|
||||||
|
@Controller("editarClaseServicioController")
|
||||||
|
@Scope("prototype")
|
||||||
|
public class EditarClaseServicioController extends MyGenericForwardComposer {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ClaseServicioService claseServicioService;
|
||||||
|
private ClaseServicio claseServicio;
|
||||||
|
private MyListbox claseServicioList;
|
||||||
|
private MyTextbox txtNome;
|
||||||
|
private Button btnApagar;
|
||||||
|
private static Logger log = Logger.getLogger(EditarClaseServicioController.class);
|
||||||
|
|
||||||
|
public ClaseServicio getClaseServicio() {
|
||||||
|
return claseServicio;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setClaseServicio(ClaseServicio claseServicio) {
|
||||||
|
this.claseServicio = claseServicio;
|
||||||
|
}
|
||||||
|
|
||||||
|
public MyTextbox getTxtNome() {
|
||||||
|
return txtNome;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTxtNome(MyTextbox txtNome) {
|
||||||
|
this.txtNome = txtNome;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Button getBtnApagar() {
|
||||||
|
return btnApagar;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBtnApagar(Button btnApagar) {
|
||||||
|
this.btnApagar = btnApagar;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void doAfterCompose(Component comp) throws Exception {
|
||||||
|
super.doAfterCompose(comp);
|
||||||
|
|
||||||
|
claseServicio = (ClaseServicio) Executions.getCurrent().getArg().get("claseServicio");
|
||||||
|
claseServicioList = (MyListbox) Executions.getCurrent().getArg().get("claseServicioList");
|
||||||
|
|
||||||
|
if (claseServicio.getClaseservicioId() == null) {
|
||||||
|
btnApagar.setVisible(Boolean.FALSE);
|
||||||
|
}
|
||||||
|
|
||||||
|
txtNome.focus();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onClick$btnSalvar(Event ev) throws InterruptedException {
|
||||||
|
txtNome.getText();
|
||||||
|
|
||||||
|
try {
|
||||||
|
String nomeClaseServicio = claseServicio.getDescclase();
|
||||||
|
List<ClaseServicio> lsClaseServicio = claseServicioService.buscarPorNome(nomeClaseServicio);
|
||||||
|
|
||||||
|
if (lsClaseServicio.isEmpty()) {
|
||||||
|
claseServicio.setActivo(Boolean.TRUE);
|
||||||
|
claseServicio.setFecmodif(Calendar.getInstance().getTime());
|
||||||
|
claseServicio.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
|
||||||
|
|
||||||
|
if (claseServicio.getClaseservicioId() == null) {
|
||||||
|
claseServicioService.suscribir(claseServicio);
|
||||||
|
claseServicioList.addItem(claseServicio);
|
||||||
|
} else {
|
||||||
|
claseServicioService.actualizacion(claseServicio);
|
||||||
|
claseServicioList.updateItem(claseServicio);
|
||||||
|
}
|
||||||
|
|
||||||
|
Messagebox.show(
|
||||||
|
Labels.getLabel("editarClaseServicioController.MSG.suscribirOK"),
|
||||||
|
Labels.getLabel("editarClaseServicioController.window.title"),
|
||||||
|
Messagebox.OK, Messagebox.INFORMATION);
|
||||||
|
|
||||||
|
closeWindow();
|
||||||
|
} else {
|
||||||
|
Messagebox.show(
|
||||||
|
Labels.getLabel("MSG.Registro.Existe"),
|
||||||
|
Labels.getLabel("editarClaseServicioController.window.title"),
|
||||||
|
Messagebox.OK, Messagebox.EXCLAMATION);
|
||||||
|
}
|
||||||
|
} catch (Exception ex) {
|
||||||
|
log.error("editarClaseServicioController: " + ex);
|
||||||
|
Messagebox.show(
|
||||||
|
Labels.getLabel("MSG.Error"),
|
||||||
|
Labels.getLabel("editarClaseServicioController.window.title"),
|
||||||
|
Messagebox.OK, Messagebox.ERROR);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onClick$btnApagar(Event ev) {
|
||||||
|
try {
|
||||||
|
int resp = Messagebox.show(
|
||||||
|
Labels.getLabel("editarClaseServicioController.MSG.borrarPergunta"),
|
||||||
|
Labels.getLabel("editarClaseServicioController.window.title"),
|
||||||
|
Messagebox.YES | Messagebox.NO, Messagebox.QUESTION);
|
||||||
|
|
||||||
|
if (resp == Messagebox.YES) {
|
||||||
|
claseServicioService.borrar(claseServicio);
|
||||||
|
|
||||||
|
Messagebox.show(
|
||||||
|
Labels.getLabel("editarClaseServicioController.MSG.borrarOK"),
|
||||||
|
Labels.getLabel("editarClaseServicioController.window.title"),
|
||||||
|
Messagebox.OK, Messagebox.INFORMATION);
|
||||||
|
|
||||||
|
claseServicioList.removeItem(claseServicio);
|
||||||
|
|
||||||
|
closeWindow();
|
||||||
|
}
|
||||||
|
} catch (Exception ex) {
|
||||||
|
log.error(ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,223 @@
|
||||||
|
/*
|
||||||
|
* To change this template, choose Tools | Templates
|
||||||
|
* and open the template in the editor.
|
||||||
|
*/
|
||||||
|
package com.rjconsultores.ventaboletos.web.gui.controladores.catalogos;
|
||||||
|
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.Ciudad;
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.Colonia;
|
||||||
|
import com.rjconsultores.ventaboletos.service.ColoniaService;
|
||||||
|
import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.MyGenericForwardComposer;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.MyListbox;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.MyTextbox;
|
||||||
|
import java.util.Calendar;
|
||||||
|
import java.util.List;
|
||||||
|
import org.apache.log4j.Logger;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.context.annotation.Scope;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.zkoss.util.resource.Labels;
|
||||||
|
import org.zkoss.zhtml.Messagebox;
|
||||||
|
import org.zkoss.zk.ui.Component;
|
||||||
|
import org.zkoss.zk.ui.Executions;
|
||||||
|
import org.zkoss.zk.ui.event.Event;
|
||||||
|
import org.zkoss.zul.Button;
|
||||||
|
import org.zkoss.zul.Combobox;
|
||||||
|
import org.zkoss.zul.Comboitem;
|
||||||
|
import org.zkoss.zul.Intbox;
|
||||||
|
import org.zkoss.zul.Textbox;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Rafius
|
||||||
|
*/
|
||||||
|
@Controller("editarColoniaController")
|
||||||
|
@Scope("prototype")
|
||||||
|
public class EditarColoniaController extends MyGenericForwardComposer {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ColoniaService coloniaService;
|
||||||
|
private Colonia colonia;
|
||||||
|
private MyListbox coloniaList;
|
||||||
|
private static Logger log = Logger.getLogger(EditarColoniaController.class);
|
||||||
|
private MyTextbox txtNome;
|
||||||
|
private Button btnApagar;
|
||||||
|
private Combobox cmbCiudad;
|
||||||
|
private Intbox codpostal;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public Colonia getColonia() {
|
||||||
|
return colonia;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setColonia(Colonia colonia) {
|
||||||
|
this.colonia = colonia;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Button getBtnApagar() {
|
||||||
|
return btnApagar;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBtnApagar(Button btnApagar) {
|
||||||
|
this.btnApagar = btnApagar;
|
||||||
|
}
|
||||||
|
|
||||||
|
public MyListbox getColoniaList() {
|
||||||
|
return coloniaList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setColoniaList(MyListbox coloniaList) {
|
||||||
|
this.coloniaList = coloniaList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public MyTextbox getTxtNome() {
|
||||||
|
return txtNome;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTxtNome(MyTextbox txtNome) {
|
||||||
|
this.txtNome = txtNome;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ColoniaService getColoniaService() {
|
||||||
|
return coloniaService;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setColoniaService(ColoniaService coloniaService) {
|
||||||
|
this.coloniaService = coloniaService;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Combobox getCmbCiudad() {
|
||||||
|
return cmbCiudad;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCmbCiudad(Combobox cmbCiudad) {
|
||||||
|
this.cmbCiudad = cmbCiudad;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void doAfterCompose(Component comp) throws Exception {
|
||||||
|
|
||||||
|
super.doAfterCompose(comp);
|
||||||
|
|
||||||
|
colonia = (Colonia) Executions.getCurrent().getArg().get("colonia");
|
||||||
|
coloniaList = (MyListbox) Executions.getCurrent().getArg().get("coloniaList");
|
||||||
|
|
||||||
|
if (colonia.getColoniaId() == null) {
|
||||||
|
btnApagar.setVisible(Boolean.FALSE);
|
||||||
|
} else {
|
||||||
|
cmbCiudad.setText(colonia.getCiudad().getNombciudad());
|
||||||
|
|
||||||
|
}
|
||||||
|
txtNome.focus();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onClick$btnSalvar(Event ev) throws InterruptedException {
|
||||||
|
txtNome.getValue();
|
||||||
|
cmbCiudad.getValue();
|
||||||
|
codpostal.getValue();
|
||||||
|
try {
|
||||||
|
colonia.setActivo(Boolean.TRUE);
|
||||||
|
colonia.setFecmodif(Calendar.getInstance().getTime());
|
||||||
|
colonia.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
|
||||||
|
|
||||||
|
Comboitem ciudad = cmbCiudad.getSelectedItem();
|
||||||
|
if (ciudad != null) {
|
||||||
|
colonia.setCiudad((Ciudad) ciudad.getValue());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
List<Colonia> lsColonia = coloniaService.buscar(colonia.getDesccolonia());
|
||||||
|
|
||||||
|
boolean podeSalvar = false;
|
||||||
|
if (lsColonia.isEmpty()) {
|
||||||
|
podeSalvar = true;
|
||||||
|
} else {
|
||||||
|
if (colonia.getColoniaId() != null) {
|
||||||
|
for (Colonia c : lsColonia) {
|
||||||
|
if (c.getColoniaId().equals(colonia.getColoniaId())) {
|
||||||
|
podeSalvar = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
for (Colonia c : lsColonia) {
|
||||||
|
if (!(c.getDesccolonia().toUpperCase().equals(colonia.getDesccolonia())) || !(c.getCodpostal().equals(colonia.getCodpostal()))
|
||||||
|
|| !(c.getCiudad().equals(colonia.getCiudad()))) {
|
||||||
|
podeSalvar = true;
|
||||||
|
} else {
|
||||||
|
podeSalvar = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (podeSalvar) {
|
||||||
|
if (colonia.getColoniaId() == null) {
|
||||||
|
coloniaService.suscribir(colonia);
|
||||||
|
coloniaList.addItem(colonia);
|
||||||
|
} else {
|
||||||
|
coloniaService.actualizacion(colonia);
|
||||||
|
coloniaList.updateItem(colonia);
|
||||||
|
}
|
||||||
|
|
||||||
|
Messagebox.show(
|
||||||
|
Labels.getLabel("editarColoniaController.MSG.suscribirOK"),
|
||||||
|
Labels.getLabel("editarColoniaController.window.title"),
|
||||||
|
Messagebox.OK, Messagebox.INFORMATION);
|
||||||
|
|
||||||
|
closeWindow();
|
||||||
|
} else {
|
||||||
|
Messagebox.show(
|
||||||
|
Labels.getLabel("MSG.Registro.Existe"),
|
||||||
|
Labels.getLabel("editarColoniaController.window.title"),
|
||||||
|
Messagebox.OK, Messagebox.EXCLAMATION);
|
||||||
|
}
|
||||||
|
} catch (Exception ex) {
|
||||||
|
log.error("editarColoniaController: " + ex);
|
||||||
|
Messagebox.show(
|
||||||
|
Labels.getLabel("MSG.Error"),
|
||||||
|
Labels.getLabel("editarColoniaController.window.title"),
|
||||||
|
Messagebox.OK, Messagebox.ERROR);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onClick$btnApagar(Event ev) {
|
||||||
|
try {
|
||||||
|
int resp = Messagebox.show(
|
||||||
|
Labels.getLabel("editarColoniaController.MSG.borrarPergunta"),
|
||||||
|
Labels.getLabel("editarColoniaController.window.title"),
|
||||||
|
Messagebox.YES | Messagebox.NO, Messagebox.QUESTION);
|
||||||
|
|
||||||
|
if (resp == Messagebox.YES) {
|
||||||
|
|
||||||
|
coloniaService.borrar(colonia);
|
||||||
|
|
||||||
|
Messagebox.show(
|
||||||
|
Labels.getLabel("editarColoniaController.MSG.borrarOK"),
|
||||||
|
Labels.getLabel("editarColoniaController.window.title"),
|
||||||
|
Messagebox.OK, Messagebox.INFORMATION);
|
||||||
|
|
||||||
|
coloniaList.removeItem(colonia);
|
||||||
|
|
||||||
|
closeWindow();
|
||||||
|
}
|
||||||
|
} catch (Exception ex) {
|
||||||
|
log.error(ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the codpostal
|
||||||
|
*/
|
||||||
|
public Intbox getCodpostal() {
|
||||||
|
return codpostal;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param codpostal the codpostal to set
|
||||||
|
*/
|
||||||
|
public void setCodpostal(Intbox codpostal) {
|
||||||
|
this.codpostal = codpostal;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,180 @@
|
||||||
|
/*
|
||||||
|
* To change this template, choose Tools | Templates
|
||||||
|
* and open the template in the editor.
|
||||||
|
*/
|
||||||
|
package com.rjconsultores.ventaboletos.web.gui.controladores.catalogos;
|
||||||
|
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.CuponConvenio;
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.TipoConvenio;
|
||||||
|
import com.rjconsultores.ventaboletos.service.CuponConvenioService;
|
||||||
|
import com.rjconsultores.ventaboletos.service.TipoConvenioService;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.MyGenericForwardComposer;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.MyListbox;
|
||||||
|
import java.util.Calendar;
|
||||||
|
import java.util.List;
|
||||||
|
import org.apache.log4j.Logger;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.context.annotation.Scope;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.zkoss.util.resource.Labels;
|
||||||
|
import org.zkoss.zk.ui.Component;
|
||||||
|
import org.zkoss.zk.ui.Executions;
|
||||||
|
import org.zkoss.zk.ui.event.Event;
|
||||||
|
import org.zkoss.zul.Combobox;
|
||||||
|
import org.zkoss.zul.Intbox;
|
||||||
|
import org.zkoss.zul.Messagebox;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Shiro
|
||||||
|
*/
|
||||||
|
@Controller("editarCuponConvenioController")
|
||||||
|
@Scope("prototype")
|
||||||
|
public class EditarCuponConvenioController extends MyGenericForwardComposer {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private CuponConvenioService cuponConService;
|
||||||
|
@Autowired
|
||||||
|
private TipoConvenioService tipoConService;
|
||||||
|
private CuponConvenio cc;
|
||||||
|
private MyListbox CuponConvenioList;
|
||||||
|
private Combobox cmbTipoConvenio;
|
||||||
|
private Intbox folioInicio;
|
||||||
|
private Intbox folioFin;
|
||||||
|
private List<TipoConvenio> tipoConvenioList;
|
||||||
|
private static Logger log = Logger.getLogger(EditarCuponConvenioController.class);
|
||||||
|
|
||||||
|
public Combobox getCmbTipoConvenio() {
|
||||||
|
return cmbTipoConvenio;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCmbTipoConvenio(Combobox cmbTipoConvenio) {
|
||||||
|
this.cmbTipoConvenio = cmbTipoConvenio;
|
||||||
|
}
|
||||||
|
|
||||||
|
public MyListbox getCuponConvenioList() {
|
||||||
|
return CuponConvenioList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCuponConvenioList(MyListbox CuponConvenioList) {
|
||||||
|
this.CuponConvenioList = CuponConvenioList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public CuponConvenio getCc() {
|
||||||
|
return cc;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCc(CuponConvenio cc) {
|
||||||
|
this.cc = cc;
|
||||||
|
}
|
||||||
|
|
||||||
|
public CuponConvenioService getCuponConService() {
|
||||||
|
return cuponConService;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCuponConService(CuponConvenioService cuponConService) {
|
||||||
|
this.cuponConService = cuponConService;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Intbox getFolioFin() {
|
||||||
|
return folioFin;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFolioFin(Intbox folioFin) {
|
||||||
|
this.folioFin = folioFin;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Intbox getFolioInicio() {
|
||||||
|
return folioInicio;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFolioInicio(Intbox folioInicio) {
|
||||||
|
this.folioInicio = folioInicio;
|
||||||
|
}
|
||||||
|
|
||||||
|
public TipoConvenioService getTipoConService() {
|
||||||
|
return tipoConService;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTipoConService(TipoConvenioService tipoConService) {
|
||||||
|
this.tipoConService = tipoConService;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<TipoConvenio> getTipoConvenioList() {
|
||||||
|
return tipoConvenioList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTipoConvenioList(List<TipoConvenio> tipoConvenioList) {
|
||||||
|
this.tipoConvenioList = tipoConvenioList;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void doAfterCompose(Component comp) throws Exception {
|
||||||
|
|
||||||
|
tipoConvenioList = tipoConService.obtenerTodos();
|
||||||
|
super.doAfterCompose(comp);
|
||||||
|
|
||||||
|
cc = (CuponConvenio) Executions.getCurrent().getArg().get("cc");
|
||||||
|
CuponConvenioList = (MyListbox) Executions.getCurrent().getArg().get("CuponConvenioList");
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onClick$btnSalvar(Event ev) throws InterruptedException {
|
||||||
|
|
||||||
|
try {
|
||||||
|
cc.setActivo(Boolean.TRUE);
|
||||||
|
cc.setFecmodif(Calendar.getInstance().getTime());
|
||||||
|
cc.setUsuarioId(0);
|
||||||
|
cc.setTipoConvenio((TipoConvenio) cmbTipoConvenio.getSelectedItem().getValue());
|
||||||
|
cc.setFolioInicio(folioInicio.getValue());
|
||||||
|
cc.setFolioFinal(folioFin.getValue());
|
||||||
|
|
||||||
|
if (cc.getCuponConvenioID() == null) {
|
||||||
|
cuponConService.suscribir(cc);
|
||||||
|
CuponConvenioList.addItem(cc);
|
||||||
|
} else {
|
||||||
|
cuponConService.actualizacion(cc);
|
||||||
|
CuponConvenioList.updateItem(cc);
|
||||||
|
}
|
||||||
|
|
||||||
|
Messagebox.show(
|
||||||
|
Labels.getLabel("editarCuponConvenioController.MSG.suscribirOK"),
|
||||||
|
Labels.getLabel("editarCuponConvenioController.window.title"),
|
||||||
|
Messagebox.OK, Messagebox.INFORMATION);
|
||||||
|
|
||||||
|
closeWindow();
|
||||||
|
} catch (Exception ex) {
|
||||||
|
log.error("editarCuponConvenioController: " + ex);
|
||||||
|
Messagebox.show(
|
||||||
|
Labels.getLabel("MSG.Error"),
|
||||||
|
Labels.getLabel("editarCuponConvenioController.window.title"),
|
||||||
|
Messagebox.OK, Messagebox.ERROR);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onClick$btnApagar(Event ev) {
|
||||||
|
try {
|
||||||
|
int resp = Messagebox.show(
|
||||||
|
Labels.getLabel("editarCuponConvenioController.MSG.BorrarPergunta"),
|
||||||
|
Labels.getLabel("editarCuponConvenioController.window.title"),
|
||||||
|
Messagebox.YES | Messagebox.NO, Messagebox.QUESTION);
|
||||||
|
|
||||||
|
if (resp == Messagebox.YES) {
|
||||||
|
|
||||||
|
cuponConService.borrar(cc);
|
||||||
|
|
||||||
|
Messagebox.show(
|
||||||
|
Labels.getLabel("editarCuponConvenioController.MSG.BorrarOK"),
|
||||||
|
Labels.getLabel("editarCuponConvenioController.window.title"),
|
||||||
|
Messagebox.OK, Messagebox.INFORMATION);
|
||||||
|
|
||||||
|
CuponConvenioList.removeItem(cc);
|
||||||
|
|
||||||
|
closeWindow();
|
||||||
|
}
|
||||||
|
} catch (Exception ex) {
|
||||||
|
log.error(ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,298 @@
|
||||||
|
/*
|
||||||
|
* To change this template, choose Tools | Templates
|
||||||
|
* and open the template in the editor.
|
||||||
|
*/
|
||||||
|
package com.rjconsultores.ventaboletos.web.gui.controladores.catalogos;
|
||||||
|
|
||||||
|
import java.util.Calendar;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.apache.log4j.Logger;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.context.annotation.Scope;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.zkoss.util.resource.Labels;
|
||||||
|
import org.zkoss.zhtml.Messagebox;
|
||||||
|
import org.zkoss.zk.ui.Component;
|
||||||
|
import org.zkoss.zk.ui.Executions;
|
||||||
|
import org.zkoss.zk.ui.event.Event;
|
||||||
|
import org.zkoss.zk.ui.util.Clients;
|
||||||
|
import org.zkoss.zul.Button;
|
||||||
|
import org.zkoss.zul.Checkbox;
|
||||||
|
import org.zkoss.zul.Combobox;
|
||||||
|
import org.zkoss.zul.Comboitem;
|
||||||
|
import org.zkoss.zul.Intbox;
|
||||||
|
import org.zkoss.zul.Row;
|
||||||
|
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.DetDiagramaAutobus;
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.DiagramaAutobus;
|
||||||
|
import com.rjconsultores.ventaboletos.service.DetDiagramaAutobusService;
|
||||||
|
import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.MyGenericForwardComposer;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Administrador
|
||||||
|
*/
|
||||||
|
@Controller("editarDetDiagramaAutobusController")
|
||||||
|
@Scope("prototype")
|
||||||
|
public class EditarDetDiagramaAutobusController extends MyGenericForwardComposer {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private DetDiagramaAutobusService detDiagramaAutobusService;
|
||||||
|
private DetDiagramaAutobus detDiagramaAutobus;
|
||||||
|
private Short numefila;
|
||||||
|
private Short numecolumna;
|
||||||
|
private DiagramaAutobus diagramaAutobus;
|
||||||
|
private Checkbox chkVendible;
|
||||||
|
private Intbox txtAsiento;
|
||||||
|
private Button button;
|
||||||
|
private Combobox cmbTipo;
|
||||||
|
private Row rowAsiento;
|
||||||
|
private Row rowVendible;
|
||||||
|
private static Logger log = Logger.getLogger(EditarDetDiagramaAutobusController.class);
|
||||||
|
public final static String ASIENTO = "ASIENTO";
|
||||||
|
private String itemCombo = ASIENTO;
|
||||||
|
|
||||||
|
public DetDiagramaAutobus getDetDiagramaAutobus() {
|
||||||
|
return detDiagramaAutobus;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDetDiagramaAutobus(DetDiagramaAutobus detDiagramaAutobus) {
|
||||||
|
this.detDiagramaAutobus = detDiagramaAutobus;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Checkbox getChkVendible() {
|
||||||
|
return chkVendible;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setChkVendible(Checkbox chkVendible) {
|
||||||
|
this.chkVendible = chkVendible;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void doAfterCompose(Component comp) throws Exception {
|
||||||
|
detDiagramaAutobus = (DetDiagramaAutobus) Executions.getCurrent().getArg().get("detDiagramaAutobus");
|
||||||
|
|
||||||
|
super.doAfterCompose(comp);
|
||||||
|
|
||||||
|
numefila = (Short) Executions.getCurrent().getArg().get("numefila");
|
||||||
|
numecolumna = (Short) Executions.getCurrent().getArg().get("numecolumna");
|
||||||
|
diagramaAutobus = (DiagramaAutobus) Executions.getCurrent().getArg().get("diagramaAutobus");
|
||||||
|
button = (Button) Executions.getCurrent().getArg().get("button");
|
||||||
|
|
||||||
|
chkVendible.setChecked(detDiagramaAutobus.getVendible() == null ? true : detDiagramaAutobus.getVendible());
|
||||||
|
|
||||||
|
if ((numefila == 2) || (numefila == 4) || (numefila == 6)) {
|
||||||
|
itemCombo = DetDiagramaAutobus.TV;
|
||||||
|
|
||||||
|
List<Component> children = cmbTipo.getChildren();
|
||||||
|
for (Component c : children) {
|
||||||
|
if (c instanceof Comboitem) {
|
||||||
|
Comboitem ci = (Comboitem) c;
|
||||||
|
if (((String) ci.getValue()).equals(ASIENTO)) {
|
||||||
|
ci.setVisible(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
rowAsiento.setVisible(false);
|
||||||
|
rowVendible.setVisible(false);
|
||||||
|
} else {
|
||||||
|
|
||||||
|
if (detDiagramaAutobus.getAsiento() != null) {
|
||||||
|
boolean noEsAsiento = noEsAsiento(detDiagramaAutobus.getAsiento());
|
||||||
|
|
||||||
|
if (!noEsAsiento) {
|
||||||
|
txtAsiento.setValue(Integer.parseInt(detDiagramaAutobus.getAsiento()));
|
||||||
|
}
|
||||||
|
|
||||||
|
rowAsiento.setVisible(!noEsAsiento);
|
||||||
|
rowVendible.setVisible(!noEsAsiento);
|
||||||
|
|
||||||
|
itemCombo = noEsAsiento ? detDiagramaAutobus.getAsiento() : ASIENTO;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
txtAsiento.focus();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onClick$btnApagar(Event ev) {
|
||||||
|
try {
|
||||||
|
|
||||||
|
detDiagramaAutobus.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
|
||||||
|
detDiagramaAutobus.setFecmodif(Calendar.getInstance().getTime());
|
||||||
|
detDiagramaAutobus.setActivo(Boolean.FALSE);
|
||||||
|
|
||||||
|
if (detDiagramaAutobus.getDetdiagramaautobusId() != null) {
|
||||||
|
detDiagramaAutobusService.borrar(detDiagramaAutobus);
|
||||||
|
}
|
||||||
|
|
||||||
|
button.setLabel("");
|
||||||
|
|
||||||
|
closeWindow();
|
||||||
|
} catch (Exception ex) {
|
||||||
|
log.error(ex);
|
||||||
|
Clients.alert(Labels.getLabel("MSG.Error"), Labels.getLabel("editarDiagramaAutobusController.window.title"), Messagebox.ERROR);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean noEsAsiento(String str) {
|
||||||
|
return str.equals(DetDiagramaAutobus.CF)
|
||||||
|
|| str.equals(DetDiagramaAutobus.PT)
|
||||||
|
|| str.equals(DetDiagramaAutobus.TV)
|
||||||
|
|| str.equals(DetDiagramaAutobus.WC);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onClick$btnSalvar(Event ev) throws InterruptedException {
|
||||||
|
|
||||||
|
if (cmbTipo.getSelectedItem().getValue().equals(ASIENTO) && (txtAsiento.getValue() == null)) {
|
||||||
|
Messagebox.show(
|
||||||
|
Labels.getLabel("editarDiagramaAutobusController.msg.asientoObligatorio"),
|
||||||
|
Labels.getLabel("editarDiagramaAutobusController.window.title"),
|
||||||
|
Messagebox.OK, Messagebox.INFORMATION);
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
// checando se jah existe esse assento:
|
||||||
|
List<DetDiagramaAutobus> lsDetDiagramaAutobus = diagramaAutobus.getDetDiagramaAutobusList();
|
||||||
|
Boolean existeAsiento = Boolean.FALSE;
|
||||||
|
String novoAsiento = (noEsAsiento(cmbTipo.getSelectedItem().getValue().toString()) ? cmbTipo.getSelectedItem().getValue().toString() : txtAsiento.getValue().toString());// si
|
||||||
|
// es
|
||||||
|
// asiento,
|
||||||
|
// saco
|
||||||
|
// el
|
||||||
|
// numero.
|
||||||
|
// Sino,
|
||||||
|
// saco
|
||||||
|
// la
|
||||||
|
// descripción
|
||||||
|
// del
|
||||||
|
// combobox
|
||||||
|
Boolean temLetraNovoAsiento = novoAsiento.matches("^[a-zA-Z]+$");
|
||||||
|
if (!temLetraNovoAsiento) {
|
||||||
|
for (DetDiagramaAutobus dda : lsDetDiagramaAutobus) {
|
||||||
|
String asiento = dda.getAsiento();
|
||||||
|
if (asiento != null) {
|
||||||
|
Boolean temLetra = asiento.matches("^[a-zA-Z]+$");
|
||||||
|
if (!temLetra) {
|
||||||
|
if (dda.getAsiento().equals(novoAsiento)) {
|
||||||
|
if (((dda.getDetdiagramaautobusId() == null) || (detDiagramaAutobus.getDetdiagramaautobusId() == null)) || (!dda.getDetdiagramaautobusId().equals(detDiagramaAutobus.getDetdiagramaautobusId()))) {
|
||||||
|
existeAsiento = Boolean.TRUE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!existeAsiento) {
|
||||||
|
|
||||||
|
detDiagramaAutobus.setActivo(Boolean.TRUE);
|
||||||
|
detDiagramaAutobus.setFecmodif(Calendar.getInstance().getTime());
|
||||||
|
detDiagramaAutobus.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
|
||||||
|
detDiagramaAutobus.setNumecolumna(numecolumna);
|
||||||
|
detDiagramaAutobus.setNumefila(numefila);
|
||||||
|
detDiagramaAutobus.setDiagramaAutobus(diagramaAutobus);
|
||||||
|
if (!cmbTipo.getSelectedItem().getValue().equals(ASIENTO)) {
|
||||||
|
detDiagramaAutobus.setVendible(Boolean.FALSE);
|
||||||
|
} else {
|
||||||
|
detDiagramaAutobus.setVendible(chkVendible.isChecked());
|
||||||
|
}
|
||||||
|
detDiagramaAutobus.setAsiento(novoAsiento);
|
||||||
|
|
||||||
|
|
||||||
|
if (detDiagramaAutobus.getDetdiagramaautobusId() == null) {
|
||||||
|
Integer posicionDdaExiste = null;
|
||||||
|
for (int i = 0; i < diagramaAutobus.getDetDiagramaAutobusList().size(); i++) {
|
||||||
|
DetDiagramaAutobus dda = diagramaAutobus.getDetDiagramaAutobusList().get(i);
|
||||||
|
|
||||||
|
if ((dda.getNumecolumna() == numecolumna) && (dda.getNumefila() == numefila)) {
|
||||||
|
posicionDdaExiste = i;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
if (posicionDdaExiste == null) {
|
||||||
|
diagramaAutobus.getDetDiagramaAutobusList().add(detDiagramaAutobus);
|
||||||
|
} else {
|
||||||
|
diagramaAutobus.getDetDiagramaAutobusList().set(posicionDdaExiste, detDiagramaAutobus);
|
||||||
|
}
|
||||||
|
|
||||||
|
log.debug("add no existe=" + novoAsiento);
|
||||||
|
} else {
|
||||||
|
Integer index = diagramaAutobus.getDetDiagramaAutobusList().indexOf(detDiagramaAutobus);
|
||||||
|
DetDiagramaAutobus temp = diagramaAutobus.getDetDiagramaAutobusList().get(index);
|
||||||
|
|
||||||
|
temp.setActivo(detDiagramaAutobus.getActivo());
|
||||||
|
temp.setAsiento(detDiagramaAutobus.getAsiento());
|
||||||
|
temp.setDetdiagramaautobusId(detDiagramaAutobus.getDetdiagramaautobusId());
|
||||||
|
temp.setDiagramaAutobus(detDiagramaAutobus.getDiagramaAutobus());
|
||||||
|
temp.setFecmodif(detDiagramaAutobus.getFecmodif());
|
||||||
|
temp.setInternet(detDiagramaAutobus.getInternet());
|
||||||
|
temp.setNumecolumna(detDiagramaAutobus.getNumecolumna());
|
||||||
|
temp.setNumefila(detDiagramaAutobus.getNumefila());
|
||||||
|
temp.setUsuarioId(detDiagramaAutobus.getUsuarioId());
|
||||||
|
if (!cmbTipo.getSelectedItem().getValue().equals(ASIENTO)) {
|
||||||
|
temp.setVendible(Boolean.FALSE);
|
||||||
|
} else {
|
||||||
|
temp.setVendible(detDiagramaAutobus.getVendible());
|
||||||
|
}
|
||||||
|
log.debug("add ya existe=" + detDiagramaAutobus.getAsiento());
|
||||||
|
}
|
||||||
|
log.debug("cant itens=" + diagramaAutobus.getDetDiagramaAutobusList().size());
|
||||||
|
closeWindow();
|
||||||
|
button.setLabel(detDiagramaAutobus.getAsiento());
|
||||||
|
} else {
|
||||||
|
Messagebox.show(
|
||||||
|
Labels.getLabel("editarDiagramaAutobusController.Existe.Asiento"),
|
||||||
|
Labels.getLabel("editarDiagramaAutobusController.window.title"),
|
||||||
|
Messagebox.OK, Messagebox.EXCLAMATION);
|
||||||
|
}
|
||||||
|
} catch (Exception ex) {
|
||||||
|
log.error(ex);
|
||||||
|
Messagebox.show(
|
||||||
|
Labels.getLabel("MSG.Error"),
|
||||||
|
Labels.getLabel("editarDiagramaAutobusController.window.title"),
|
||||||
|
Messagebox.OK, Messagebox.EXCLAMATION);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onChange$cmbTipo(Event ev) {
|
||||||
|
cambiarPantallaTipo();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void cambiarPantallaTipo() {
|
||||||
|
Comboitem o = cmbTipo.getSelectedItem();
|
||||||
|
if (o == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
String strSelected = (String) o.getValue();
|
||||||
|
if (strSelected.equals(DetDiagramaAutobus.CF)
|
||||||
|
|| strSelected.equals(DetDiagramaAutobus.PT)
|
||||||
|
|| strSelected.equals(DetDiagramaAutobus.TV)
|
||||||
|
|| strSelected.equals(DetDiagramaAutobus.WC)) {
|
||||||
|
|
||||||
|
rowAsiento.setVisible(false);
|
||||||
|
rowVendible.setVisible(false);
|
||||||
|
|
||||||
|
chkVendible.setChecked(false);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
txtAsiento.setValue((Integer) null);
|
||||||
|
chkVendible.setChecked(true);
|
||||||
|
|
||||||
|
rowAsiento.setVisible(true);
|
||||||
|
rowVendible.setVisible(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getItemCombo() {
|
||||||
|
return itemCombo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setItemCombo(String itemCombo) {
|
||||||
|
this.itemCombo = itemCombo;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,228 @@
|
||||||
|
/*
|
||||||
|
* To change this template, choose Tools | Templates
|
||||||
|
* and open the template in the editor.
|
||||||
|
*/
|
||||||
|
package com.rjconsultores.ventaboletos.web.gui.controladores.catalogos;
|
||||||
|
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.Empresa;
|
||||||
|
import com.rjconsultores.ventaboletos.service.EmpresaService;
|
||||||
|
import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado;
|
||||||
|
import com.rjconsultores.ventaboletos.utilerias.ApplicationProperties;
|
||||||
|
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.MyGenericForwardComposer;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.MyListbox;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.MyTextbox;
|
||||||
|
import org.apache.log4j.Logger;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.context.annotation.Scope;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import java.util.Calendar;
|
||||||
|
import java.util.List;
|
||||||
|
import org.zkoss.util.resource.Labels;
|
||||||
|
import org.zkoss.zk.ui.Component;
|
||||||
|
import org.zkoss.zk.ui.Executions;
|
||||||
|
import org.zkoss.zk.ui.event.Event;
|
||||||
|
import org.zkoss.zul.Button;
|
||||||
|
import org.zkoss.zul.Checkbox;
|
||||||
|
import org.zkoss.zul.Combobox;
|
||||||
|
import org.zkoss.zul.Messagebox;
|
||||||
|
import org.zkoss.zul.Row;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Rafius
|
||||||
|
*/
|
||||||
|
@Controller("editarEmpresaController")
|
||||||
|
@Scope("prototype")
|
||||||
|
public class EditarEmpresaController extends MyGenericForwardComposer {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private EmpresaService empresaService;
|
||||||
|
private Empresa empresa;
|
||||||
|
private MyListbox empresaList;
|
||||||
|
private static Logger log = Logger.getLogger(EditarEmpresaController.class);
|
||||||
|
private MyTextbox txtNome;
|
||||||
|
private Button btnApagar;
|
||||||
|
private Combobox cmbIndTipo;
|
||||||
|
private Checkbox chkExterna;
|
||||||
|
private Checkbox chkPagoConductor;
|
||||||
|
private Row rowEquivalencia;
|
||||||
|
|
||||||
|
public Empresa getEmpresa() {
|
||||||
|
return empresa;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEmpresa(Empresa empresa) {
|
||||||
|
this.empresa = empresa;
|
||||||
|
}
|
||||||
|
|
||||||
|
public MyListbox getEmpresaList() {
|
||||||
|
return empresaList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEmpresaList(MyListbox empresaList) {
|
||||||
|
this.empresaList = empresaList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public EmpresaService getEmpresaService() {
|
||||||
|
return empresaService;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEmpresaService(EmpresaService empresaService) {
|
||||||
|
this.empresaService = empresaService;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Button getBtnApagar() {
|
||||||
|
return btnApagar;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBtnApagar(Button btnApagar) {
|
||||||
|
this.btnApagar = btnApagar;
|
||||||
|
}
|
||||||
|
|
||||||
|
public MyTextbox getTxtNome() {
|
||||||
|
return txtNome;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTxtNome(MyTextbox txtNome) {
|
||||||
|
this.txtNome = txtNome;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Combobox getCmbIndTipo() {
|
||||||
|
return cmbIndTipo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCmbIndTipo(Combobox cmbIndTipo) {
|
||||||
|
this.cmbIndTipo = cmbIndTipo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Checkbox getChkExterna() {
|
||||||
|
return chkExterna;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setChkExterna(Checkbox chkExterna) {
|
||||||
|
this.chkExterna = chkExterna;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Checkbox getChkPagoConductor() {
|
||||||
|
return chkPagoConductor;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setChkPagoConductor(Checkbox chkPagoConductor) {
|
||||||
|
this.chkPagoConductor = chkPagoConductor;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Row getRowEquivalencia() {
|
||||||
|
return rowEquivalencia;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRowEquivalencia(Row rowEquivalencia) {
|
||||||
|
this.rowEquivalencia = rowEquivalencia;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void doAfterCompose(Component comp) throws Exception {
|
||||||
|
super.doAfterCompose(comp);
|
||||||
|
|
||||||
|
empresa = (Empresa) Executions.getCurrent().getArg().get("empresa");
|
||||||
|
empresaList = (MyListbox) Executions.getCurrent().getArg().get("empresaList");
|
||||||
|
|
||||||
|
txtNome.focus();
|
||||||
|
|
||||||
|
if (empresa.getEmpresaId() == null) {
|
||||||
|
btnApagar.setVisible(Boolean.FALSE);
|
||||||
|
chkExterna.setChecked(true);
|
||||||
|
} else {
|
||||||
|
chkExterna.setChecked(empresa.getIndExterna() == null ? false : empresa.getIndExterna());
|
||||||
|
chkPagoConductor.setChecked(empresa.getPagoConductor() == null ? false : empresa.getPagoConductor());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!ApplicationProperties.getInstance().mostrarEquivalencia()) {
|
||||||
|
rowEquivalencia.setVisible(Boolean.FALSE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onClick$btnSalvar(Event ev) throws InterruptedException {
|
||||||
|
txtNome.getValue();
|
||||||
|
cmbIndTipo.getValue();
|
||||||
|
try {
|
||||||
|
if (empresa.getIndExterna() == null) {
|
||||||
|
empresa.setIndExterna(Boolean.FALSE);
|
||||||
|
}
|
||||||
|
|
||||||
|
empresa.setActivo(Boolean.TRUE);
|
||||||
|
empresa.setFecmodif(Calendar.getInstance().getTime());
|
||||||
|
empresa.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
|
||||||
|
empresa.setIndExterna(chkExterna.isChecked());
|
||||||
|
empresa.setPagoConductor(chkPagoConductor.isChecked());
|
||||||
|
|
||||||
|
if (empresa.getEmpresaId() == null) {
|
||||||
|
List<Empresa> lsEmpresa =
|
||||||
|
empresaService.buscar(empresa.getNombempresa(), empresa.getIndExterna(),
|
||||||
|
empresa.getIndTipo());
|
||||||
|
|
||||||
|
if (!lsEmpresa.isEmpty()) {
|
||||||
|
Messagebox.show(
|
||||||
|
Labels.getLabel("MSG.Registro.Existe"),
|
||||||
|
Labels.getLabel("editarEmpresaController.window.title"),
|
||||||
|
Messagebox.OK, Messagebox.EXCLAMATION);
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
empresaService.suscribir(empresa);
|
||||||
|
empresaList.addItem(empresa);
|
||||||
|
} else {
|
||||||
|
empresaService.actualizacion(empresa);
|
||||||
|
empresaList.updateItem(empresa);
|
||||||
|
}
|
||||||
|
|
||||||
|
Messagebox.show(
|
||||||
|
Labels.getLabel("editarEmpresaController.MSG.suscribirOK"),
|
||||||
|
Labels.getLabel("editarEmpresaController.window.title"),
|
||||||
|
Messagebox.OK, Messagebox.INFORMATION);
|
||||||
|
|
||||||
|
closeWindow();
|
||||||
|
|
||||||
|
} catch (Exception ex) {
|
||||||
|
log.error("editarEmpresaController: " + ex);
|
||||||
|
Messagebox.show(
|
||||||
|
Labels.getLabel("MSG.Error"),
|
||||||
|
Labels.getLabel("editarEmpresaController.window.title"),
|
||||||
|
Messagebox.OK, Messagebox.ERROR);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onClick$chkExterna(Event ev) {
|
||||||
|
if (!chkExterna.isChecked()) {
|
||||||
|
chkExterna.setChecked(false);
|
||||||
|
} else {
|
||||||
|
chkExterna.setChecked(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onClick$btnApagar(Event ev) {
|
||||||
|
try {
|
||||||
|
int resp = Messagebox.show(
|
||||||
|
Labels.getLabel("editarEmpresaController.MSG.borrarPergunta"),
|
||||||
|
Labels.getLabel("editarEmpresaController.window.title"),
|
||||||
|
Messagebox.YES | Messagebox.NO, Messagebox.QUESTION);
|
||||||
|
|
||||||
|
if (resp == Messagebox.YES) {
|
||||||
|
|
||||||
|
empresaService.borrar(empresa);
|
||||||
|
|
||||||
|
Messagebox.show(
|
||||||
|
Labels.getLabel("editarEmpresaController.MSG.borrarOK"),
|
||||||
|
Labels.getLabel("editarEmpresaController.window.title"),
|
||||||
|
Messagebox.OK, Messagebox.INFORMATION);
|
||||||
|
|
||||||
|
empresaList.removeItem(empresa);
|
||||||
|
|
||||||
|
closeWindow();
|
||||||
|
}
|
||||||
|
} catch (Exception ex) {
|
||||||
|
log.error(ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,224 @@
|
||||||
|
/*
|
||||||
|
* To change this template, choose Tools | Templates
|
||||||
|
* and open the template in the editor.
|
||||||
|
*/
|
||||||
|
package com.rjconsultores.ventaboletos.web.gui.controladores.catalogos;
|
||||||
|
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.Estado;
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.Pais;
|
||||||
|
import com.rjconsultores.ventaboletos.service.EstadoService;
|
||||||
|
import com.rjconsultores.ventaboletos.service.PaisService;
|
||||||
|
import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado;
|
||||||
|
import com.rjconsultores.ventaboletos.utilerias.ApplicationProperties;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.MyGenericForwardComposer;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.MyListbox;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.MyTextbox;
|
||||||
|
import org.apache.log4j.Logger;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.context.annotation.Scope;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import java.util.Calendar;
|
||||||
|
import java.util.List;
|
||||||
|
import org.zkoss.util.resource.Labels;
|
||||||
|
import org.zkoss.zk.ui.Component;
|
||||||
|
import org.zkoss.zk.ui.Executions;
|
||||||
|
import org.zkoss.zk.ui.event.Event;
|
||||||
|
import org.zkoss.zul.Button;
|
||||||
|
import org.zkoss.zul.Combobox;
|
||||||
|
import org.zkoss.zul.Messagebox;
|
||||||
|
import org.zkoss.zul.Row;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Rafius
|
||||||
|
*/
|
||||||
|
@Controller("editarEstadoController")
|
||||||
|
@Scope("prototype")
|
||||||
|
public class EditarEstadoController extends MyGenericForwardComposer {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private EstadoService estadoService;
|
||||||
|
@Autowired
|
||||||
|
private PaisService paisService;
|
||||||
|
private Estado estado;
|
||||||
|
private List<Pais> lsPais;
|
||||||
|
private MyListbox estadoList;
|
||||||
|
private static Logger log = Logger.getLogger(EditarEstadoController.class);
|
||||||
|
private MyTextbox txtNome;
|
||||||
|
private Combobox cmbPais;
|
||||||
|
private Button btnApagar;
|
||||||
|
private Row rowEquivalencia;
|
||||||
|
|
||||||
|
public Estado getEstado() {
|
||||||
|
return estado;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEstado(Estado estado) {
|
||||||
|
this.estado = estado;
|
||||||
|
}
|
||||||
|
|
||||||
|
public MyListbox getEstadoList() {
|
||||||
|
return estadoList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEstadoList(MyListbox estadoList) {
|
||||||
|
this.estadoList = estadoList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public EstadoService getEstadoService() {
|
||||||
|
return estadoService;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEstadoService(EstadoService estadoService) {
|
||||||
|
this.estadoService = estadoService;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Button getBtnApagar() {
|
||||||
|
return btnApagar;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBtnApagar(Button btnApagar) {
|
||||||
|
this.btnApagar = btnApagar;
|
||||||
|
}
|
||||||
|
|
||||||
|
public MyTextbox getTxtNome() {
|
||||||
|
return txtNome;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTxtNome(MyTextbox txtNome) {
|
||||||
|
this.txtNome = txtNome;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<Pais> getLsPais() {
|
||||||
|
return lsPais;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLsPais(List<Pais> lsPais) {
|
||||||
|
this.lsPais = lsPais;
|
||||||
|
}
|
||||||
|
|
||||||
|
public PaisService getPaisService() {
|
||||||
|
return paisService;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPaisService(PaisService paisService) {
|
||||||
|
this.paisService = paisService;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Combobox getCmbPais() {
|
||||||
|
return cmbPais;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCmbPais(Combobox cmbPais) {
|
||||||
|
this.cmbPais = cmbPais;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Row getRowEquivalencia() {
|
||||||
|
return rowEquivalencia;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRowEquivalencia(Row rowEquivalencia) {
|
||||||
|
this.rowEquivalencia = rowEquivalencia;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void doAfterCompose(Component comp) throws Exception {
|
||||||
|
|
||||||
|
lsPais = paisService.obtenerTodos();
|
||||||
|
super.doAfterCompose(comp);
|
||||||
|
|
||||||
|
estado = (Estado) Executions.getCurrent().getArg().get("estado");
|
||||||
|
estadoList = (MyListbox) Executions.getCurrent().getArg().get("estadoList");
|
||||||
|
|
||||||
|
if (estado.getEstadoId() == null) {
|
||||||
|
btnApagar.setVisible(Boolean.FALSE);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!ApplicationProperties.getInstance().mostrarEquivalencia()) {
|
||||||
|
rowEquivalencia.setVisible(Boolean.FALSE);
|
||||||
|
}
|
||||||
|
|
||||||
|
txtNome.focus();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onClick$btnSalvar(Event ev) throws InterruptedException {
|
||||||
|
txtNome.getValue();
|
||||||
|
cmbPais.getValue();
|
||||||
|
try {
|
||||||
|
|
||||||
|
estado.setActivo(Boolean.TRUE);
|
||||||
|
estado.setFecmodif(Calendar.getInstance().getTime());
|
||||||
|
estado.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
|
||||||
|
|
||||||
|
List<Estado> lsEstado = estadoService.buscar(estado.getNombestado(), estado.getPais());
|
||||||
|
|
||||||
|
boolean podeSalvar = false;
|
||||||
|
if (lsEstado.isEmpty()) {
|
||||||
|
podeSalvar = true;
|
||||||
|
} else {
|
||||||
|
if (estado.getEstadoId() == null) {
|
||||||
|
podeSalvar = false;
|
||||||
|
} else {
|
||||||
|
for (Estado e : lsEstado) {
|
||||||
|
if (e.getEstadoId().equals(estado.getEstadoId())) {
|
||||||
|
podeSalvar = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (podeSalvar) {
|
||||||
|
if (estado.getEstadoId() == null) {
|
||||||
|
estadoService.suscribir(estado);
|
||||||
|
estadoList.addItem(estado);
|
||||||
|
} else {
|
||||||
|
estadoService.actualizacion(estado);
|
||||||
|
estadoList.updateItem(estado);
|
||||||
|
}
|
||||||
|
Messagebox.show(
|
||||||
|
Labels.getLabel("editarEstadoController.MSG.suscribirOK"),
|
||||||
|
Labels.getLabel("editarEstadoController.window.title"),
|
||||||
|
Messagebox.OK, Messagebox.INFORMATION);
|
||||||
|
|
||||||
|
closeWindow();
|
||||||
|
} else {
|
||||||
|
Messagebox.show(
|
||||||
|
Labels.getLabel("MSG.Registro.Existe"),
|
||||||
|
Labels.getLabel("editarEstadoController.window.title"),
|
||||||
|
Messagebox.OK, Messagebox.EXCLAMATION);
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch (Exception ex) {
|
||||||
|
log.error("editarEstadoController: " + ex);
|
||||||
|
Messagebox.show(
|
||||||
|
Labels.getLabel("MSG.Error"),
|
||||||
|
Labels.getLabel("editarEstadoController.window.title"),
|
||||||
|
Messagebox.OK, Messagebox.ERROR);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onClick$btnApagar(Event ev) {
|
||||||
|
try {
|
||||||
|
int resp = Messagebox.show(
|
||||||
|
Labels.getLabel("editarEstadoController.MSG.borrarPergunta"),
|
||||||
|
Labels.getLabel("editarEstadoController.window.title"),
|
||||||
|
Messagebox.YES | Messagebox.NO, Messagebox.QUESTION);
|
||||||
|
|
||||||
|
if (resp == Messagebox.YES) {
|
||||||
|
|
||||||
|
estadoService.borrar(estado);
|
||||||
|
|
||||||
|
Messagebox.show(
|
||||||
|
Labels.getLabel("editarEstadoController.MSG.borrarOK"),
|
||||||
|
Labels.getLabel("editarEstadoController.window.title"),
|
||||||
|
Messagebox.OK, Messagebox.INFORMATION);
|
||||||
|
|
||||||
|
estadoList.removeItem(estado);
|
||||||
|
|
||||||
|
closeWindow();
|
||||||
|
}
|
||||||
|
} catch (Exception ex) {
|
||||||
|
log.error(ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,213 @@
|
||||||
|
/*
|
||||||
|
* To change this template, choose Tools | Templates
|
||||||
|
* and open the template in the editor.
|
||||||
|
*/
|
||||||
|
package com.rjconsultores.ventaboletos.web.gui.controladores.catalogos;
|
||||||
|
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.FormaPago;
|
||||||
|
import com.rjconsultores.ventaboletos.service.FormaPagoService;
|
||||||
|
import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado;
|
||||||
|
import com.rjconsultores.ventaboletos.utilerias.ApplicationProperties;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.MyGenericForwardComposer;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.MyListbox;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.MyTextbox;
|
||||||
|
import java.util.Calendar;
|
||||||
|
import java.util.List;
|
||||||
|
import org.apache.log4j.Logger;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.context.annotation.Scope;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.zkoss.util.resource.Labels;
|
||||||
|
import org.zkoss.zhtml.Messagebox;
|
||||||
|
import org.zkoss.zk.ui.Component;
|
||||||
|
import org.zkoss.zk.ui.Executions;
|
||||||
|
import org.zkoss.zk.ui.event.Event;
|
||||||
|
import org.zkoss.zul.Button;
|
||||||
|
import org.zkoss.zul.Comboitem;
|
||||||
|
import org.zkoss.zul.Radio;
|
||||||
|
import org.zkoss.zul.Row;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Administrador
|
||||||
|
*/
|
||||||
|
@Controller("editarFormaPagoController")
|
||||||
|
@Scope("prototype")
|
||||||
|
public class EditarFormaPagoController extends MyGenericForwardComposer {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private FormaPagoService formaPagoService;
|
||||||
|
private FormaPago formaPago;
|
||||||
|
private MyListbox formaPagoList;
|
||||||
|
private MyTextbox txtNome;
|
||||||
|
private Button btnApagar;
|
||||||
|
private BusquedaFormaPagoController busquedaFormaPagoController;
|
||||||
|
private Button btnSalvar;
|
||||||
|
private Radio rd1;
|
||||||
|
private Radio rd2;
|
||||||
|
private Radio rd3;
|
||||||
|
private Radio rd4;
|
||||||
|
private static Logger log = Logger.getLogger(EditarFormaPagoController.class);
|
||||||
|
private Row rowEquivalencia;
|
||||||
|
|
||||||
|
public FormaPago getFormaPago() {
|
||||||
|
return formaPago;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFormaPago(FormaPago formaPago) {
|
||||||
|
this.formaPago = formaPago;
|
||||||
|
}
|
||||||
|
|
||||||
|
public MyTextbox getTxtNome() {
|
||||||
|
return txtNome;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTxtNome(MyTextbox txtNome) {
|
||||||
|
this.txtNome = txtNome;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Button getBtnApagar() {
|
||||||
|
return btnApagar;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBtnApagar(Button btnApagar) {
|
||||||
|
this.btnApagar = btnApagar;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Button getBtnSalvar() {
|
||||||
|
return btnSalvar;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBtnSalvar(Button btnSalvar) {
|
||||||
|
this.btnSalvar = btnSalvar;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Row getRowEquivalencia() {
|
||||||
|
return rowEquivalencia;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRowEquivalencia(Row rowEquivalencia) {
|
||||||
|
this.rowEquivalencia = rowEquivalencia;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void doAfterCompose(Component comp) throws Exception {
|
||||||
|
super.doAfterCompose(comp);
|
||||||
|
busquedaFormaPagoController = (BusquedaFormaPagoController) Executions.getCurrent().getArg().get("busquedaFormaPagoController");
|
||||||
|
formaPago = (FormaPago) Executions.getCurrent().getArg().get("formaPago");
|
||||||
|
formaPagoList = (MyListbox) Executions.getCurrent().getArg().get("formaPagoList");
|
||||||
|
|
||||||
|
if (formaPago.getFormapagoId() == null) {
|
||||||
|
btnApagar.setVisible(Boolean.FALSE);
|
||||||
|
} else {
|
||||||
|
|
||||||
|
if (formaPago.getIndoperacion() == null) {
|
||||||
|
rd4.setChecked(true);
|
||||||
|
} else if (formaPago.getIndoperacion() == 1) {
|
||||||
|
rd1.setChecked(true);
|
||||||
|
} else if (formaPago.getIndoperacion() == 2) {
|
||||||
|
rd2.setChecked(true);
|
||||||
|
} else if (formaPago.getIndoperacion() == 3) {
|
||||||
|
rd3.setChecked(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (formaPago.getFormapagoId() <= 11 || (formaPago.getFormapagoId() >= 96 && formaPago.getFormapagoId() <= 99)) {
|
||||||
|
btnApagar.setVisible(Boolean.FALSE);
|
||||||
|
btnSalvar.setVisible(Boolean.FALSE);
|
||||||
|
txtNome.setDisabled(Boolean.TRUE);
|
||||||
|
|
||||||
|
Messagebox.show(
|
||||||
|
Labels.getLabel("MSG.noEditabled"),
|
||||||
|
Labels.getLabel("editarFormaPagoController.window.title"),
|
||||||
|
Messagebox.OK, Messagebox.INFORMATION);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!ApplicationProperties.getInstance().mostrarEquivalencia()) {
|
||||||
|
rowEquivalencia.setVisible(Boolean.FALSE);
|
||||||
|
}
|
||||||
|
|
||||||
|
txtNome.focus();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onClick$btnSalvar(Event ev) throws InterruptedException {
|
||||||
|
txtNome.getText();
|
||||||
|
|
||||||
|
try {
|
||||||
|
formaPago.setActivo(Boolean.TRUE);
|
||||||
|
formaPago.setFecmodif(Calendar.getInstance().getTime());
|
||||||
|
formaPago.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
|
||||||
|
|
||||||
|
if (rd4.isChecked()) {
|
||||||
|
formaPago.setIndoperacion(null);
|
||||||
|
} else if (rd1.isChecked()) {
|
||||||
|
formaPago.setIndoperacion(new Short("1"));
|
||||||
|
} else if (rd2.isChecked()) {
|
||||||
|
formaPago.setIndoperacion(new Short("2"));
|
||||||
|
} else if (rd3.isChecked()) {
|
||||||
|
formaPago.setIndoperacion(new Short("3"));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (formaPago.getFormapagoId() == null) {
|
||||||
|
List<FormaPago> lsFP =
|
||||||
|
formaPagoService.buscarPorDescricao(formaPago.getDescpago());
|
||||||
|
|
||||||
|
if (lsFP.isEmpty()) {
|
||||||
|
formaPagoService.suscribir(formaPago);
|
||||||
|
formaPagoList.addItem(formaPago);
|
||||||
|
|
||||||
|
Messagebox.show(
|
||||||
|
Labels.getLabel("editarFormaPagoController.MSG.suscribirOK"),
|
||||||
|
Labels.getLabel("editarFormaPagoController.window.title"),
|
||||||
|
Messagebox.OK, Messagebox.INFORMATION);
|
||||||
|
} else {
|
||||||
|
Messagebox.show(
|
||||||
|
Labels.getLabel("MSG.Registro.Existe"),
|
||||||
|
Labels.getLabel("editarFormaPagoController.window.title"),
|
||||||
|
Messagebox.OK, Messagebox.EXCLAMATION);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
formaPagoService.actualizacion(formaPago);
|
||||||
|
formaPagoList.updateItem(formaPago);
|
||||||
|
|
||||||
|
Messagebox.show(
|
||||||
|
Labels.getLabel("editarFormaPagoController.MSG.suscribirOK"),
|
||||||
|
Labels.getLabel("editarFormaPagoController.window.title"),
|
||||||
|
Messagebox.OK, Messagebox.INFORMATION);
|
||||||
|
}
|
||||||
|
busquedaFormaPagoController.refreshLista();
|
||||||
|
closeWindow();
|
||||||
|
} catch (Exception ex) {
|
||||||
|
log.error("editarFormaPagoController: " + ex);
|
||||||
|
Messagebox.show(
|
||||||
|
Labels.getLabel("MSG.Error"),
|
||||||
|
Labels.getLabel("editarFormaPagoController.window.title"),
|
||||||
|
Messagebox.OK, Messagebox.ERROR);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onClick$btnApagar(Event ev) {
|
||||||
|
try {
|
||||||
|
int resp = Messagebox.show(
|
||||||
|
Labels.getLabel("editarFormaPagoController.MSG.borrarPergunta"),
|
||||||
|
Labels.getLabel("editarFormaPagoController.window.title"),
|
||||||
|
Messagebox.YES | Messagebox.NO, Messagebox.QUESTION);
|
||||||
|
|
||||||
|
if (resp == Messagebox.YES) {
|
||||||
|
formaPagoService.borrar(formaPago);
|
||||||
|
|
||||||
|
Messagebox.show(
|
||||||
|
Labels.getLabel("editarFormaPagoController.MSG.borrarOK"),
|
||||||
|
Labels.getLabel("editarFormaPagoController.window.title"),
|
||||||
|
Messagebox.OK, Messagebox.INFORMATION);
|
||||||
|
|
||||||
|
formaPagoList.removeItem(formaPago);
|
||||||
|
|
||||||
|
closeWindow();
|
||||||
|
}
|
||||||
|
} catch (Exception ex) {
|
||||||
|
log.error(ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,253 @@
|
||||||
|
/*
|
||||||
|
* To change this template, choose Tools | Templates
|
||||||
|
* and open the template in the editor.
|
||||||
|
*/
|
||||||
|
package com.rjconsultores.ventaboletos.web.gui.controladores.catalogos;
|
||||||
|
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.Marca;
|
||||||
|
import com.rjconsultores.ventaboletos.service.MarcaService;
|
||||||
|
import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado;
|
||||||
|
import com.rjconsultores.ventaboletos.utilerias.ApplicationProperties;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.MyGenericForwardComposer;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.MyListbox;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.MyTextbox;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.Calendar;
|
||||||
|
import java.util.List;
|
||||||
|
import org.apache.log4j.Logger;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.context.annotation.Scope;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.zkoss.util.resource.Labels;
|
||||||
|
import org.zkoss.zhtml.Messagebox;
|
||||||
|
import org.zkoss.zk.ui.Component;
|
||||||
|
import org.zkoss.zk.ui.Executions;
|
||||||
|
import org.zkoss.zk.ui.UiException;
|
||||||
|
import org.zkoss.zk.ui.event.Event;
|
||||||
|
import org.zkoss.zk.ui.event.UploadEvent;
|
||||||
|
import org.zkoss.zul.Button;
|
||||||
|
import org.zkoss.zul.Image;
|
||||||
|
import org.zkoss.zul.Row;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Administrador
|
||||||
|
*/
|
||||||
|
@Controller("editarMarcaController")
|
||||||
|
@Scope("prototype")
|
||||||
|
public class EditarMarcaController extends MyGenericForwardComposer {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private MarcaService marcaService;
|
||||||
|
private Marca marca;
|
||||||
|
private MyListbox marcaList;
|
||||||
|
private BusquedaMarcaController busquedaMarcaController;
|
||||||
|
private Image img;
|
||||||
|
private MyTextbox txtNome;
|
||||||
|
private Button btnApagar;
|
||||||
|
private static Logger log = Logger.getLogger(EditarMarcaController.class);
|
||||||
|
private Row rowEquivalencia;
|
||||||
|
|
||||||
|
public Image getImg() {
|
||||||
|
return img;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setImg(Image img) {
|
||||||
|
this.img = img;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Marca getMarca() {
|
||||||
|
return marca;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMarca(Marca marca) {
|
||||||
|
this.marca = marca;
|
||||||
|
}
|
||||||
|
|
||||||
|
public MyListbox getMarcaList() {
|
||||||
|
return marcaList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMarcaList(MyListbox marcaList) {
|
||||||
|
this.marcaList = marcaList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public MyTextbox getTxtNome() {
|
||||||
|
return txtNome;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTxtNome(MyTextbox txtNome) {
|
||||||
|
this.txtNome = txtNome;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Button getBtnApagar() {
|
||||||
|
return btnApagar;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBtnApagar(Button btnApagar) {
|
||||||
|
this.btnApagar = btnApagar;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Row getRowEquivalencia() {
|
||||||
|
return rowEquivalencia;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRowEquivalencia(Row rowEquivalencia) {
|
||||||
|
this.rowEquivalencia = rowEquivalencia;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void doAfterCompose(Component comp) throws Exception {
|
||||||
|
super.doAfterCompose(comp);
|
||||||
|
|
||||||
|
marca = (Marca) Executions.getCurrent().getArg().get("marca");
|
||||||
|
busquedaMarcaController = (BusquedaMarcaController) Executions.getCurrent().getArg().get("busquedaMarcaController");
|
||||||
|
if (marca.getLogotipomarca() != null) {
|
||||||
|
img.setContent(new org.zkoss.image.AImage(marca.getDescmarca(),
|
||||||
|
marca.getLogotipomarca()));
|
||||||
|
}
|
||||||
|
marcaList = (MyListbox) Executions.getCurrent().getArg().get("marcaList");
|
||||||
|
|
||||||
|
if (marca.getMarcaId() == null) {
|
||||||
|
btnApagar.setVisible(Boolean.FALSE);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!ApplicationProperties.getInstance().mostrarEquivalencia()) {
|
||||||
|
rowEquivalencia.setVisible(Boolean.FALSE);
|
||||||
|
}
|
||||||
|
|
||||||
|
txtNome.focus();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void uploadPhoto(UploadEvent event) {
|
||||||
|
org.zkoss.util.media.Media media = event.getMedia();
|
||||||
|
|
||||||
|
try {
|
||||||
|
if (media instanceof org.zkoss.image.Image) {
|
||||||
|
img.setContent(new org.zkoss.image.AImage(media.getName(),
|
||||||
|
media.getStreamData()));
|
||||||
|
} else {
|
||||||
|
Messagebox.show(
|
||||||
|
Labels.getLabel("editarMarcaController.MSG.errorIMG") + " " + media,
|
||||||
|
Labels.getLabel("editarMarcaController.window.title"),
|
||||||
|
Messagebox.OK, Messagebox.ERROR);
|
||||||
|
}
|
||||||
|
} catch (IOException ex) {
|
||||||
|
log.error(ex);
|
||||||
|
throw UiException.Aide.wrap(ex);
|
||||||
|
} catch (InterruptedException ex) {
|
||||||
|
log.error(ex);
|
||||||
|
throw UiException.Aide.wrap(ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onClick$btnSalvar(Event ev) throws InterruptedException {
|
||||||
|
txtNome.getText();
|
||||||
|
|
||||||
|
try {
|
||||||
|
String nomeMarca = marca.getDescmarca();
|
||||||
|
List<Marca> lsMarcas = marcaService.buscarPorNome(nomeMarca);
|
||||||
|
boolean podeSalvar = false;
|
||||||
|
if (lsMarcas.isEmpty()) {
|
||||||
|
podeSalvar = true;
|
||||||
|
} else {
|
||||||
|
for (Marca m : lsMarcas) {
|
||||||
|
if (m.getMarcaId().equals(marca.getMarcaId())) {
|
||||||
|
podeSalvar = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (podeSalvar) {
|
||||||
|
marca.setActivo(Boolean.TRUE);
|
||||||
|
marca.setFecmodif(Calendar.getInstance().getTime());
|
||||||
|
marca.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
|
||||||
|
|
||||||
|
if (img.getContent() != null) {
|
||||||
|
marca.setLogotipomarca(img.getContent().getByteData());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (marca.getLogotipomarca() == null) {
|
||||||
|
int resp = Messagebox.show(
|
||||||
|
Labels.getLabel("editarMarcaController.MSG.SinImagenPergunta"),
|
||||||
|
Labels.getLabel("editarMarcaController.window.title"),
|
||||||
|
Messagebox.YES | Messagebox.NO, Messagebox.QUESTION);
|
||||||
|
|
||||||
|
if (resp == Messagebox.YES) {
|
||||||
|
if (marca.getMarcaId() == null) {
|
||||||
|
marcaService.suscribir(marca);
|
||||||
|
marcaList.addItem(marca);
|
||||||
|
|
||||||
|
Messagebox.show(
|
||||||
|
Labels.getLabel("editarMarcaController.MSG.suscribirOK"),
|
||||||
|
Labels.getLabel("editarMarcaController.window.title"),
|
||||||
|
Messagebox.OK, Messagebox.INFORMATION);
|
||||||
|
|
||||||
|
closeWindow();
|
||||||
|
} else {
|
||||||
|
marcaService.actualizacion(marca);
|
||||||
|
marcaList.updateItem(marca);
|
||||||
|
|
||||||
|
Messagebox.show(
|
||||||
|
Labels.getLabel("editarMarcaController.MSG.suscribirOK"),
|
||||||
|
Labels.getLabel("editarMarcaController.window.title"),
|
||||||
|
Messagebox.OK, Messagebox.INFORMATION);
|
||||||
|
|
||||||
|
closeWindow();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (marca.getMarcaId() == null) {
|
||||||
|
marcaService.suscribir(marca);
|
||||||
|
marcaList.addItem(marca);
|
||||||
|
} else {
|
||||||
|
marcaService.actualizacion(marca);
|
||||||
|
marcaList.updateItem(marca);
|
||||||
|
}
|
||||||
|
|
||||||
|
Messagebox.show(
|
||||||
|
Labels.getLabel("editarMarcaController.MSG.suscribirOK"),
|
||||||
|
Labels.getLabel("editarMarcaController.window.title"),
|
||||||
|
Messagebox.OK, Messagebox.INFORMATION);
|
||||||
|
busquedaMarcaController.refreshLista();
|
||||||
|
closeWindow();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
Messagebox.show(
|
||||||
|
Labels.getLabel("MSG.Registro.Existe"),
|
||||||
|
Labels.getLabel("editarMarcaController.window.title"),
|
||||||
|
Messagebox.OK, Messagebox.EXCLAMATION);
|
||||||
|
}
|
||||||
|
} catch (Exception ex) {
|
||||||
|
log.error("editarMarcaController: " + ex);
|
||||||
|
Messagebox.show(
|
||||||
|
Labels.getLabel("MSG.Error"),
|
||||||
|
Labels.getLabel("editarMarcaController.window.title"),
|
||||||
|
Messagebox.OK, Messagebox.ERROR);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onClick$btnApagar(Event ev) {
|
||||||
|
try {
|
||||||
|
int resp = Messagebox.show(
|
||||||
|
Labels.getLabel("editarMarcaController.MSG.borrarPergunta"),
|
||||||
|
Labels.getLabel("editarMarcaController.window.title"),
|
||||||
|
Messagebox.YES | Messagebox.NO, Messagebox.QUESTION);
|
||||||
|
|
||||||
|
if (resp == Messagebox.YES) {
|
||||||
|
marcaService.borrar(marca);
|
||||||
|
|
||||||
|
Messagebox.show(
|
||||||
|
Labels.getLabel("editarMarcaController.MSG.borrarOK"),
|
||||||
|
Labels.getLabel("editarMarcaController.window.title"),
|
||||||
|
Messagebox.OK, Messagebox.INFORMATION);
|
||||||
|
|
||||||
|
marcaList.removeItem(marca);
|
||||||
|
|
||||||
|
closeWindow();
|
||||||
|
}
|
||||||
|
} catch (Exception ex) {
|
||||||
|
log.error(ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,214 @@
|
||||||
|
/*
|
||||||
|
* To change this template, choose Tools | Templates
|
||||||
|
* and open the template in the editor.
|
||||||
|
*/
|
||||||
|
package com.rjconsultores.ventaboletos.web.gui.controladores.catalogos;
|
||||||
|
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.Moneda;
|
||||||
|
import com.rjconsultores.ventaboletos.service.MonedaService;
|
||||||
|
import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado;
|
||||||
|
import com.rjconsultores.ventaboletos.utilerias.ApplicationProperties;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.MyGenericForwardComposer;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.MyListbox;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.MyTextbox;
|
||||||
|
import org.apache.log4j.Logger;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.context.annotation.Scope;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import java.util.Calendar;
|
||||||
|
import java.util.List;
|
||||||
|
import org.zkoss.util.resource.Labels;
|
||||||
|
import org.zkoss.zk.ui.Component;
|
||||||
|
import org.zkoss.zk.ui.Executions;
|
||||||
|
import org.zkoss.zk.ui.event.Event;
|
||||||
|
import org.zkoss.zul.Button;
|
||||||
|
import org.zkoss.zul.Messagebox;
|
||||||
|
import org.zkoss.zul.Row;
|
||||||
|
import org.zkoss.zul.Textbox;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Rafius
|
||||||
|
*/
|
||||||
|
@Controller("editarMonedaController")
|
||||||
|
@Scope("prototype")
|
||||||
|
public class EditarMonedaController extends MyGenericForwardComposer {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private MonedaService monedaService;
|
||||||
|
private Moneda moneda;
|
||||||
|
private MyListbox monedaList;
|
||||||
|
private Button btnApagar;
|
||||||
|
private Button btnSalvar;
|
||||||
|
private BusquedaMonedaController busquedaMonedaController;
|
||||||
|
private static Logger log = Logger.getLogger(EditarMonedaController.class);
|
||||||
|
private MyTextbox txtNome;
|
||||||
|
private Row rowEquivalencia;
|
||||||
|
|
||||||
|
public Button getBtnApagar() {
|
||||||
|
return btnApagar;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBtnApagar(Button btnApagar) {
|
||||||
|
this.btnApagar = btnApagar;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Textbox getTxtNome() {
|
||||||
|
return txtNome;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTxtNome(MyTextbox txtNome) {
|
||||||
|
this.txtNome = txtNome;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Button getBtnSalvar() {
|
||||||
|
return btnSalvar;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBtnSalvar(Button btnSalvar) {
|
||||||
|
this.btnSalvar = btnSalvar;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Row getRowEquivalencia() {
|
||||||
|
return rowEquivalencia;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRowEquivalencia(Row rowEquivalencia) {
|
||||||
|
this.rowEquivalencia = rowEquivalencia;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void doAfterCompose(Component comp) throws Exception {
|
||||||
|
super.doAfterCompose(comp);
|
||||||
|
busquedaMonedaController = (BusquedaMonedaController) Executions.getCurrent().getArg().get("busquedaMonedaController");
|
||||||
|
moneda = (Moneda) Executions.getCurrent().getArg().get("moneda");
|
||||||
|
monedaList = (MyListbox) Executions.getCurrent().getArg().get("monedaList");
|
||||||
|
|
||||||
|
if (moneda.getMonedaId() == null) {
|
||||||
|
btnApagar.setVisible(Boolean.FALSE);
|
||||||
|
} else {
|
||||||
|
if (moneda.getMonedaId() <= 2) {
|
||||||
|
btnApagar.setVisible(Boolean.FALSE);
|
||||||
|
btnSalvar.setVisible(Boolean.FALSE);
|
||||||
|
txtNome.setDisabled(Boolean.TRUE);
|
||||||
|
|
||||||
|
Messagebox.show(
|
||||||
|
Labels.getLabel("MSG.noEditabled"),
|
||||||
|
Labels.getLabel("editarMonedaController.window.title"),
|
||||||
|
Messagebox.OK, Messagebox.INFORMATION);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!ApplicationProperties.getInstance().mostrarEquivalencia()) {
|
||||||
|
rowEquivalencia.setVisible(Boolean.FALSE);
|
||||||
|
}
|
||||||
|
|
||||||
|
txtNome.focus();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onClick$btnSalvar(Event ev) throws InterruptedException {
|
||||||
|
txtNome.getValue();
|
||||||
|
try {
|
||||||
|
moneda.setActivo(true);
|
||||||
|
moneda.setFecmodif(Calendar.getInstance().getTime());
|
||||||
|
moneda.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
|
||||||
|
|
||||||
|
if (moneda.getMonedaId() == null) {
|
||||||
|
List<Moneda> lsMoneda = monedaService.buscar(moneda.getDescmoneda());
|
||||||
|
|
||||||
|
boolean podeSalvar = false;
|
||||||
|
if (lsMoneda.isEmpty()) {
|
||||||
|
podeSalvar = true;
|
||||||
|
} else {
|
||||||
|
for (Moneda m : lsMoneda) {
|
||||||
|
if (m.getMonedaId().equals(moneda.getMonedaId())) {
|
||||||
|
podeSalvar = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!podeSalvar) {
|
||||||
|
Messagebox.show(
|
||||||
|
Labels.getLabel("MSG.Registro.Existe"),
|
||||||
|
Labels.getLabel("editarMonedaController.window.title"),
|
||||||
|
Messagebox.OK, Messagebox.EXCLAMATION);
|
||||||
|
} else {
|
||||||
|
monedaService.suscribir(moneda);
|
||||||
|
monedaList.addItem(moneda);
|
||||||
|
|
||||||
|
Messagebox.show(
|
||||||
|
Labels.getLabel("editarMonedaController.MSG.suscribirOK"),
|
||||||
|
Labels.getLabel("editarMonedaController.window.title"),
|
||||||
|
Messagebox.OK, Messagebox.INFORMATION);
|
||||||
|
busquedaMonedaController.refreshLista();
|
||||||
|
closeWindow();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
monedaService.actualizacion(moneda);
|
||||||
|
monedaList.updateItem(moneda);
|
||||||
|
|
||||||
|
Messagebox.show(
|
||||||
|
Labels.getLabel("editarMonedaController.MSG.suscribirOK"),
|
||||||
|
Labels.getLabel("editarMonedaController.window.title"),
|
||||||
|
Messagebox.OK, Messagebox.INFORMATION);
|
||||||
|
busquedaMonedaController.refreshLista();
|
||||||
|
closeWindow();
|
||||||
|
}
|
||||||
|
} catch (Exception ex) {
|
||||||
|
log.error("editarMonedaController: " + ex);
|
||||||
|
Messagebox.show(
|
||||||
|
Labels.getLabel("MSG.Error"),
|
||||||
|
Labels.getLabel("editarMonedaController.window.title"),
|
||||||
|
Messagebox.OK, Messagebox.ERROR);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onClick$btnApagar(Event ev) {
|
||||||
|
try {
|
||||||
|
int resp = Messagebox.show(
|
||||||
|
Labels.getLabel("editarMonedaController.MSG.borrarPergunta"),
|
||||||
|
Labels.getLabel("editarMonedaController.window.title"),
|
||||||
|
Messagebox.YES | Messagebox.NO, Messagebox.QUESTION);
|
||||||
|
|
||||||
|
if (resp == Messagebox.YES) {
|
||||||
|
|
||||||
|
monedaService.borrar(moneda);
|
||||||
|
|
||||||
|
Messagebox.show(
|
||||||
|
Labels.getLabel("editarMonedaController.MSG.borrarOK"),
|
||||||
|
Labels.getLabel("editarMonedaController.window.title"),
|
||||||
|
Messagebox.OK, Messagebox.INFORMATION);
|
||||||
|
|
||||||
|
monedaList.removeItem(moneda);
|
||||||
|
|
||||||
|
closeWindow();
|
||||||
|
}
|
||||||
|
} catch (Exception ex) {
|
||||||
|
log.error(ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public Moneda getMoneda() {
|
||||||
|
return moneda;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMoneda(Moneda moneda) {
|
||||||
|
this.moneda = moneda;
|
||||||
|
}
|
||||||
|
|
||||||
|
public MyListbox getMonedaList() {
|
||||||
|
return monedaList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMonedaList(MyListbox monedaList) {
|
||||||
|
this.monedaList = monedaList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public MonedaService getMonedaService() {
|
||||||
|
return monedaService;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMonedaService(MonedaService monedaService) {
|
||||||
|
this.monedaService = monedaService;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,196 @@
|
||||||
|
/*
|
||||||
|
* To change this template, choose Tools | Templates
|
||||||
|
* and open the template in the editor.
|
||||||
|
*/
|
||||||
|
package com.rjconsultores.ventaboletos.web.gui.controladores.catalogos;
|
||||||
|
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.Pais;
|
||||||
|
import com.rjconsultores.ventaboletos.service.PaisService;
|
||||||
|
import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.MyGenericForwardComposer;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.MyListbox;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.MyTextbox;
|
||||||
|
import org.apache.log4j.Logger;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.context.annotation.Scope;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import java.util.Calendar;
|
||||||
|
import java.util.List;
|
||||||
|
import org.zkoss.util.resource.Labels;
|
||||||
|
import org.zkoss.zk.ui.Component;
|
||||||
|
import org.zkoss.zk.ui.Executions;
|
||||||
|
import org.zkoss.zk.ui.event.Event;
|
||||||
|
import org.zkoss.zul.Button;
|
||||||
|
import org.zkoss.zul.Messagebox;
|
||||||
|
import org.zkoss.zul.Textbox;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Rafius
|
||||||
|
*/
|
||||||
|
@Controller("editarPaisController")
|
||||||
|
@Scope("prototype")
|
||||||
|
public class EditarPaisController extends MyGenericForwardComposer {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private PaisService paisService;
|
||||||
|
private Pais pais;
|
||||||
|
private MyListbox paisList;
|
||||||
|
private Button btnApagar;
|
||||||
|
private Button btnSalvar;
|
||||||
|
private BusquedaPaisController busquedaPaisController;
|
||||||
|
private static Logger log = Logger.getLogger(EditarPaisController.class);
|
||||||
|
private MyTextbox txtNome;
|
||||||
|
|
||||||
|
public Button getBtnApagar() {
|
||||||
|
return btnApagar;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBtnApagar(Button btnApagar) {
|
||||||
|
this.btnApagar = btnApagar;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Textbox getTxtNome() {
|
||||||
|
return txtNome;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTxtNome(MyTextbox txtNome) {
|
||||||
|
this.txtNome = txtNome;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Button getBtnSalvar() {
|
||||||
|
return btnSalvar;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBtnSalvar(Button btnSalvar) {
|
||||||
|
this.btnSalvar = btnSalvar;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void doAfterCompose(Component comp) throws Exception {
|
||||||
|
super.doAfterCompose(comp);
|
||||||
|
busquedaPaisController = (BusquedaPaisController) Executions.getCurrent().getArg().get("busquedaPaisController");
|
||||||
|
pais = (Pais) Executions.getCurrent().getArg().get("pais");
|
||||||
|
paisList = (MyListbox) Executions.getCurrent().getArg().get("paisList");
|
||||||
|
|
||||||
|
if (pais.getPaisId() == null) {
|
||||||
|
btnApagar.setVisible(Boolean.FALSE);
|
||||||
|
}
|
||||||
|
// else {
|
||||||
|
// if (pais.getPaisId() <= 2) {
|
||||||
|
// btnApagar.setVisible(Boolean.FALSE);
|
||||||
|
// btnSalvar.setVisible(Boolean.FALSE);
|
||||||
|
// txtNome.setDisabled(Boolean.TRUE);
|
||||||
|
//
|
||||||
|
// Messagebox.show(
|
||||||
|
// Labels.getLabel("MSG.noEditabled"),
|
||||||
|
// Labels.getLabel("editarPaisController.window.title"),
|
||||||
|
// Messagebox.OK, Messagebox.INFORMATION);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
txtNome.focus();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onClick$btnSalvar(Event ev) throws InterruptedException {
|
||||||
|
txtNome.getValue();
|
||||||
|
try {
|
||||||
|
pais.setActivo(true);
|
||||||
|
pais.setFecmodif(Calendar.getInstance().getTime());
|
||||||
|
pais.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
|
||||||
|
|
||||||
|
|
||||||
|
boolean podeSalvar = false;
|
||||||
|
List<Pais> lsPais = paisService.buscar(pais.getNombpais());
|
||||||
|
if (lsPais.isEmpty()) {
|
||||||
|
podeSalvar = true;
|
||||||
|
} else {
|
||||||
|
if (pais.getPaisId() != null) {
|
||||||
|
for (Pais p : lsPais) {
|
||||||
|
if (p.getPaisId().equals(pais.getPaisId())) {
|
||||||
|
podeSalvar = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (podeSalvar) {
|
||||||
|
if (pais.getPaisId() == null) {
|
||||||
|
paisService.suscribir(pais);
|
||||||
|
paisList.addItem(pais);
|
||||||
|
} else {
|
||||||
|
paisService.actualizacion(pais);
|
||||||
|
paisList.updateItem(pais);
|
||||||
|
}
|
||||||
|
Messagebox.show(
|
||||||
|
Labels.getLabel("editarPaisController.MSG.suscribirOK"),
|
||||||
|
Labels.getLabel("editarPaisController.window.title"),
|
||||||
|
Messagebox.OK, Messagebox.INFORMATION);
|
||||||
|
busquedaPaisController.refreshLista();
|
||||||
|
closeWindow();
|
||||||
|
|
||||||
|
} else {
|
||||||
|
Messagebox.show(
|
||||||
|
Labels.getLabel("MSG.Registro.Existe"),
|
||||||
|
Labels.getLabel("editarPaisController.window.title"),
|
||||||
|
Messagebox.OK, Messagebox.EXCLAMATION);
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch (Exception ex) {
|
||||||
|
log.error("editarPaisController: " + ex);
|
||||||
|
Messagebox.show(
|
||||||
|
Labels.getLabel("MSG.Error"),
|
||||||
|
Labels.getLabel("editarPaisController.window.title"),
|
||||||
|
Messagebox.OK, Messagebox.ERROR);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onClick$btnApagar(Event ev) {
|
||||||
|
try {
|
||||||
|
int resp = Messagebox.show(
|
||||||
|
Labels.getLabel("editarPaisController.MSG.borrarPergunta"),
|
||||||
|
Labels.getLabel("editarPaisController.window.title"),
|
||||||
|
Messagebox.YES | Messagebox.NO, Messagebox.QUESTION);
|
||||||
|
|
||||||
|
if (resp == Messagebox.YES) {
|
||||||
|
|
||||||
|
paisService.borrar(pais);
|
||||||
|
|
||||||
|
Messagebox.show(
|
||||||
|
Labels.getLabel("editarPaisController.MSG.borrarOK"),
|
||||||
|
Labels.getLabel("editarPaisController.window.title"),
|
||||||
|
Messagebox.OK, Messagebox.INFORMATION);
|
||||||
|
|
||||||
|
paisList.removeItem(pais);
|
||||||
|
|
||||||
|
closeWindow();
|
||||||
|
}
|
||||||
|
} catch (Exception ex) {
|
||||||
|
log.error(ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public Pais getPais() {
|
||||||
|
return pais;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPais(Pais pais) {
|
||||||
|
this.pais = pais;
|
||||||
|
}
|
||||||
|
|
||||||
|
public MyListbox getPaisList() {
|
||||||
|
return paisList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPaisList(MyListbox paisList) {
|
||||||
|
this.paisList = paisList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public PaisService getPaisService() {
|
||||||
|
return paisService;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPaisService(PaisService paisService) {
|
||||||
|
this.paisService = paisService;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,145 @@
|
||||||
|
/*
|
||||||
|
* To change this template, choose Tools | Templates
|
||||||
|
* and open the template in the editor.
|
||||||
|
*/
|
||||||
|
package com.rjconsultores.ventaboletos.web.gui.controladores.catalogos;
|
||||||
|
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.Plaza;
|
||||||
|
import com.rjconsultores.ventaboletos.service.PlazaService;
|
||||||
|
import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.MyGenericForwardComposer;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.MyListbox;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.MyTextbox;
|
||||||
|
import java.util.Calendar;
|
||||||
|
import java.util.List;
|
||||||
|
import org.apache.log4j.Logger;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.context.annotation.Scope;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.zkoss.util.resource.Labels;
|
||||||
|
import org.zkoss.zhtml.Messagebox;
|
||||||
|
import org.zkoss.zk.ui.Component;
|
||||||
|
import org.zkoss.zk.ui.Executions;
|
||||||
|
import org.zkoss.zk.ui.event.Event;
|
||||||
|
import org.zkoss.zul.Button;
|
||||||
|
import org.zkoss.zul.Textbox;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Administrador
|
||||||
|
*/
|
||||||
|
@Controller("editarPlazaController")
|
||||||
|
@Scope("prototype")
|
||||||
|
public class EditarPlazaController extends MyGenericForwardComposer {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private PlazaService plazaService;
|
||||||
|
private Plaza plaza;
|
||||||
|
private MyListbox plazaList;
|
||||||
|
private Button btnApagar;
|
||||||
|
private MyTextbox txtNome;
|
||||||
|
private static Logger log = Logger.getLogger(EditarPlazaController.class);
|
||||||
|
|
||||||
|
public Plaza getPlaza() {
|
||||||
|
return plaza;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPlaza(Plaza plaza) {
|
||||||
|
this.plaza = plaza;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Button getBtnApagar() {
|
||||||
|
return btnApagar;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBtnApagar(Button btnApagar) {
|
||||||
|
this.btnApagar = btnApagar;
|
||||||
|
}
|
||||||
|
|
||||||
|
public MyTextbox getTxtNome() {
|
||||||
|
return txtNome;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTxtNome(MyTextbox txtNome) {
|
||||||
|
this.txtNome = txtNome;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void doAfterCompose(Component comp) throws Exception {
|
||||||
|
super.doAfterCompose(comp);
|
||||||
|
|
||||||
|
plaza = (Plaza) Executions.getCurrent().getArg().get("plaza");
|
||||||
|
plazaList = (MyListbox) Executions.getCurrent().getArg().get("plazaList");
|
||||||
|
|
||||||
|
if (plaza.getPlazaId() == null) {
|
||||||
|
btnApagar.setVisible(Boolean.FALSE);
|
||||||
|
}
|
||||||
|
|
||||||
|
txtNome.focus();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onClick$btnSalvar(Event ev) throws InterruptedException {
|
||||||
|
txtNome.getValue();
|
||||||
|
|
||||||
|
try {
|
||||||
|
plaza.setActivo(Boolean.TRUE);
|
||||||
|
plaza.setFecmodif(Calendar.getInstance().getTime());
|
||||||
|
plaza.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
|
||||||
|
|
||||||
|
List<Plaza> lsPlaza = plazaService.buscar(plaza.getNombplaza());
|
||||||
|
|
||||||
|
if (!lsPlaza.isEmpty() && (!lsPlaza.get(0).equals(plaza))) {
|
||||||
|
Messagebox.show(
|
||||||
|
Labels.getLabel("MSG.Registro.Existe"),
|
||||||
|
Labels.getLabel("editarPlazaController.window.title"),
|
||||||
|
Messagebox.OK, Messagebox.EXCLAMATION);
|
||||||
|
} else {
|
||||||
|
if (plaza.getPlazaId() == null) {
|
||||||
|
plazaService.suscribir(plaza);
|
||||||
|
plazaList.addItem(plaza);
|
||||||
|
} else {
|
||||||
|
plazaService.actualizacion(plaza);
|
||||||
|
plazaList.updateItem(plaza);
|
||||||
|
}
|
||||||
|
|
||||||
|
Messagebox.show(
|
||||||
|
Labels.getLabel("editarPlazaController.MSG.suscribirOK"),
|
||||||
|
Labels.getLabel("editarPlazaController.window.title"),
|
||||||
|
Messagebox.OK, Messagebox.INFORMATION);
|
||||||
|
|
||||||
|
closeWindow();
|
||||||
|
}
|
||||||
|
} catch (Exception ex) {
|
||||||
|
log.error("editarPlazaController: " + ex);
|
||||||
|
Messagebox.show(
|
||||||
|
Labels.getLabel("MSG.Error"),
|
||||||
|
Labels.getLabel("editarPlazaController.window.title"),
|
||||||
|
Messagebox.OK, Messagebox.ERROR);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onClick$btnApagar(Event ev) {
|
||||||
|
try {
|
||||||
|
int resp = Messagebox.show(
|
||||||
|
Labels.getLabel("editarPlazaController.MSG.borrarPergunta"),
|
||||||
|
Labels.getLabel("editarPlazaController.window.title"),
|
||||||
|
Messagebox.YES | Messagebox.NO, Messagebox.QUESTION);
|
||||||
|
|
||||||
|
if (resp == Messagebox.YES) {
|
||||||
|
|
||||||
|
plazaService.borrar(plaza);
|
||||||
|
|
||||||
|
Messagebox.show(
|
||||||
|
Labels.getLabel("editarPlazaController.MSG.borrarOK"),
|
||||||
|
Labels.getLabel("editarPlazaController.window.title"),
|
||||||
|
Messagebox.OK, Messagebox.INFORMATION);
|
||||||
|
|
||||||
|
plazaList.removeItem(plaza);
|
||||||
|
|
||||||
|
closeWindow();
|
||||||
|
}
|
||||||
|
} catch (Exception ex) {
|
||||||
|
log.error(ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,235 @@
|
||||||
|
/*
|
||||||
|
* To change this template, choose Tools | Templates
|
||||||
|
* and open the template in the editor.
|
||||||
|
*/
|
||||||
|
package com.rjconsultores.ventaboletos.web.gui.controladores.catalogos;
|
||||||
|
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.Empresa;
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.ProductoServicio;
|
||||||
|
import com.rjconsultores.ventaboletos.service.EmpresaService;
|
||||||
|
import com.rjconsultores.ventaboletos.service.ProductoServicioService;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.MyGenericForwardComposer;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.MyListbox;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.MyTextbox;
|
||||||
|
import java.util.List;
|
||||||
|
import org.apache.log4j.Logger;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.context.annotation.Scope;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.zkoss.util.resource.Labels;
|
||||||
|
import org.zkoss.zhtml.Textarea;
|
||||||
|
import org.zkoss.zul.Button;
|
||||||
|
import org.zkoss.zk.ui.Component;
|
||||||
|
import org.zkoss.zk.ui.Executions;
|
||||||
|
import org.zkoss.zk.ui.event.Event;
|
||||||
|
import org.zkoss.zul.Combobox;
|
||||||
|
import org.zkoss.zul.Messagebox;
|
||||||
|
import org.zkoss.zul.Radio;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Shiro
|
||||||
|
*/
|
||||||
|
@Controller("editarProductoServicioControllerMX")
|
||||||
|
@Scope("prototype")
|
||||||
|
public class EditarProductoServicioController extends MyGenericForwardComposer {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ProductoServicioService pSerService;
|
||||||
|
@Autowired
|
||||||
|
private EmpresaService empresaService;
|
||||||
|
private ProductoServicio ps;
|
||||||
|
private MyListbox PSList;
|
||||||
|
private MyTextbox txtNome;
|
||||||
|
private Combobox cmbEmpresa;
|
||||||
|
private Button btnApagar;
|
||||||
|
private Radio rdProducto;
|
||||||
|
private Radio rdServicio;
|
||||||
|
private List<Empresa> lsEmpresa;
|
||||||
|
private static Logger log = Logger.getLogger(EditarProductoServicioController.class);
|
||||||
|
|
||||||
|
public MyListbox getPSList() {
|
||||||
|
return PSList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPSList(MyListbox PSList) {
|
||||||
|
this.PSList = PSList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ProductoServicio getPs() {
|
||||||
|
return ps;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPs(ProductoServicio ps) {
|
||||||
|
this.ps = ps;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ProductoServicioService getpSerService() {
|
||||||
|
return pSerService;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setpSerService(ProductoServicioService pSerService) {
|
||||||
|
this.pSerService = pSerService;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Radio getRdProducto() {
|
||||||
|
return rdProducto;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRdProducto(Radio rdProducto) {
|
||||||
|
this.rdProducto = rdProducto;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Radio getRdServicio() {
|
||||||
|
return rdServicio;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRdServicio(Radio rdServicio) {
|
||||||
|
this.rdServicio = rdServicio;
|
||||||
|
}
|
||||||
|
|
||||||
|
public MyTextbox getTxtNome() {
|
||||||
|
return txtNome;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTxtNome(MyTextbox txtNome) {
|
||||||
|
this.txtNome = txtNome;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void doAfterCompose(Component comp) throws Exception {
|
||||||
|
|
||||||
|
lsEmpresa = empresaService.obtenerIndTipo2();
|
||||||
|
|
||||||
|
super.doAfterCompose(comp);
|
||||||
|
|
||||||
|
ps = (ProductoServicio) Executions.getCurrent().getArg().get("ps");
|
||||||
|
PSList = (MyListbox) Executions.getCurrent().getArg().get("PSList");
|
||||||
|
|
||||||
|
if (ps.getProductoservicioId() != null) {
|
||||||
|
if (ps.getIndtipo().equals("S")) {
|
||||||
|
|
||||||
|
rdServicio.setChecked(true);
|
||||||
|
} else if (ps.getIndtipo().equals("P")) {
|
||||||
|
|
||||||
|
rdProducto.setChecked(true);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
rdServicio.setChecked(true);
|
||||||
|
}
|
||||||
|
if (ps.getProductoservicioId() == null) {
|
||||||
|
btnApagar.setVisible(Boolean.FALSE);
|
||||||
|
}
|
||||||
|
txtNome.focus();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onClick$btnSalvar(Event ev) throws InterruptedException {
|
||||||
|
|
||||||
|
txtNome.getValue();
|
||||||
|
cmbEmpresa.getValue();
|
||||||
|
|
||||||
|
try {
|
||||||
|
|
||||||
|
if (rdServicio.isChecked()) {
|
||||||
|
ps.setIndtipo("S");
|
||||||
|
} else if (rdProducto.isChecked()) {
|
||||||
|
ps.setIndtipo("P");
|
||||||
|
}
|
||||||
|
|
||||||
|
List<ProductoServicio> lsPs = pSerService.obtener(ps);
|
||||||
|
boolean podeSalvar = false;
|
||||||
|
|
||||||
|
if (lsPs.isEmpty()) {
|
||||||
|
podeSalvar = true;
|
||||||
|
} else {
|
||||||
|
for (ProductoServicio pser : lsPs) {
|
||||||
|
if (pser.getProductoservicioId().equals(ps.getProductoservicioId())) {
|
||||||
|
podeSalvar = true;
|
||||||
|
} else {
|
||||||
|
podeSalvar = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (podeSalvar) {
|
||||||
|
if (ps.getProductoservicioId() == null) {
|
||||||
|
pSerService.suscribir(ps);
|
||||||
|
PSList.addItem(ps);
|
||||||
|
} else {
|
||||||
|
pSerService.actualizacion(ps);
|
||||||
|
PSList.updateItem(ps);
|
||||||
|
}
|
||||||
|
|
||||||
|
Messagebox.show(
|
||||||
|
Labels.getLabel("editarProductoServicioController.MSG.suscribirOK"),
|
||||||
|
Labels.getLabel("editarProductoServicioController.window.title"),
|
||||||
|
Messagebox.OK, Messagebox.INFORMATION);
|
||||||
|
|
||||||
|
closeWindow();
|
||||||
|
|
||||||
|
} else {
|
||||||
|
Messagebox.show(
|
||||||
|
Labels.getLabel("MSG.Registro.Existe"),
|
||||||
|
Labels.getLabel("editarProductoServicioController.window.title"),
|
||||||
|
Messagebox.OK, Messagebox.EXCLAMATION);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch (Exception ex) {
|
||||||
|
log.error("editarProductoServicioController: " + ex);
|
||||||
|
Messagebox.show(
|
||||||
|
Labels.getLabel("MSG.Error"),
|
||||||
|
Labels.getLabel("editarProductoServicioController.window.title"),
|
||||||
|
Messagebox.OK, Messagebox.ERROR);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onClick$btnApagar(Event ev) {
|
||||||
|
try {
|
||||||
|
int resp = Messagebox.show(
|
||||||
|
Labels.getLabel("editarProductoServicioController.MSG.BorrarPergunta"),
|
||||||
|
Labels.getLabel("editarProductoServicioController.window.title"),
|
||||||
|
Messagebox.YES | Messagebox.NO, Messagebox.QUESTION);
|
||||||
|
|
||||||
|
if (resp == Messagebox.YES) {
|
||||||
|
|
||||||
|
pSerService.borrar(ps);
|
||||||
|
|
||||||
|
Messagebox.show(
|
||||||
|
Labels.getLabel("editarProductoServicioController.MSG.BorrarOK"),
|
||||||
|
Labels.getLabel("editarProductoServicioController.window.title"),
|
||||||
|
Messagebox.OK, Messagebox.INFORMATION);
|
||||||
|
|
||||||
|
PSList.removeItem(ps);
|
||||||
|
|
||||||
|
closeWindow();
|
||||||
|
}
|
||||||
|
} catch (Exception ex) {
|
||||||
|
log.error(ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public Combobox getCmbEmpresa() {
|
||||||
|
return cmbEmpresa;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCmbEmpresa(Combobox cmbEmpresa) {
|
||||||
|
this.cmbEmpresa = cmbEmpresa;
|
||||||
|
}
|
||||||
|
|
||||||
|
public EmpresaService getEmpresaService() {
|
||||||
|
return empresaService;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEmpresaService(EmpresaService empresaService) {
|
||||||
|
this.empresaService = empresaService;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<Empresa> getLsEmpresa() {
|
||||||
|
return lsEmpresa;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLsEmpresa(List<Empresa> lsEmpresa) {
|
||||||
|
this.lsEmpresa = lsEmpresa;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,185 @@
|
||||||
|
/*
|
||||||
|
* To change this template, choose Tools | Templates
|
||||||
|
* and open the template in the editor.
|
||||||
|
*/
|
||||||
|
package com.rjconsultores.ventaboletos.web.gui.controladores.catalogos;
|
||||||
|
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.Empresa;
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.PtovtaEmpresa;
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.PuntoVenta;
|
||||||
|
import com.rjconsultores.ventaboletos.service.EmpresaService;
|
||||||
|
import com.rjconsultores.ventaboletos.service.PtovtaEmpresaService;
|
||||||
|
import com.rjconsultores.ventaboletos.service.PuntoVentaService;
|
||||||
|
import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.MyGenericForwardComposer;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.MyListbox;
|
||||||
|
import org.apache.log4j.Logger;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.context.annotation.Scope;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import java.util.Calendar;
|
||||||
|
import java.util.List;
|
||||||
|
import org.zkoss.util.resource.Labels;
|
||||||
|
import org.zkoss.zk.ui.Component;
|
||||||
|
import org.zkoss.zk.ui.Executions;
|
||||||
|
import org.zkoss.zk.ui.event.Event;
|
||||||
|
import org.zkoss.zul.Button;
|
||||||
|
import org.zkoss.zul.Messagebox;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Rafius
|
||||||
|
*/
|
||||||
|
@Controller("editarPtovtaEmpresaController")
|
||||||
|
@Scope("prototype")
|
||||||
|
public class EditarPtovtaEmpresaController extends MyGenericForwardComposer {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private PtovtaEmpresaService ptovtaEmpresaService;
|
||||||
|
@Autowired
|
||||||
|
private EmpresaService empresaService;
|
||||||
|
@Autowired
|
||||||
|
private PuntoVentaService puntoVentaService;
|
||||||
|
private List<Empresa> lsEmpresa;
|
||||||
|
private List<PuntoVenta> lsPuntoVenta;
|
||||||
|
private PtovtaEmpresa ptovtaEmpresa;
|
||||||
|
private MyListbox ptovtaEmpresaList;
|
||||||
|
private Button btnApagar;
|
||||||
|
private static Logger log = Logger.getLogger(EditarPtovtaEmpresaController.class);
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void doAfterCompose(Component comp) throws Exception {
|
||||||
|
|
||||||
|
lsEmpresa = empresaService.obtenerTodos();
|
||||||
|
lsPuntoVenta = puntoVentaService.obtenerTodos();
|
||||||
|
|
||||||
|
super.doAfterCompose(comp);
|
||||||
|
|
||||||
|
ptovtaEmpresa = (PtovtaEmpresa) Executions.getCurrent().getArg().get("ptovtaEmpresa");
|
||||||
|
ptovtaEmpresaList = (MyListbox) Executions.getCurrent().getArg().get("ptovtaEmpresaList");
|
||||||
|
|
||||||
|
if (ptovtaEmpresa.getPtovtaempresaId() == null) {
|
||||||
|
btnApagar.setVisible(Boolean.FALSE);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onClick$btnSalvar(Event ev) throws InterruptedException {
|
||||||
|
|
||||||
|
try {
|
||||||
|
ptovtaEmpresa.setActivo(true);
|
||||||
|
ptovtaEmpresa.setFecmodif(Calendar.getInstance().getTime());
|
||||||
|
ptovtaEmpresa.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
|
||||||
|
|
||||||
|
List<PtovtaEmpresa> lsPtoVta = ptovtaEmpresaService.buscar(ptovtaEmpresa);
|
||||||
|
|
||||||
|
boolean podeSalvar = false;
|
||||||
|
if (lsPtoVta.isEmpty()) {
|
||||||
|
podeSalvar = true;
|
||||||
|
} else {
|
||||||
|
if (ptovtaEmpresa.getPtovtaempresaId() != null) {
|
||||||
|
for (PtovtaEmpresa c : lsPtoVta) {
|
||||||
|
if (c.getPtovtaempresaId().equals(ptovtaEmpresa.getPtovtaempresaId())) {
|
||||||
|
podeSalvar = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (podeSalvar) {
|
||||||
|
|
||||||
|
if (ptovtaEmpresa.getPtovtaempresaId() == null) {
|
||||||
|
ptovtaEmpresa = ptovtaEmpresaService.suscribir(ptovtaEmpresa);
|
||||||
|
ptovtaEmpresaList.addItem(ptovtaEmpresa);
|
||||||
|
} else {
|
||||||
|
ptovtaEmpresa = ptovtaEmpresaService.actualizacion(ptovtaEmpresa);
|
||||||
|
ptovtaEmpresaList.updateItem(ptovtaEmpresa);
|
||||||
|
}
|
||||||
|
|
||||||
|
Messagebox.show(
|
||||||
|
Labels.getLabel("editarPtovtaEmpresaController.MSG.suscribirOK"),
|
||||||
|
Labels.getLabel("editarPtovtaEmpresaController.window.title"),
|
||||||
|
Messagebox.OK, Messagebox.INFORMATION);
|
||||||
|
|
||||||
|
|
||||||
|
closeWindow();
|
||||||
|
} else {
|
||||||
|
Messagebox.show(
|
||||||
|
Labels.getLabel("MSG.Registro.Existe"),
|
||||||
|
Labels.getLabel("editarPtovtaEmpresaController.window.title"),
|
||||||
|
Messagebox.OK, Messagebox.EXCLAMATION);
|
||||||
|
}
|
||||||
|
} catch (Exception ex) {
|
||||||
|
log.error("editarPtovtaEmpresaController: " + ex);
|
||||||
|
Messagebox.show(
|
||||||
|
Labels.getLabel("MSG.Error"),
|
||||||
|
Labels.getLabel("editarPtovtaEmpresaController.window.title"),
|
||||||
|
Messagebox.OK, Messagebox.ERROR);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onClick$btnApagar(Event ev) {
|
||||||
|
try {
|
||||||
|
int resp = Messagebox.show(
|
||||||
|
Labels.getLabel("editarPtovtaEmpresaController.MSG.borrarPergunta"),
|
||||||
|
Labels.getLabel("editarPtovtaEmpresaController.window.title"),
|
||||||
|
Messagebox.YES | Messagebox.NO, Messagebox.QUESTION);
|
||||||
|
|
||||||
|
if (resp == Messagebox.YES) {
|
||||||
|
|
||||||
|
ptovtaEmpresaService.borrar(ptovtaEmpresa);
|
||||||
|
|
||||||
|
Messagebox.show(
|
||||||
|
Labels.getLabel("editarPtovtaEmpresaController.MSG.borrarOK"),
|
||||||
|
Labels.getLabel("editarPtovtaEmpresaController.window.title"),
|
||||||
|
Messagebox.OK, Messagebox.INFORMATION);
|
||||||
|
|
||||||
|
ptovtaEmpresaList.removeItem(ptovtaEmpresa);
|
||||||
|
|
||||||
|
closeWindow();
|
||||||
|
}
|
||||||
|
} catch (Exception ex) {
|
||||||
|
log.error(ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public PtovtaEmpresa getPtovtaEmpresa() {
|
||||||
|
return ptovtaEmpresa;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPtovtaEmpresa(PtovtaEmpresa ptovtaEmpresa) {
|
||||||
|
this.ptovtaEmpresa = ptovtaEmpresa;
|
||||||
|
}
|
||||||
|
|
||||||
|
public MyListbox getPtovtaEmpresaList() {
|
||||||
|
return ptovtaEmpresaList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPtovtaEmpresaList(MyListbox ptovtaEmpresaList) {
|
||||||
|
this.ptovtaEmpresaList = ptovtaEmpresaList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public PtovtaEmpresaService getPtovtaEmpresaService() {
|
||||||
|
return ptovtaEmpresaService;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPtovtaEmpresaService(PtovtaEmpresaService ptovtaEmpresaService) {
|
||||||
|
this.ptovtaEmpresaService = ptovtaEmpresaService;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<Empresa> getLsEmpresa() {
|
||||||
|
return lsEmpresa;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLsEmpresa(List<Empresa> lsEmpresa) {
|
||||||
|
this.lsEmpresa = lsEmpresa;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<PuntoVenta> getLsPuntoVenta() {
|
||||||
|
return lsPuntoVenta;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLsPuntoVenta(List<PuntoVenta> lsPuntoVenta) {
|
||||||
|
this.lsPuntoVenta = lsPuntoVenta;
|
||||||
|
}
|
||||||
|
}
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,139 @@
|
||||||
|
/*
|
||||||
|
* To change this template, choose Tools | Templates
|
||||||
|
* and open the template in the editor.
|
||||||
|
*/
|
||||||
|
package com.rjconsultores.ventaboletos.web.gui.controladores.catalogos;
|
||||||
|
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.TipoConvenio;
|
||||||
|
import com.rjconsultores.ventaboletos.service.TipoConvenioService;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.MyGenericForwardComposer;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.MyListbox;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.MyTextbox;
|
||||||
|
import java.util.Calendar;
|
||||||
|
import org.apache.log4j.Logger;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.context.annotation.Scope;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.zkoss.util.resource.Labels;
|
||||||
|
import org.zkoss.zk.ui.Component;
|
||||||
|
import org.zkoss.zk.ui.Executions;
|
||||||
|
import org.zkoss.zk.ui.event.Event;
|
||||||
|
import org.zkoss.zul.Messagebox;
|
||||||
|
import org.zkoss.zul.Textbox;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Shiro
|
||||||
|
*/
|
||||||
|
@Controller("editarTipoConvenioController")
|
||||||
|
@Scope("prototype")
|
||||||
|
public class EditarTipoConvenioController extends MyGenericForwardComposer {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private TipoConvenioService tipoConvenioService;
|
||||||
|
private TipoConvenio tc;
|
||||||
|
private MyListbox tcList;
|
||||||
|
private MyTextbox txtNome;
|
||||||
|
private static Logger log = Logger.getLogger(EditarTipoConvenioController.class);
|
||||||
|
|
||||||
|
public TipoConvenio getTc() {
|
||||||
|
return tc;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTc(TipoConvenio tc) {
|
||||||
|
this.tc = tc;
|
||||||
|
}
|
||||||
|
|
||||||
|
public MyListbox getTcList() {
|
||||||
|
return tcList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTcList(MyListbox tcList) {
|
||||||
|
this.tcList = tcList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public TipoConvenioService getTipoConvenioService() {
|
||||||
|
return tipoConvenioService;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTipoConvenioService(TipoConvenioService tipoConvenioService) {
|
||||||
|
this.tipoConvenioService = tipoConvenioService;
|
||||||
|
}
|
||||||
|
|
||||||
|
public MyTextbox getTxtNome() {
|
||||||
|
return txtNome;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTxtNome(MyTextbox txtNome) {
|
||||||
|
this.txtNome = txtNome;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void doAfterCompose(Component comp) throws Exception {
|
||||||
|
super.doAfterCompose(comp);
|
||||||
|
|
||||||
|
tc = (TipoConvenio) Executions.getCurrent().getArg().get("tc");
|
||||||
|
tcList = (MyListbox) Executions.getCurrent().getArg().get("tConvenioList");
|
||||||
|
|
||||||
|
|
||||||
|
txtNome.focus();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onClick$btnSalvar(Event ev) throws InterruptedException {
|
||||||
|
|
||||||
|
txtNome.getValue();
|
||||||
|
|
||||||
|
try {
|
||||||
|
tc.setActivo(Boolean.TRUE);
|
||||||
|
tc.setFecmodif(Calendar.getInstance().getTime());
|
||||||
|
tc.setUsuarioId(0);
|
||||||
|
///tc.setDescTipo(txtNome.getValue());
|
||||||
|
|
||||||
|
if (tc.getTipoConvenioID() == null) {
|
||||||
|
tipoConvenioService.suscribir(tc);
|
||||||
|
tcList.addItem(tc);
|
||||||
|
} else {
|
||||||
|
tipoConvenioService.actualizacion(tc);
|
||||||
|
tcList.updateItem(tc);
|
||||||
|
}
|
||||||
|
|
||||||
|
Messagebox.show(
|
||||||
|
Labels.getLabel("editarTipoConvenioController.MSG.suscribirOK"),
|
||||||
|
Labels.getLabel("editarTipoConvenioController.window.title"),
|
||||||
|
Messagebox.OK, Messagebox.INFORMATION);
|
||||||
|
|
||||||
|
closeWindow();
|
||||||
|
} catch (Exception ex) {
|
||||||
|
log.error("editarTipoConvenioController :" + ex);
|
||||||
|
Messagebox.show(
|
||||||
|
Labels.getLabel("MSG.Error"),
|
||||||
|
Labels.getLabel("editarTipoConvenioController.window.title"),
|
||||||
|
Messagebox.OK, Messagebox.ERROR);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onClick$btnApagar(Event ev) {
|
||||||
|
try {
|
||||||
|
int resp = Messagebox.show(
|
||||||
|
Labels.getLabel("editarTipoConvenioController.MSG.BorrarPergunta"),
|
||||||
|
Labels.getLabel("editarTipoConvenioController.window.title"),
|
||||||
|
Messagebox.YES | Messagebox.NO, Messagebox.QUESTION);
|
||||||
|
|
||||||
|
if (resp == Messagebox.YES) {
|
||||||
|
|
||||||
|
tipoConvenioService.borrar(tc);
|
||||||
|
|
||||||
|
Messagebox.show(
|
||||||
|
Labels.getLabel("editarTipoConvenioController.MSG.BorrarOK"),
|
||||||
|
Labels.getLabel("editarTipoConvenioController.window.title"),
|
||||||
|
Messagebox.OK, Messagebox.INFORMATION);
|
||||||
|
|
||||||
|
tcList.removeItem(tc);
|
||||||
|
|
||||||
|
closeWindow();
|
||||||
|
}
|
||||||
|
} catch (Exception ex) {
|
||||||
|
log.error(ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,145 @@
|
||||||
|
/*
|
||||||
|
* To change this template, choose Tools | Templates
|
||||||
|
* and open the template in the editor.
|
||||||
|
*/
|
||||||
|
package com.rjconsultores.ventaboletos.web.gui.controladores.catalogos;
|
||||||
|
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.TipoCorte;
|
||||||
|
import com.rjconsultores.ventaboletos.service.TipoCorteService;
|
||||||
|
import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.MyGenericForwardComposer;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.MyListbox;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.MyTextbox;
|
||||||
|
import java.util.Calendar;
|
||||||
|
import java.util.List;
|
||||||
|
import org.apache.log4j.Logger;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.context.annotation.Scope;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.zkoss.util.resource.Labels;
|
||||||
|
import org.zkoss.zhtml.Messagebox;
|
||||||
|
import org.zkoss.zk.ui.Component;
|
||||||
|
import org.zkoss.zk.ui.Executions;
|
||||||
|
import org.zkoss.zk.ui.event.Event;
|
||||||
|
import org.zkoss.zul.Button;
|
||||||
|
import org.zkoss.zul.Textbox;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Administrador
|
||||||
|
*/
|
||||||
|
@Controller("editarTipoCorteController")
|
||||||
|
@Scope("prototype")
|
||||||
|
public class EditarTipoCorteController extends MyGenericForwardComposer {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private TipoCorteService tipoCorteService;
|
||||||
|
private TipoCorte tipoCorte;
|
||||||
|
private MyListbox tipoCorteList;
|
||||||
|
private Button btnApagar;
|
||||||
|
private MyTextbox txtNome;
|
||||||
|
private static Logger log = Logger.getLogger(EditarTipoCorteController.class);
|
||||||
|
|
||||||
|
public Button getBtnApagar() {
|
||||||
|
return btnApagar;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBtnApagar(Button btnApagar) {
|
||||||
|
this.btnApagar = btnApagar;
|
||||||
|
}
|
||||||
|
|
||||||
|
public TipoCorte getTipoCorte() {
|
||||||
|
return tipoCorte;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTipoCorte(TipoCorte tipoCorte) {
|
||||||
|
this.tipoCorte = tipoCorte;
|
||||||
|
}
|
||||||
|
|
||||||
|
public MyTextbox getTxtNome() {
|
||||||
|
return txtNome;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTxtNome(MyTextbox txtNome) {
|
||||||
|
this.txtNome = txtNome;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void doAfterCompose(Component comp) throws Exception {
|
||||||
|
super.doAfterCompose(comp);
|
||||||
|
|
||||||
|
tipoCorte = (TipoCorte) Executions.getCurrent().getArg().get("tipoCorte");
|
||||||
|
tipoCorteList = (MyListbox) Executions.getCurrent().getArg().get("tipoCorteList");
|
||||||
|
|
||||||
|
if (tipoCorte.getTipocorteId() == null) {
|
||||||
|
btnApagar.setVisible(Boolean.FALSE);
|
||||||
|
}
|
||||||
|
|
||||||
|
txtNome.focus();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onClick$btnSalvar(Event ev) throws InterruptedException {
|
||||||
|
txtNome.getValue();
|
||||||
|
|
||||||
|
try {
|
||||||
|
tipoCorte.setActivo(Boolean.TRUE);
|
||||||
|
tipoCorte.setFecmodif(Calendar.getInstance().getTime());
|
||||||
|
tipoCorte.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
|
||||||
|
|
||||||
|
List<TipoCorte> lsTipoCorte = tipoCorteService.buscar(tipoCorte.getDesctipo());
|
||||||
|
|
||||||
|
if (!lsTipoCorte.isEmpty()) {
|
||||||
|
Messagebox.show(
|
||||||
|
Labels.getLabel("MSG.Registro.Existe"),
|
||||||
|
Labels.getLabel("editarTipoCorteController.window.title"),
|
||||||
|
Messagebox.OK, Messagebox.EXCLAMATION);
|
||||||
|
} else {
|
||||||
|
if (tipoCorte.getTipocorteId() == null) {
|
||||||
|
tipoCorteService.suscribir(tipoCorte);
|
||||||
|
tipoCorteList.addItem(tipoCorte);
|
||||||
|
} else {
|
||||||
|
tipoCorteService.actualizacion(tipoCorte);
|
||||||
|
tipoCorteList.updateItem(tipoCorte);
|
||||||
|
}
|
||||||
|
|
||||||
|
Messagebox.show(
|
||||||
|
Labels.getLabel("editarTipoCorteController.MSG.suscribirOK"),
|
||||||
|
Labels.getLabel("editarTipoCorteController.window.title"),
|
||||||
|
Messagebox.OK, Messagebox.INFORMATION);
|
||||||
|
|
||||||
|
closeWindow();
|
||||||
|
}
|
||||||
|
} catch (Exception ex) {
|
||||||
|
log.error("editarTipoCorteController: " + ex);
|
||||||
|
Messagebox.show(
|
||||||
|
Labels.getLabel("MSG.Error"),
|
||||||
|
Labels.getLabel("editarTipoCorteController.window.title"),
|
||||||
|
Messagebox.OK, Messagebox.ERROR);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onClick$btnApagar(Event ev) {
|
||||||
|
try {
|
||||||
|
int resp = Messagebox.show(
|
||||||
|
Labels.getLabel("editarTipoCorteController.MSG.borrarPergunta"),
|
||||||
|
Labels.getLabel("editarTipoCorteController.window.title"),
|
||||||
|
Messagebox.YES | Messagebox.NO, Messagebox.QUESTION);
|
||||||
|
|
||||||
|
if (resp == Messagebox.YES) {
|
||||||
|
|
||||||
|
tipoCorteService.borrar(tipoCorte);
|
||||||
|
|
||||||
|
Messagebox.show(
|
||||||
|
Labels.getLabel("editarTipoCorteController.MSG.borrarOK"),
|
||||||
|
Labels.getLabel("editarTipoCorteController.window.title"),
|
||||||
|
Messagebox.OK, Messagebox.INFORMATION);
|
||||||
|
|
||||||
|
tipoCorteList.removeItem(tipoCorte);
|
||||||
|
|
||||||
|
closeWindow();
|
||||||
|
}
|
||||||
|
} catch (Exception ex) {
|
||||||
|
log.error(ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,268 @@
|
||||||
|
/*
|
||||||
|
* To change this template, choose Tools | Templates
|
||||||
|
* and open the template in the editor.
|
||||||
|
*/
|
||||||
|
package com.rjconsultores.ventaboletos.web.gui.controladores.catalogos;
|
||||||
|
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.CategoriaTipoPtoVta;
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.Categoria;
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.TipoPuntoVenta;
|
||||||
|
import com.rjconsultores.ventaboletos.service.CategoriaService;
|
||||||
|
import com.rjconsultores.ventaboletos.service.CategoriaTipoPtoVtaService;
|
||||||
|
import com.rjconsultores.ventaboletos.service.TipoPuntoVentaService;
|
||||||
|
import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado;
|
||||||
|
import com.rjconsultores.ventaboletos.utilerias.ApplicationProperties;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.MyGenericForwardComposer;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.MyListbox;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.MyTextbox;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.render.RenderCategoriaTipoPtoVta;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Calendar;
|
||||||
|
import java.util.List;
|
||||||
|
import org.apache.log4j.Logger;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.context.annotation.Scope;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.zkoss.util.resource.Labels;
|
||||||
|
import org.zkoss.zhtml.Messagebox;
|
||||||
|
import org.zkoss.zk.ui.Component;
|
||||||
|
import org.zkoss.zk.ui.Executions;
|
||||||
|
import org.zkoss.zk.ui.event.Event;
|
||||||
|
import org.zkoss.zul.Button;
|
||||||
|
import org.zkoss.zul.Combobox;
|
||||||
|
import org.zkoss.zul.Row;
|
||||||
|
import org.zkoss.zul.Textbox;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Administrador
|
||||||
|
*/
|
||||||
|
@Controller("editarTipoPuntoVentaController")
|
||||||
|
@Scope("prototype")
|
||||||
|
public class EditarTipoPuntoVentaController extends MyGenericForwardComposer {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private TipoPuntoVentaService tipoPuntoVentaService;
|
||||||
|
@Autowired
|
||||||
|
private CategoriaTipoPtoVtaService categoriaTipoPtoVtaService;
|
||||||
|
@Autowired
|
||||||
|
private CategoriaService categoriaService;
|
||||||
|
private List<CategoriaTipoPtoVta> lsCategoriaTipoPtoVta;
|
||||||
|
private List<Categoria> lsCategoria;
|
||||||
|
private MyListbox categoriaTipoPtoVtaList;
|
||||||
|
private TipoPuntoVenta tipoPuntoVenta;
|
||||||
|
private MyListbox tipoPuntoVentaList;
|
||||||
|
private MyTextbox txtNome;
|
||||||
|
private static Logger log = Logger.getLogger(EditarFormaPagoController.class);
|
||||||
|
private Button btnApagar;
|
||||||
|
private Row rowEquivalencia;
|
||||||
|
private Combobox cmbCategoria;
|
||||||
|
|
||||||
|
public Button getBtnApagar() {
|
||||||
|
return btnApagar;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBtnApagar(Button btnApagar) {
|
||||||
|
this.btnApagar = btnApagar;
|
||||||
|
}
|
||||||
|
|
||||||
|
public TipoPuntoVenta getTipoPuntoVenta() {
|
||||||
|
return tipoPuntoVenta;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTipoPuntoVenta(TipoPuntoVenta tipoPuntoVenta) {
|
||||||
|
this.tipoPuntoVenta = tipoPuntoVenta;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Textbox getTxtNome() {
|
||||||
|
return txtNome;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTxtNome(MyTextbox txtNome) {
|
||||||
|
this.txtNome = txtNome;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Row getRowEquivalencia() {
|
||||||
|
return rowEquivalencia;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRowEquivalencia(Row rowEquivalencia) {
|
||||||
|
this.rowEquivalencia = rowEquivalencia;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<Categoria> getLsCategoria() {
|
||||||
|
return lsCategoria;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLsCategoria(List<Categoria> lsCategoria) {
|
||||||
|
this.lsCategoria = lsCategoria;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<CategoriaTipoPtoVta> getLsCategoriaTipoPtoVta() {
|
||||||
|
return lsCategoriaTipoPtoVta;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLsCategoriaTipoPtoVta(List<CategoriaTipoPtoVta> lsCategoriaTipoPtoVta) {
|
||||||
|
this.lsCategoriaTipoPtoVta = lsCategoriaTipoPtoVta;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void doAfterCompose(Component comp) throws Exception {
|
||||||
|
|
||||||
|
lsCategoria = categoriaService.obtenerTodos();
|
||||||
|
|
||||||
|
super.doAfterCompose(comp);
|
||||||
|
|
||||||
|
tipoPuntoVenta = (TipoPuntoVenta) Executions.getCurrent().getArg().get("tipoPuntoVenta");
|
||||||
|
tipoPuntoVentaList = (MyListbox) Executions.getCurrent().getArg().get("tipoPuntoVentaList");
|
||||||
|
|
||||||
|
categoriaTipoPtoVtaList.setItemRenderer(new RenderCategoriaTipoPtoVta());
|
||||||
|
lsCategoriaTipoPtoVta = new ArrayList<CategoriaTipoPtoVta>();
|
||||||
|
categoriaTipoPtoVtaList.setData(lsCategoriaTipoPtoVta);
|
||||||
|
|
||||||
|
if (tipoPuntoVenta.getTipoptovtaId() == null) {
|
||||||
|
btnApagar.setVisible(Boolean.FALSE);
|
||||||
|
} else {
|
||||||
|
lsCategoriaTipoPtoVta = categoriaTipoPtoVtaService.buscarPorPuntoVenta(tipoPuntoVenta);
|
||||||
|
categoriaTipoPtoVtaList.setData(lsCategoriaTipoPtoVta);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!ApplicationProperties.getInstance().mostrarEquivalencia()) {
|
||||||
|
rowEquivalencia.setVisible(Boolean.FALSE);
|
||||||
|
}
|
||||||
|
|
||||||
|
txtNome.focus();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onClick$btnSalvar(Event ev) throws InterruptedException {
|
||||||
|
txtNome.getText();
|
||||||
|
|
||||||
|
try {
|
||||||
|
|
||||||
|
tipoPuntoVenta.setActivo(Boolean.TRUE);
|
||||||
|
tipoPuntoVenta.setFecmodif(Calendar.getInstance().getTime());
|
||||||
|
tipoPuntoVenta.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
|
||||||
|
tipoPuntoVenta.setLsCategoriaTipoPtoVta(lsCategoriaTipoPtoVta);
|
||||||
|
|
||||||
|
List<TipoPuntoVenta> lsTipoPunto = tipoPuntoVentaService.buscar(tipoPuntoVenta.getDesctipo());
|
||||||
|
|
||||||
|
if (!lsTipoPunto.isEmpty() && tipoPuntoVenta.getTipoptovtaId() == null) {
|
||||||
|
Messagebox.show(
|
||||||
|
Labels.getLabel("MSG.Registro.Existe"),
|
||||||
|
Labels.getLabel("editarTipoPuntoVentaController.window.title"),
|
||||||
|
Messagebox.OK, Messagebox.EXCLAMATION);
|
||||||
|
} else {
|
||||||
|
if (tipoPuntoVenta.getTipoptovtaId() == null) {
|
||||||
|
tipoPuntoVentaService.suscribir(tipoPuntoVenta);
|
||||||
|
tipoPuntoVentaList.addItem(tipoPuntoVenta);
|
||||||
|
} else {
|
||||||
|
tipoPuntoVentaService.actualizacion(tipoPuntoVenta);
|
||||||
|
tipoPuntoVentaList.updateItem(tipoPuntoVenta);
|
||||||
|
}
|
||||||
|
|
||||||
|
Messagebox.show(
|
||||||
|
Labels.getLabel("editarTipoPuntoVentaController.MSG.suscribirOK"),
|
||||||
|
Labels.getLabel("editarTipoPuntoVentaController.window.title"),
|
||||||
|
Messagebox.OK, Messagebox.INFORMATION);
|
||||||
|
|
||||||
|
closeWindow();
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch (Exception ex) {
|
||||||
|
log.error("editarTipoPuntoVentaController :" + ex);
|
||||||
|
Messagebox.show(
|
||||||
|
Labels.getLabel("MSG.Error"),
|
||||||
|
Labels.getLabel("editarTipoPuntoVentaController.window.title"),
|
||||||
|
Messagebox.OK, Messagebox.ERROR);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onClick$btnApagar(Event ev) {
|
||||||
|
try {
|
||||||
|
int resp = Messagebox.show(
|
||||||
|
Labels.getLabel("editarTipoPuntoVentaController.MSG.borrarPergunta"),
|
||||||
|
Labels.getLabel("editarTipoPuntoVentaController.window.title"),
|
||||||
|
Messagebox.YES | Messagebox.NO, Messagebox.QUESTION);
|
||||||
|
|
||||||
|
if (resp == Messagebox.YES) {
|
||||||
|
tipoPuntoVentaService.borrar(tipoPuntoVenta);
|
||||||
|
|
||||||
|
Messagebox.show(
|
||||||
|
Labels.getLabel("editarTipoPuntoVentaController.MSG.borrarOK"),
|
||||||
|
Labels.getLabel("editarTipoPuntoVentaController.window.title"),
|
||||||
|
Messagebox.OK, Messagebox.INFORMATION);
|
||||||
|
|
||||||
|
tipoPuntoVentaList.removeItem(tipoPuntoVenta);
|
||||||
|
|
||||||
|
closeWindow();
|
||||||
|
}
|
||||||
|
} catch (Exception ex) {
|
||||||
|
log.error(ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onClick$btnAdicionarCategoriaTipoPtoVta(Event ev) throws InterruptedException {
|
||||||
|
cmbCategoria.getValue();
|
||||||
|
|
||||||
|
try {
|
||||||
|
Categoria cat = (Categoria) cmbCategoria.getSelectedItem().getValue();
|
||||||
|
Boolean achou = Boolean.FALSE;
|
||||||
|
for (CategoriaTipoPtoVta cds : lsCategoriaTipoPtoVta) {
|
||||||
|
if (cds.getCategoria() == cat) {
|
||||||
|
achou = Boolean.TRUE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!achou) {
|
||||||
|
CategoriaTipoPtoVta cd = new CategoriaTipoPtoVta();
|
||||||
|
cd.setActivo(Boolean.TRUE);
|
||||||
|
cd.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
|
||||||
|
cd.setFecmodif(Calendar.getInstance().getTime());
|
||||||
|
cd.setCategoria(cat);
|
||||||
|
cd.setTipoPuntoVenta(tipoPuntoVenta);
|
||||||
|
|
||||||
|
lsCategoriaTipoPtoVta.add(cd);
|
||||||
|
List<CategoriaTipoPtoVta> lsAux = new ArrayList<CategoriaTipoPtoVta>();
|
||||||
|
|
||||||
|
for (CategoriaTipoPtoVta c : lsCategoriaTipoPtoVta) {
|
||||||
|
if (c.getActivo()) {
|
||||||
|
lsAux.add(c);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
categoriaTipoPtoVtaList.setData(lsAux);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
Messagebox.show(
|
||||||
|
Labels.getLabel("MSG.Registro.Existe"),
|
||||||
|
Labels.getLabel("editarTipoPuntoVentaController.window.title"),
|
||||||
|
Messagebox.OK, Messagebox.EXCLAMATION);
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch (Exception ex) {
|
||||||
|
log.error(ex);
|
||||||
|
Messagebox.show(
|
||||||
|
Labels.getLabel("MSG.Error"),
|
||||||
|
Labels.getLabel("editarTipoPuntoVentaController.window.title"),
|
||||||
|
Messagebox.OK, Messagebox.ERROR);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onClick$btnRemoverCategoriaTipoPtoVta(Event ev) {
|
||||||
|
CategoriaTipoPtoVta cd = (CategoriaTipoPtoVta) categoriaTipoPtoVtaList.getSelected();
|
||||||
|
|
||||||
|
if (cd != null) {
|
||||||
|
|
||||||
|
cd.setActivo(Boolean.FALSE);
|
||||||
|
cd.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
|
||||||
|
cd.setFecmodif(Calendar.getInstance().getTime());
|
||||||
|
cd.setTipoPuntoVenta(tipoPuntoVenta);
|
||||||
|
|
||||||
|
if (cd.getCategoriatipoptovtaId() != null) {
|
||||||
|
categoriaTipoPtoVtaService.borrarFisico(cd);
|
||||||
|
}
|
||||||
|
|
||||||
|
lsCategoriaTipoPtoVta.remove(cd);
|
||||||
|
categoriaTipoPtoVtaList.setData(lsCategoriaTipoPtoVta);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,161 @@
|
||||||
|
/*
|
||||||
|
* To change this template, choose Tools | Templates
|
||||||
|
* and open the template in the editor.
|
||||||
|
*/
|
||||||
|
package com.rjconsultores.ventaboletos.web.gui.controladores.catalogos;
|
||||||
|
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.TipoServicio;
|
||||||
|
import com.rjconsultores.ventaboletos.service.TipoServicioService;
|
||||||
|
import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.MyGenericForwardComposer;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.MyListbox;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.MyTextbox;
|
||||||
|
import org.apache.log4j.Logger;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.context.annotation.Scope;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import java.util.Calendar;
|
||||||
|
import java.util.List;
|
||||||
|
import org.zkoss.util.resource.Labels;
|
||||||
|
import org.zkoss.zk.ui.Component;
|
||||||
|
import org.zkoss.zk.ui.Executions;
|
||||||
|
import org.zkoss.zk.ui.event.Event;
|
||||||
|
import org.zkoss.zul.Button;
|
||||||
|
import org.zkoss.zul.Messagebox;
|
||||||
|
import org.zkoss.zul.Textbox;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Rafius
|
||||||
|
*/
|
||||||
|
@Controller("editarTipoServicioController")
|
||||||
|
@Scope("prototype")
|
||||||
|
public class EditarTipoServicioController extends MyGenericForwardComposer {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private TipoServicioService tipoServicioService;
|
||||||
|
private TipoServicio tipoServicio;
|
||||||
|
private MyListbox tipoServicioList;
|
||||||
|
private static Logger log = Logger.getLogger(EditarTipoServicioController.class);
|
||||||
|
private MyTextbox txtNome;
|
||||||
|
private Button btnApagar;
|
||||||
|
|
||||||
|
public Button getBtnApagar() {
|
||||||
|
return btnApagar;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBtnApagar(Button btnApagar) {
|
||||||
|
this.btnApagar = btnApagar;
|
||||||
|
}
|
||||||
|
|
||||||
|
public MyTextbox getTxtNome() {
|
||||||
|
return txtNome;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTxtNome(MyTextbox txtNome) {
|
||||||
|
this.txtNome = txtNome;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void doAfterCompose(Component comp) throws Exception {
|
||||||
|
super.doAfterCompose(comp);
|
||||||
|
|
||||||
|
tipoServicio = (TipoServicio) Executions.getCurrent().getArg().get("tipoServicio");
|
||||||
|
tipoServicioList = (MyListbox) Executions.getCurrent().getArg().get("tipoServicioList");
|
||||||
|
|
||||||
|
if (tipoServicio.getTiposervicioId() == null) {
|
||||||
|
btnApagar.setVisible(Boolean.FALSE);
|
||||||
|
}
|
||||||
|
|
||||||
|
txtNome.focus();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onClick$btnSalvar(Event ev) throws InterruptedException {
|
||||||
|
txtNome.getValue();
|
||||||
|
try {
|
||||||
|
|
||||||
|
tipoServicio.setActivo(Boolean.TRUE);
|
||||||
|
tipoServicio.setFecmodif(Calendar.getInstance().getTime());
|
||||||
|
tipoServicio.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
|
||||||
|
|
||||||
|
List<TipoServicio> lsTipoServicio = tipoServicioService.buscar(tipoServicio.getDescservicio());
|
||||||
|
|
||||||
|
if (!lsTipoServicio.isEmpty() && tipoServicio.getTiposervicioId() == null) {
|
||||||
|
Messagebox.show(
|
||||||
|
Labels.getLabel("MSG.Registro.Existe"),
|
||||||
|
Labels.getLabel("editarTipoServicioController.window.title"),
|
||||||
|
Messagebox.OK, Messagebox.EXCLAMATION);
|
||||||
|
} else {
|
||||||
|
if (tipoServicio.getTiposervicioId() == null) {
|
||||||
|
tipoServicioService.suscribir(tipoServicio);
|
||||||
|
tipoServicioList.addItem(tipoServicio);
|
||||||
|
} else {
|
||||||
|
tipoServicioService.actualizacion(tipoServicio);
|
||||||
|
tipoServicioList.updateItem(tipoServicio);
|
||||||
|
}
|
||||||
|
|
||||||
|
Messagebox.show(
|
||||||
|
Labels.getLabel("editarTipoServicioController.MSG.suscribirOK"),
|
||||||
|
Labels.getLabel("editarTipoServicioController.window.title"),
|
||||||
|
Messagebox.OK, Messagebox.INFORMATION);
|
||||||
|
|
||||||
|
closeWindow();
|
||||||
|
}
|
||||||
|
} catch (Exception ex) {
|
||||||
|
log.error("Exception ao suscribir TipoServicio: " + ex);
|
||||||
|
Messagebox.show(
|
||||||
|
Labels.getLabel("MSG.Error"),
|
||||||
|
Labels.getLabel("editarTipoServicioController.window.title"),
|
||||||
|
Messagebox.OK, Messagebox.ERROR);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onClick$btnApagar(Event ev) {
|
||||||
|
try {
|
||||||
|
int resp = Messagebox.show(
|
||||||
|
Labels.getLabel("editarTipoServicioController.MSG.borrarPergunta"),
|
||||||
|
Labels.getLabel("editarTipoServicioController.window.title"),
|
||||||
|
Messagebox.YES | Messagebox.NO, Messagebox.QUESTION);
|
||||||
|
|
||||||
|
if (resp == Messagebox.YES) {
|
||||||
|
|
||||||
|
tipoServicioService.borrar(tipoServicio);
|
||||||
|
|
||||||
|
Messagebox.show(
|
||||||
|
Labels.getLabel("editarTipoServicioController.MSG.borrarOK"),
|
||||||
|
Labels.getLabel("editarTipoServicioController.window.title"),
|
||||||
|
Messagebox.OK, Messagebox.INFORMATION);
|
||||||
|
|
||||||
|
tipoServicioList.removeItem(tipoServicio);
|
||||||
|
|
||||||
|
closeWindow();
|
||||||
|
}
|
||||||
|
} catch (Exception ex) {
|
||||||
|
log.error(ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public TipoServicio getTipoServicio() {
|
||||||
|
return tipoServicio;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTipoServicio(TipoServicio tipoServicio) {
|
||||||
|
this.tipoServicio = tipoServicio;
|
||||||
|
}
|
||||||
|
|
||||||
|
public MyListbox getTipoServicioList() {
|
||||||
|
return tipoServicioList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTipoServicioList(MyListbox tipoServicioList) {
|
||||||
|
this.tipoServicioList = tipoServicioList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public TipoServicioService getTipoServicioService() {
|
||||||
|
return tipoServicioService;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTipoServicioService(TipoServicioService tipoServicioService) {
|
||||||
|
this.tipoServicioService = tipoServicioService;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,189 @@
|
||||||
|
/*
|
||||||
|
* To change this template, choose Tools | Templates
|
||||||
|
* and open the template in the editor.
|
||||||
|
*/
|
||||||
|
package com.rjconsultores.ventaboletos.web.gui.controladores.catalogos;
|
||||||
|
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.TipoVenta;
|
||||||
|
import com.rjconsultores.ventaboletos.service.TipoVentaService;
|
||||||
|
import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.MyGenericForwardComposer;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.MyListbox;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.MyTextbox;
|
||||||
|
import org.apache.log4j.Logger;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.context.annotation.Scope;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import java.util.Calendar;
|
||||||
|
import java.util.List;
|
||||||
|
import org.zkoss.util.resource.Labels;
|
||||||
|
import org.zkoss.zk.ui.Component;
|
||||||
|
import org.zkoss.zk.ui.Executions;
|
||||||
|
import org.zkoss.zk.ui.event.Event;
|
||||||
|
import org.zkoss.zul.Button;
|
||||||
|
import org.zkoss.zul.Messagebox;
|
||||||
|
import org.zkoss.zul.Textbox;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Rafius
|
||||||
|
*/
|
||||||
|
@Controller("editarTipoVentaController")
|
||||||
|
@Scope("prototype")
|
||||||
|
public class EditarTipoVentaController extends MyGenericForwardComposer {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private TipoVentaService tipoVentaService;
|
||||||
|
private TipoVenta tipoVenta;
|
||||||
|
private MyListbox tipoVentaList;
|
||||||
|
private static Logger log = Logger.getLogger(EditarTipoVentaController.class);
|
||||||
|
private MyTextbox txtNome;
|
||||||
|
private Button btnApagar;
|
||||||
|
private Button btnSalvar;
|
||||||
|
|
||||||
|
public Button getBtnApagar() {
|
||||||
|
return btnApagar;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBtnApagar(Button btnApagar) {
|
||||||
|
this.btnApagar = btnApagar;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Textbox getTxtNome() {
|
||||||
|
return txtNome;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTxtNome(MyTextbox txtNome) {
|
||||||
|
this.txtNome = txtNome;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void doAfterCompose(Component comp) throws Exception {
|
||||||
|
super.doAfterCompose(comp);
|
||||||
|
|
||||||
|
TipoVenta tp = (TipoVenta) Executions.getCurrent().getArg().get("tipoVenta");
|
||||||
|
tipoVenta = (tp.getTipoventaId() == null) ? tp : tipoVentaService.obtenerID(tp.getTipoventaId());
|
||||||
|
tipoVentaList = (MyListbox) Executions.getCurrent().getArg().get("tipoVentaList");
|
||||||
|
|
||||||
|
if (tipoVenta.getDesctipoventa() != null) {
|
||||||
|
txtNome.setValue(tipoVenta.getDesctipoventa());
|
||||||
|
}
|
||||||
|
if (tipoVenta.getTipoventaId() == null) {
|
||||||
|
btnApagar.setVisible(Boolean.FALSE);
|
||||||
|
} else {
|
||||||
|
if (tipoVenta.getTipoventaId() <= 12) {
|
||||||
|
btnApagar.setVisible(Boolean.FALSE);
|
||||||
|
btnSalvar.setVisible(Boolean.FALSE);
|
||||||
|
txtNome.setDisabled(Boolean.TRUE);
|
||||||
|
|
||||||
|
Messagebox.show(
|
||||||
|
Labels.getLabel("MSG.noEditabled"),
|
||||||
|
Labels.getLabel("editarTipoVentaController.window.title"),
|
||||||
|
Messagebox.OK, Messagebox.INFORMATION);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
txtNome.focus();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onClick$btnSalvar(Event ev) throws InterruptedException {
|
||||||
|
txtNome.getValue();
|
||||||
|
try {
|
||||||
|
tipoVenta.setDesctipoventa(txtNome.getValue());
|
||||||
|
tipoVenta.setActivo(Boolean.TRUE);
|
||||||
|
tipoVenta.setFecmodif(Calendar.getInstance().getTime());
|
||||||
|
tipoVenta.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
|
||||||
|
|
||||||
|
List<TipoVenta> lsTipoVenta = tipoVentaService.buscar(tipoVenta.getDesctipoventa());
|
||||||
|
|
||||||
|
boolean podeSalvar = false;
|
||||||
|
if (lsTipoVenta.isEmpty()) {
|
||||||
|
podeSalvar = true;
|
||||||
|
} else {
|
||||||
|
for (TipoVenta m : lsTipoVenta) {
|
||||||
|
if (m.getTipoventaId().equals(tipoVenta.getTipoventaId())) {
|
||||||
|
podeSalvar = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!podeSalvar) {
|
||||||
|
Messagebox.show(
|
||||||
|
Labels.getLabel("MSG.Registro.Existe"),
|
||||||
|
Labels.getLabel("editarTipoVentaController.window.title"),
|
||||||
|
Messagebox.OK, Messagebox.EXCLAMATION);
|
||||||
|
} else {
|
||||||
|
|
||||||
|
if (tipoVenta.getTipoventaId() == null) {
|
||||||
|
tipoVentaService.suscribir(tipoVenta);
|
||||||
|
tipoVentaList.addItem(tipoVenta);
|
||||||
|
} else {
|
||||||
|
tipoVentaService.actualizacion(tipoVenta);
|
||||||
|
tipoVentaList.updateItem(tipoVenta);
|
||||||
|
}
|
||||||
|
|
||||||
|
Messagebox.show(
|
||||||
|
Labels.getLabel("editarTipoVentaController.MSG.suscribirOK"),
|
||||||
|
Labels.getLabel("editarTipoVentaController.window.title"),
|
||||||
|
Messagebox.OK, Messagebox.INFORMATION);
|
||||||
|
|
||||||
|
closeWindow();
|
||||||
|
}
|
||||||
|
} catch (Exception ex) {
|
||||||
|
log.error("Suscribir TipoVenta: " + ex);
|
||||||
|
Messagebox.show(
|
||||||
|
Labels.getLabel("MSG.Error"),
|
||||||
|
Labels.getLabel("editarTipoVentaController.window.title"),
|
||||||
|
Messagebox.OK, Messagebox.ERROR);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onClick$btnApagar(Event ev) {
|
||||||
|
try {
|
||||||
|
int resp = Messagebox.show(
|
||||||
|
Labels.getLabel("editarTipoVentaController.MSG.borrarPergunta"),
|
||||||
|
Labels.getLabel("editarTipoVentaController.window.title"),
|
||||||
|
Messagebox.YES | Messagebox.NO, Messagebox.QUESTION);
|
||||||
|
|
||||||
|
if (resp == Messagebox.YES) {
|
||||||
|
|
||||||
|
tipoVentaService.borrar(tipoVenta);
|
||||||
|
|
||||||
|
Messagebox.show(
|
||||||
|
Labels.getLabel("editarTipoVentaController.MSG.borrarOK"),
|
||||||
|
Labels.getLabel("editarTipoVentaController.window.title"),
|
||||||
|
Messagebox.OK, Messagebox.INFORMATION);
|
||||||
|
|
||||||
|
tipoVentaList.removeItem(tipoVenta);
|
||||||
|
|
||||||
|
closeWindow();
|
||||||
|
}
|
||||||
|
} catch (Exception ex) {
|
||||||
|
log.error(ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public TipoVenta getTipoVenta() {
|
||||||
|
return tipoVenta;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTipoVenta(TipoVenta tipoVenta) {
|
||||||
|
this.tipoVenta = tipoVenta;
|
||||||
|
}
|
||||||
|
|
||||||
|
public MyListbox getTipoVentaList() {
|
||||||
|
return tipoVentaList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTipoVentaList(MyListbox tipoVentaList) {
|
||||||
|
this.tipoVentaList = tipoVentaList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public TipoVentaService getTipoVentaService() {
|
||||||
|
return tipoVentaService;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTipoVentaService(TipoVentaService tipoVentaService) {
|
||||||
|
this.tipoVentaService = tipoVentaService;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,157 @@
|
||||||
|
/*
|
||||||
|
* To change this template, choose Tools | Templates
|
||||||
|
* and open the template in the editor.
|
||||||
|
*/
|
||||||
|
package com.rjconsultores.ventaboletos.web.gui.controladores.catalogos;
|
||||||
|
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.Turno;
|
||||||
|
import com.rjconsultores.ventaboletos.service.TurnoService;
|
||||||
|
import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.MyGenericForwardComposer;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.MyListbox;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.MyTextbox;
|
||||||
|
import java.util.Calendar;
|
||||||
|
import java.util.List;
|
||||||
|
import org.apache.log4j.Logger;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.context.annotation.Scope;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.zkoss.util.resource.Labels;
|
||||||
|
import org.zkoss.zhtml.Messagebox;
|
||||||
|
import org.zkoss.zk.ui.Component;
|
||||||
|
import org.zkoss.zk.ui.Executions;
|
||||||
|
import org.zkoss.zk.ui.event.Event;
|
||||||
|
import org.zkoss.zul.Button;
|
||||||
|
import org.zkoss.zul.Textbox;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Administrador
|
||||||
|
*/
|
||||||
|
@Controller("editarTurnoController")
|
||||||
|
@Scope("prototype")
|
||||||
|
public class EditarTurnoController extends MyGenericForwardComposer {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private TurnoService turnoService;
|
||||||
|
private Turno turno;
|
||||||
|
private MyListbox turnoList;
|
||||||
|
private Button btnApagar;
|
||||||
|
private MyTextbox txtNome;
|
||||||
|
private static Logger log = Logger.getLogger(EditarTurnoController.class);
|
||||||
|
|
||||||
|
public Button getBtnApagar() {
|
||||||
|
return btnApagar;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBtnApagar(Button btnApagar) {
|
||||||
|
this.btnApagar = btnApagar;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Turno getTurno() {
|
||||||
|
return turno;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTurno(Turno turno) {
|
||||||
|
this.turno = turno;
|
||||||
|
}
|
||||||
|
|
||||||
|
public MyTextbox getTxtNome() {
|
||||||
|
return txtNome;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTxtNome(MyTextbox txtNome) {
|
||||||
|
this.txtNome = txtNome;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void doAfterCompose(Component comp) throws Exception {
|
||||||
|
super.doAfterCompose(comp);
|
||||||
|
|
||||||
|
turno = (Turno) Executions.getCurrent().getArg().get("turno");
|
||||||
|
turnoList = (MyListbox) Executions.getCurrent().getArg().get("turnoList");
|
||||||
|
|
||||||
|
if (turno.getTurnoId() == null) {
|
||||||
|
btnApagar.setVisible(Boolean.FALSE);
|
||||||
|
}
|
||||||
|
|
||||||
|
txtNome.focus();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onClick$btnSalvar(Event ev) throws InterruptedException {
|
||||||
|
txtNome.getValue();
|
||||||
|
|
||||||
|
try {
|
||||||
|
turno.setActivo(Boolean.TRUE);
|
||||||
|
turno.setFecmodif(Calendar.getInstance().getTime());
|
||||||
|
turno.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
|
||||||
|
|
||||||
|
List<Turno> lsTurno = turnoService.buscar(turno.getDescturno());
|
||||||
|
|
||||||
|
boolean podeSalvar = false;
|
||||||
|
if (lsTurno.isEmpty()) {
|
||||||
|
podeSalvar = true;
|
||||||
|
} else {
|
||||||
|
for (Turno t : lsTurno) {
|
||||||
|
if (t.getTurnoId().equals(turno.getTurnoId())) {
|
||||||
|
podeSalvar = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (!podeSalvar) {
|
||||||
|
Messagebox.show(
|
||||||
|
Labels.getLabel("MSG.Registro.Existe"),
|
||||||
|
Labels.getLabel("editarTurnoController.window.title"),
|
||||||
|
Messagebox.OK, Messagebox.EXCLAMATION);
|
||||||
|
} else {
|
||||||
|
if (turno.getTurnoId() == null) {
|
||||||
|
turnoService.suscribir(turno);
|
||||||
|
turnoList.addItem(turno);
|
||||||
|
} else {
|
||||||
|
turnoService.actualizacion(turno);
|
||||||
|
turnoList.updateItem(turno);
|
||||||
|
}
|
||||||
|
|
||||||
|
Messagebox.show(
|
||||||
|
Labels.getLabel("editarTurnoController.MSG.suscribirOK"),
|
||||||
|
Labels.getLabel("editarTurnoController.window.title"),
|
||||||
|
Messagebox.OK, Messagebox.INFORMATION);
|
||||||
|
|
||||||
|
closeWindow();
|
||||||
|
}
|
||||||
|
} catch (Exception ex) {
|
||||||
|
log.error("editarTurnoController: " + ex);
|
||||||
|
Messagebox.show(
|
||||||
|
Labels.getLabel("MSG.Error"),
|
||||||
|
Labels.getLabel("editarTurnoController.window.title"),
|
||||||
|
Messagebox.OK, Messagebox.ERROR);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onClick$btnApagar(Event ev) {
|
||||||
|
try {
|
||||||
|
int resp = Messagebox.show(
|
||||||
|
Labels.getLabel("editarTurnoController.MSG.borrarPergunta"),
|
||||||
|
Labels.getLabel("editarTurnoController.window.title"),
|
||||||
|
Messagebox.YES | Messagebox.NO, Messagebox.QUESTION);
|
||||||
|
|
||||||
|
if (resp == Messagebox.YES) {
|
||||||
|
|
||||||
|
turnoService.borrar(turno);
|
||||||
|
|
||||||
|
Messagebox.show(
|
||||||
|
Labels.getLabel("editarTurnoController.MSG.borrarOK"),
|
||||||
|
Labels.getLabel("editarTurnoController.window.title"),
|
||||||
|
Messagebox.OK, Messagebox.INFORMATION);
|
||||||
|
|
||||||
|
turnoList.removeItem(turno);
|
||||||
|
|
||||||
|
closeWindow();
|
||||||
|
}
|
||||||
|
} catch (Exception ex) {
|
||||||
|
log.error(ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,246 @@
|
||||||
|
/*
|
||||||
|
* To change this template, choose Tools | Templates
|
||||||
|
* and open the template in the editor.
|
||||||
|
*/
|
||||||
|
package com.rjconsultores.ventaboletos.web.gui.controladores.configuracioneccomerciales;
|
||||||
|
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.AlertaCtrl;
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.ClaseServicio;
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.Parada;
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.Ruta;
|
||||||
|
import com.rjconsultores.ventaboletos.service.ClaseServicioService;
|
||||||
|
import com.rjconsultores.ventaboletos.service.RutaService;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.MyGenericForwardComposer;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.MyListbox;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.paginacion.HibernateSearchObject;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.paginacion.PagedListWrapper;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.render.RenderAlertaCtrl;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.context.annotation.Scope;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.zkoss.util.resource.Labels;
|
||||||
|
import org.zkoss.zhtml.Messagebox;
|
||||||
|
import org.zkoss.zk.ui.Component;
|
||||||
|
import org.zkoss.zk.ui.event.Event;
|
||||||
|
import org.zkoss.zk.ui.event.EventListener;
|
||||||
|
import org.zkoss.zkplus.databind.BindingListModelList;
|
||||||
|
import org.zkoss.zul.Combobox;
|
||||||
|
import org.zkoss.zul.Comboitem;
|
||||||
|
import org.zkoss.zul.Intbox;
|
||||||
|
import org.zkoss.zul.Paging;
|
||||||
|
import org.zkoss.zul.Radio;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Administrador
|
||||||
|
*/
|
||||||
|
@Controller("busquedaAlertaCtrlController")
|
||||||
|
@Scope("prototype")
|
||||||
|
public class BusquedaAlertaCtrlController extends MyGenericForwardComposer {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private transient PagedListWrapper<AlertaCtrl> plwAlertaCtrl;
|
||||||
|
@Autowired
|
||||||
|
private RutaService rutaService;
|
||||||
|
@Autowired
|
||||||
|
private ClaseServicioService claseServicioService;
|
||||||
|
private List<ClaseServicio> lsClaseServicio;
|
||||||
|
private MyListbox alertaCtrlList;
|
||||||
|
private Paging pagingAlertaCtrl;
|
||||||
|
private Combobox cmbRuta;
|
||||||
|
private Combobox cmbOrigem;
|
||||||
|
private Combobox cmbDestino;
|
||||||
|
private Combobox cmbClaseServicio;
|
||||||
|
private List<Ruta> lsRuta;
|
||||||
|
private Intbox txtIdCorrida;
|
||||||
|
private Radio rdAlta;
|
||||||
|
private Radio rdBaja;
|
||||||
|
private Radio rdAmbas;
|
||||||
|
|
||||||
|
public MyListbox getAlertaCtrlList() {
|
||||||
|
return alertaCtrlList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAlertaCtrlList(MyListbox alertaCtrlList) {
|
||||||
|
this.alertaCtrlList = alertaCtrlList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Combobox getCmbClaseServicio() {
|
||||||
|
return cmbClaseServicio;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCmbClaseServicio(Combobox cmbClaseServicio) {
|
||||||
|
this.cmbClaseServicio = cmbClaseServicio;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Combobox getCmbDestino() {
|
||||||
|
return cmbDestino;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCmbDestino(Combobox cmbDestino) {
|
||||||
|
this.cmbDestino = cmbDestino;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Combobox getCmbOrigem() {
|
||||||
|
return cmbOrigem;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCmbOrigem(Combobox cmbOrigem) {
|
||||||
|
this.cmbOrigem = cmbOrigem;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Combobox getCmbRuta() {
|
||||||
|
return cmbRuta;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCmbRuta(Combobox cmbRuta) {
|
||||||
|
this.cmbRuta = cmbRuta;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<Ruta> getLsRuta() {
|
||||||
|
return lsRuta;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLsRuta(List<Ruta> lsRuta) {
|
||||||
|
this.lsRuta = lsRuta;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Paging getPagingAlertaCtrl() {
|
||||||
|
return pagingAlertaCtrl;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPagingAlertaCtrl(Paging pagingAlertaCtrl) {
|
||||||
|
this.pagingAlertaCtrl = pagingAlertaCtrl;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Intbox getTxtIdCorrida() {
|
||||||
|
return txtIdCorrida;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTxtIdCorrida(Intbox txtIdCorrida) {
|
||||||
|
this.txtIdCorrida = txtIdCorrida;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void doAfterCompose(Component comp) throws Exception {
|
||||||
|
super.doAfterCompose(comp);
|
||||||
|
|
||||||
|
lsRuta = new ArrayList<Ruta>();
|
||||||
|
|
||||||
|
alertaCtrlList.setItemRenderer(new RenderAlertaCtrl());
|
||||||
|
alertaCtrlList.addEventListener("onDoubleClick", new EventListener() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onEvent(Event event) throws Exception {
|
||||||
|
AlertaCtrl c = (AlertaCtrl) alertaCtrlList.getSelected();
|
||||||
|
verAlertaCtrl(c);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
refreshLista();
|
||||||
|
|
||||||
|
lsClaseServicio = claseServicioService.obtenerTodos();
|
||||||
|
BindingListModelList modelClaseServicio = new BindingListModelList(lsClaseServicio, true);
|
||||||
|
cmbClaseServicio.setModel(modelClaseServicio);
|
||||||
|
|
||||||
|
cmbClaseServicio.focus();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void verAlertaCtrl(AlertaCtrl a) {
|
||||||
|
if (a == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Map args = new HashMap();
|
||||||
|
args.put("alertaCtrl", a);
|
||||||
|
args.put("alertaCtrlList", alertaCtrlList);
|
||||||
|
|
||||||
|
openWindow("/gui/configuraciones_comerciales/editarAlertaCtrl.zul",
|
||||||
|
Labels.getLabel("busquedaAlertaCtrlController.window.title"), args, MODAL);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void refreshLista() {
|
||||||
|
HibernateSearchObject<AlertaCtrl> alertaCtrlBusqueda =
|
||||||
|
new HibernateSearchObject<AlertaCtrl>(AlertaCtrl.class,
|
||||||
|
pagingAlertaCtrl.getPageSize());
|
||||||
|
alertaCtrlBusqueda.addFilterEqual("activo", Boolean.TRUE);
|
||||||
|
|
||||||
|
Comboitem cbiRuta = cmbRuta.getSelectedItem();
|
||||||
|
if (cbiRuta != null) {
|
||||||
|
Ruta ruta = (Ruta) cbiRuta.getValue();
|
||||||
|
alertaCtrlBusqueda.addFilterEqual("ruta", ruta);
|
||||||
|
}
|
||||||
|
|
||||||
|
Comboitem cbiOrigem = cmbOrigem.getSelectedItem();
|
||||||
|
if (cbiOrigem != null) {
|
||||||
|
Parada origem = (Parada) cbiOrigem.getValue();
|
||||||
|
alertaCtrlBusqueda.addFilterEqual("origem", origem);
|
||||||
|
}
|
||||||
|
|
||||||
|
Comboitem cbiDestino = cmbDestino.getSelectedItem();
|
||||||
|
if (cbiDestino != null) {
|
||||||
|
Parada destino = (Parada) cbiDestino.getValue();
|
||||||
|
alertaCtrlBusqueda.addFilterEqual("destino", destino);
|
||||||
|
}
|
||||||
|
|
||||||
|
Comboitem cbiClaseServicio = cmbClaseServicio.getSelectedItem();
|
||||||
|
if (cbiClaseServicio != null) {
|
||||||
|
ClaseServicio claseServicio = (ClaseServicio) cbiClaseServicio.getValue();
|
||||||
|
alertaCtrlBusqueda.addFilterEqual("claseServicio", claseServicio);
|
||||||
|
}
|
||||||
|
|
||||||
|
Integer idCorrida = txtIdCorrida.getValue();
|
||||||
|
if (idCorrida != null) {
|
||||||
|
alertaCtrlBusqueda.addFilterEqual("corrida.id.corridaId", idCorrida);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (rdAlta.isChecked()) {
|
||||||
|
alertaCtrlBusqueda.addFilterNotNull("porcalta");
|
||||||
|
alertaCtrlBusqueda.addFilterNull("porcbaja");
|
||||||
|
} else if (rdBaja.isChecked()) {
|
||||||
|
alertaCtrlBusqueda.addFilterNotNull("porcbaja");
|
||||||
|
alertaCtrlBusqueda.addFilterNull("porcalta");
|
||||||
|
}
|
||||||
|
|
||||||
|
plwAlertaCtrl.init(alertaCtrlBusqueda, alertaCtrlList, pagingAlertaCtrl);
|
||||||
|
if (alertaCtrlList.getData().length == 0) {
|
||||||
|
try {
|
||||||
|
Messagebox.show(Labels.getLabel("MSG.ningunRegistro"),
|
||||||
|
Labels.getLabel("busquedaAlertaCtrlController.window.title"),
|
||||||
|
Messagebox.OK, Messagebox.INFORMATION);
|
||||||
|
} catch (InterruptedException ex) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onClick$btnPesquisa(Event ev) {
|
||||||
|
refreshLista();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onClick$btnRefresh(Event ev) {
|
||||||
|
refreshLista();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onClick$btnNovo(Event ev) {
|
||||||
|
verAlertaCtrl(new AlertaCtrl());
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onChange$cmbClaseServicio(Event ev) {
|
||||||
|
Comboitem cbiClaseServicio = cmbClaseServicio.getSelectedItem();
|
||||||
|
|
||||||
|
if (cbiClaseServicio != null) {
|
||||||
|
ClaseServicio claseServicio = (ClaseServicio) cbiClaseServicio.getValue();
|
||||||
|
lsRuta = rutaService.buscarPorClaseServicio(claseServicio);
|
||||||
|
|
||||||
|
cmbRuta.setSelectedItem(null);
|
||||||
|
cmbRuta.setText(null);
|
||||||
|
|
||||||
|
BindingListModelList modelRuta = new BindingListModelList(lsRuta, true);
|
||||||
|
cmbRuta.setModel(modelRuta);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,129 @@
|
||||||
|
/*
|
||||||
|
* To change this template, choose Tools | Templates
|
||||||
|
* and open the template in the editor.
|
||||||
|
*/
|
||||||
|
package com.rjconsultores.ventaboletos.web.gui.controladores.configuracioneccomerciales;
|
||||||
|
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.ComisionistaExterno;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.MyGenericForwardComposer;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.MyListbox;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.paginacion.HibernateSearchObject;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.paginacion.PagedListWrapper;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.render.RenderComisionistaExterno;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.context.annotation.Scope;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.zkoss.util.resource.Labels;
|
||||||
|
import org.zkoss.zhtml.Messagebox;
|
||||||
|
import org.zkoss.zk.ui.Component;
|
||||||
|
import org.zkoss.zk.ui.event.Event;
|
||||||
|
import org.zkoss.zk.ui.event.EventListener;
|
||||||
|
import org.zkoss.zul.Paging;
|
||||||
|
import org.zkoss.zul.Textbox;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Administrador
|
||||||
|
*/
|
||||||
|
@Controller("busquedaComisionistaExternoController")
|
||||||
|
@Scope("prototype")
|
||||||
|
public class BusquedaComisionistaExternoController extends MyGenericForwardComposer {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private transient PagedListWrapper<ComisionistaExterno> plwComisionistaExterno;
|
||||||
|
private MyListbox comisionistaExternoList;
|
||||||
|
private Paging pagingComisionistaExterno;
|
||||||
|
private Textbox txtNombre;
|
||||||
|
|
||||||
|
public MyListbox getComisionistaExternoList() {
|
||||||
|
return comisionistaExternoList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setComisionistaExternoList(MyListbox comisionistaExternoList) {
|
||||||
|
this.comisionistaExternoList = comisionistaExternoList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Paging getPagingComisionistaExterno() {
|
||||||
|
return pagingComisionistaExterno;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPagingComisionistaExterno(Paging pagingComisionistaExterno) {
|
||||||
|
this.pagingComisionistaExterno = pagingComisionistaExterno;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Textbox getTxtNombre() {
|
||||||
|
return txtNombre;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTxtNombre(Textbox txtNombre) {
|
||||||
|
this.txtNombre = txtNombre;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void doAfterCompose(Component comp) throws Exception {
|
||||||
|
super.doAfterCompose(comp);
|
||||||
|
|
||||||
|
comisionistaExternoList.setItemRenderer(new RenderComisionistaExterno());
|
||||||
|
comisionistaExternoList.addEventListener("onDoubleClick", new EventListener() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onEvent(Event event) throws Exception {
|
||||||
|
ComisionistaExterno c = (ComisionistaExterno) comisionistaExternoList.getSelected();
|
||||||
|
verComisionistaExterno(c);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
refreshLista();
|
||||||
|
|
||||||
|
txtNombre.focus();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void verComisionistaExterno(ComisionistaExterno c) {
|
||||||
|
if (c == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Map args = new HashMap();
|
||||||
|
args.put("comisionistaExterno", c);
|
||||||
|
args.put("comisionistaExternoList", comisionistaExternoList);
|
||||||
|
|
||||||
|
openWindow("/gui/configuraciones_comerciales/editarComisionistaExterno.zul",
|
||||||
|
Labels.getLabel("editarComisionistaExternoController.window.title"), args, MODAL);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void refreshLista() {
|
||||||
|
HibernateSearchObject<ComisionistaExterno> comisionistaExternoBusqueda =
|
||||||
|
new HibernateSearchObject<ComisionistaExterno>(ComisionistaExterno.class, pagingComisionistaExterno.getPageSize());
|
||||||
|
|
||||||
|
comisionistaExternoBusqueda.addFilterLike("desccomisionista",
|
||||||
|
"%" + txtNombre.getText().trim().concat("%"));
|
||||||
|
comisionistaExternoBusqueda.addFilterEqual("activo", Boolean.TRUE);
|
||||||
|
|
||||||
|
comisionistaExternoBusqueda.addSortAsc("desccomisionista");
|
||||||
|
|
||||||
|
plwComisionistaExterno.init(comisionistaExternoBusqueda, comisionistaExternoList, pagingComisionistaExterno);
|
||||||
|
|
||||||
|
if (comisionistaExternoList.getData().length == 0) {
|
||||||
|
try {
|
||||||
|
Messagebox.show(Labels.getLabel("MSG.ningunRegistro"),
|
||||||
|
Labels.getLabel("busquedaComisionistaExternoController.window.title"),
|
||||||
|
Messagebox.OK, Messagebox.INFORMATION);
|
||||||
|
} catch (InterruptedException ex) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onClick$btnPesquisa(Event ev) {
|
||||||
|
refreshLista();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onClick$btnRefresh(Event ev) {
|
||||||
|
refreshLista();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onClick$btnNovo(Event ev) {
|
||||||
|
verComisionistaExterno(new ComisionistaExterno());
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,299 @@
|
||||||
|
/*
|
||||||
|
* To change this template, choose Tools | Templates
|
||||||
|
* and open the template in the editor.
|
||||||
|
*/
|
||||||
|
package com.rjconsultores.ventaboletos.web.gui.controladores.configuracioneccomerciales;
|
||||||
|
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.CancelacionCtrl;
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.Marca;
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.MotivoCancelacion;
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.Parada;
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.PuntoVenta;
|
||||||
|
import com.rjconsultores.ventaboletos.service.MarcaService;
|
||||||
|
import com.rjconsultores.ventaboletos.service.MotivoCancelacionService;
|
||||||
|
import com.rjconsultores.ventaboletos.service.ParadaService;
|
||||||
|
import com.rjconsultores.ventaboletos.service.PuntoVentaService;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.MyGenericForwardComposer;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.MyListbox;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.paginacion.HibernateSearchObject;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.paginacion.PagedListWrapper;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.render.RenderConfiguracionCancelacion;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.context.annotation.Scope;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.zkoss.util.resource.Labels;
|
||||||
|
import org.zkoss.zhtml.Messagebox;
|
||||||
|
import org.zkoss.zk.ui.Component;
|
||||||
|
import org.zkoss.zk.ui.event.Event;
|
||||||
|
import org.zkoss.zk.ui.event.EventListener;
|
||||||
|
import org.zkoss.zul.Combobox;
|
||||||
|
import org.zkoss.zul.Paging;
|
||||||
|
import org.zkoss.zul.Timebox;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Rafius
|
||||||
|
*/
|
||||||
|
@Controller("busquedaConfiguracionCancelacionController")
|
||||||
|
@Scope("prototype")
|
||||||
|
public class BusquedaConfiguracionCancelacionController extends MyGenericForwardComposer {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private transient PagedListWrapper<CancelacionCtrl> plwConfigCancelacion;
|
||||||
|
@Autowired
|
||||||
|
private PuntoVentaService puntoVentaService;
|
||||||
|
@Autowired
|
||||||
|
private MarcaService marcaService;
|
||||||
|
@Autowired
|
||||||
|
private ParadaService paradaService;
|
||||||
|
@Autowired
|
||||||
|
private MotivoCancelacionService motivoCancelacionService;
|
||||||
|
private MyListbox cancelacionCtrlList;
|
||||||
|
private Paging pagingCancelacion;
|
||||||
|
private List<PuntoVenta> lsPuntoVenta;
|
||||||
|
private List<Marca> lsMarca;
|
||||||
|
private List<MotivoCancelacion> lsMotivoCancelacion;
|
||||||
|
private List<Parada> lsParada;
|
||||||
|
private Combobox cmbMarca;
|
||||||
|
private Combobox cmbParadaDestino;
|
||||||
|
private Combobox cmbParadaOrigem;
|
||||||
|
private Combobox cmbPuntoVenta;
|
||||||
|
private Combobox cmbMotivoCancelacion;
|
||||||
|
|
||||||
|
public Combobox getCmbMarca() {
|
||||||
|
return cmbMarca;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCmbMarca(Combobox cmbMarca) {
|
||||||
|
this.cmbMarca = cmbMarca;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Combobox getCmbParadaDestino() {
|
||||||
|
return cmbParadaDestino;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCmbParadaDestino(Combobox cmbParadaDestino) {
|
||||||
|
this.cmbParadaDestino = cmbParadaDestino;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Combobox getCmbParadaOrigem() {
|
||||||
|
return cmbParadaOrigem;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCmbParadaOrigem(Combobox cmbParadaOrigem) {
|
||||||
|
this.cmbParadaOrigem = cmbParadaOrigem;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Combobox getCmbPuntoVenta() {
|
||||||
|
return cmbPuntoVenta;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCmbPuntoVenta(Combobox cmbPuntoVenta) {
|
||||||
|
this.cmbPuntoVenta = cmbPuntoVenta;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<Marca> getLsMarca() {
|
||||||
|
return lsMarca;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLsMarca(List<Marca> lsMarca) {
|
||||||
|
this.lsMarca = lsMarca;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<Parada> getLsParada() {
|
||||||
|
return lsParada;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLsParada(List<Parada> lsParada) {
|
||||||
|
this.lsParada = lsParada;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<PuntoVenta> getLsPuntoVenta() {
|
||||||
|
return lsPuntoVenta;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLsPuntoVenta(List<PuntoVenta> lsPuntoVenta) {
|
||||||
|
this.lsPuntoVenta = lsPuntoVenta;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void doAfterCompose(Component comp) throws Exception {
|
||||||
|
super.doAfterCompose(comp);
|
||||||
|
|
||||||
|
lsPuntoVenta = new ArrayList<PuntoVenta>();
|
||||||
|
lsPuntoVenta.add(new PuntoVenta());
|
||||||
|
lsPuntoVenta.addAll(puntoVentaService.obtenerTodos());
|
||||||
|
|
||||||
|
lsMarca = new ArrayList<Marca>();
|
||||||
|
lsMarca.add(new Marca());
|
||||||
|
lsMarca.addAll(marcaService.obtenerTodos());
|
||||||
|
|
||||||
|
lsParada = new ArrayList<Parada>();
|
||||||
|
lsParada.add(new Parada());
|
||||||
|
lsParada.addAll(paradaService.obtenerTodos());
|
||||||
|
|
||||||
|
lsMotivoCancelacion = new ArrayList<MotivoCancelacion>();
|
||||||
|
lsMotivoCancelacion.add(new MotivoCancelacion());
|
||||||
|
lsMotivoCancelacion.addAll(motivoCancelacionService.obtenerTodosTipoMotivoB());
|
||||||
|
|
||||||
|
cancelacionCtrlList.setItemRenderer(new RenderConfiguracionCancelacion());
|
||||||
|
cancelacionCtrlList.addEventListener("onDoubleClick", new EventListener() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onEvent(Event event) throws Exception {
|
||||||
|
CancelacionCtrl cc = (CancelacionCtrl) cancelacionCtrlList.getSelected();
|
||||||
|
verConfigCancelacion(cc);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
refreshLista();
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void verConfigCancelacion(CancelacionCtrl cc) {
|
||||||
|
if (cc == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Map args = new HashMap();
|
||||||
|
args.put("cancelacionCtrl", cc);
|
||||||
|
args.put("cancelacionCtrlList", cancelacionCtrlList);
|
||||||
|
|
||||||
|
openWindow("/gui/configuraciones_comerciales/editarConfiguracionCancelacion.zul",
|
||||||
|
Labels.getLabel("editarConfiguracionCancelacionController.window.title"), args, MODAL);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void refreshLista() {
|
||||||
|
HibernateSearchObject<CancelacionCtrl> configCancelacionBusqueda =
|
||||||
|
new HibernateSearchObject<CancelacionCtrl>(CancelacionCtrl.class,
|
||||||
|
pagingCancelacion.getPageSize());
|
||||||
|
|
||||||
|
configCancelacionBusqueda.addFilterEqual("activo", Boolean.TRUE);
|
||||||
|
|
||||||
|
Marca marca = (Marca) (cmbMarca.getSelectedItem() != null ? cmbMarca.getSelectedItem().getValue() : null);
|
||||||
|
Parada paradaDestino = (Parada) (cmbParadaDestino.getSelectedItem() != null ? cmbParadaDestino.getSelectedItem().getValue() : null);
|
||||||
|
Parada paradaOrigem = (Parada) (cmbParadaOrigem.getSelectedItem() != null ? cmbParadaOrigem.getSelectedItem().getValue() : null);
|
||||||
|
PuntoVenta puntoVenta = (PuntoVenta) (cmbPuntoVenta.getSelectedItem() != null ? cmbPuntoVenta.getSelectedItem().getValue() : null);
|
||||||
|
MotivoCancelacion motivoCancelacion = (MotivoCancelacion) (cmbMotivoCancelacion.getSelectedItem() != null ? cmbMotivoCancelacion.getSelectedItem().getValue() : null);
|
||||||
|
|
||||||
|
if (marca != null) {
|
||||||
|
configCancelacionBusqueda.addFilterEqual("marca", marca);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (paradaDestino != null) {
|
||||||
|
configCancelacionBusqueda.addFilterEqual("paradaDestino", paradaDestino);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (paradaOrigem != null) {
|
||||||
|
configCancelacionBusqueda.addFilterEqual("paradaOrigem", paradaOrigem);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (puntoVenta != null) {
|
||||||
|
configCancelacionBusqueda.addFilterEqual("puntoVenta", puntoVenta);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (motivoCancelacion != null) {
|
||||||
|
configCancelacionBusqueda.addFilterEqual("motivoCancelacion", motivoCancelacion);
|
||||||
|
}
|
||||||
|
|
||||||
|
plwConfigCancelacion.init(configCancelacionBusqueda, cancelacionCtrlList, pagingCancelacion);
|
||||||
|
|
||||||
|
if (cancelacionCtrlList.getData().length == 0) {
|
||||||
|
try {
|
||||||
|
Messagebox.show(Labels.getLabel("MSG.ningunRegistro"),
|
||||||
|
Labels.getLabel("busquedaConfiguracionCancelacionController.window.title"),
|
||||||
|
Messagebox.OK, Messagebox.INFORMATION);
|
||||||
|
} catch (InterruptedException ex) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onClick$btnPesquisa(Event ev) {
|
||||||
|
refreshLista();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onClick$btnRefresh(Event ev) {
|
||||||
|
refreshLista();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onClick$btnNovo(Event ev) {
|
||||||
|
verConfigCancelacion(new CancelacionCtrl());
|
||||||
|
}
|
||||||
|
|
||||||
|
public MyListbox getConfigCancelacionList() {
|
||||||
|
return cancelacionCtrlList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setConfigCancelacionList(MyListbox configCancelacionList) {
|
||||||
|
this.cancelacionCtrlList = configCancelacionList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Paging getPagingConfigCancelacion() {
|
||||||
|
return pagingCancelacion;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPagingConfigCancelacion(Paging pagingConfigCancelacion) {
|
||||||
|
this.pagingCancelacion = pagingConfigCancelacion;
|
||||||
|
}
|
||||||
|
|
||||||
|
public PagedListWrapper<CancelacionCtrl> getPlwConfigCancelacion() {
|
||||||
|
return plwConfigCancelacion;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPlwConfigCancelacion(PagedListWrapper<CancelacionCtrl> plwConfigCancelacion) {
|
||||||
|
this.plwConfigCancelacion = plwConfigCancelacion;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Combobox getCmbMotivoCancelacion() {
|
||||||
|
return cmbMotivoCancelacion;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCmbMotivoCancelacion(Combobox cmbMotivoCancelacion) {
|
||||||
|
this.cmbMotivoCancelacion = cmbMotivoCancelacion;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<MotivoCancelacion> getLsMotivoCancelacion() {
|
||||||
|
return lsMotivoCancelacion;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLsMotivoCancelacion(List<MotivoCancelacion> lsMotivoCancelacion) {
|
||||||
|
this.lsMotivoCancelacion = lsMotivoCancelacion;
|
||||||
|
}
|
||||||
|
|
||||||
|
public MarcaService getMarcaService() {
|
||||||
|
return marcaService;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMarcaService(MarcaService marcaService) {
|
||||||
|
this.marcaService = marcaService;
|
||||||
|
}
|
||||||
|
|
||||||
|
public MotivoCancelacionService getMotivoCancelacionService() {
|
||||||
|
return motivoCancelacionService;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMotivoCancelacionService(MotivoCancelacionService motivoCancelacionService) {
|
||||||
|
this.motivoCancelacionService = motivoCancelacionService;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ParadaService getParadaService() {
|
||||||
|
return paradaService;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setParadaService(ParadaService paradaService) {
|
||||||
|
this.paradaService = paradaService;
|
||||||
|
}
|
||||||
|
|
||||||
|
public PuntoVentaService getPuntoVentaService() {
|
||||||
|
return puntoVentaService;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPuntoVentaService(PuntoVentaService puntoVentaService) {
|
||||||
|
this.puntoVentaService = puntoVentaService;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,132 @@
|
||||||
|
/*
|
||||||
|
* To change this template, choose Tools | Templates
|
||||||
|
* and open the template in the editor.
|
||||||
|
*/
|
||||||
|
package com.rjconsultores.ventaboletos.web.gui.controladores.configuracioneccomerciales;
|
||||||
|
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.CategoriaCtrl;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.MyGenericForwardComposer;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.MyListbox;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.paginacion.HibernateSearchObject;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.paginacion.PagedListWrapper;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.render.RenderCategoriaDescuento;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.context.annotation.Scope;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.zkoss.util.resource.Labels;
|
||||||
|
import org.zkoss.zhtml.Messagebox;
|
||||||
|
import org.zkoss.zk.ui.Component;
|
||||||
|
import org.zkoss.zk.ui.event.Event;
|
||||||
|
import org.zkoss.zk.ui.event.EventListener;
|
||||||
|
import org.zkoss.zul.Paging;
|
||||||
|
import org.zkoss.zul.Textbox;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author rodrigo
|
||||||
|
*/
|
||||||
|
@Controller("busquedaConfiguracionCategoriaController")
|
||||||
|
@Scope("prototype")
|
||||||
|
public class BusquedaConfiguracionCategoriaController extends MyGenericForwardComposer {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private transient PagedListWrapper<CategoriaCtrl> plwpagingcategoriaCtrl;
|
||||||
|
private MyListbox categoriaCtrlList;
|
||||||
|
private Paging pagingCategoriaCtrl;
|
||||||
|
private Textbox txtNome;
|
||||||
|
|
||||||
|
public MyListbox getConfigCategoriaList() {
|
||||||
|
return categoriaCtrlList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setConfigCategoriaList(MyListbox configCategoriaList) {
|
||||||
|
this.categoriaCtrlList = configCategoriaList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Paging getPagingConfigCategoria() {
|
||||||
|
return pagingCategoriaCtrl;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPagingConfigCategoria(Paging pagingConfigCategoria) {
|
||||||
|
this.pagingCategoriaCtrl = pagingConfigCategoria;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Textbox getTxtNome() {
|
||||||
|
return txtNome;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTxtNome(Textbox txtNome) {
|
||||||
|
this.txtNome = txtNome;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void doAfterCompose(Component comp) throws Exception {
|
||||||
|
super.doAfterCompose(comp);
|
||||||
|
|
||||||
|
categoriaCtrlList.setItemRenderer(new RenderCategoriaDescuento());
|
||||||
|
categoriaCtrlList.addEventListener("onDoubleClick", new EventListener() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onEvent(Event event) throws Exception {
|
||||||
|
CategoriaCtrl cc = (CategoriaCtrl) categoriaCtrlList.getSelected();
|
||||||
|
verConfigCategoria(cc);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
refreshLista();
|
||||||
|
|
||||||
|
txtNome.focus();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void verConfigCategoria(CategoriaCtrl cc) {
|
||||||
|
if (cc == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Map args = new HashMap();
|
||||||
|
args.put("categoriaCtrl", cc);
|
||||||
|
args.put("categoriaCtrlList", categoriaCtrlList);
|
||||||
|
|
||||||
|
openWindow("/gui/configuraciones_comerciales/editarConfiguracionCategorias.zul",
|
||||||
|
Labels.getLabel("editarConfiguracionCategoriaController.window.title"), args, MODAL);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void refreshLista() {
|
||||||
|
HibernateSearchObject<CategoriaCtrl> configCategoriaBusqueda =
|
||||||
|
new HibernateSearchObject<CategoriaCtrl>(CategoriaCtrl.class,
|
||||||
|
pagingCategoriaCtrl.getPageSize());
|
||||||
|
|
||||||
|
if (!txtNome.getText().equals("")) {
|
||||||
|
configCategoriaBusqueda.addFilterLike("empresa.nombempresa", "%" + txtNome.getText().trim().concat("%"));
|
||||||
|
}
|
||||||
|
|
||||||
|
configCategoriaBusqueda.addFilterEqual("empresa.activo", Boolean.TRUE);
|
||||||
|
configCategoriaBusqueda.addFilterEqual("activo", Boolean.TRUE);
|
||||||
|
configCategoriaBusqueda.addSortAsc("empresa.nombempresa");
|
||||||
|
|
||||||
|
plwpagingcategoriaCtrl.init(configCategoriaBusqueda, categoriaCtrlList, pagingCategoriaCtrl);
|
||||||
|
|
||||||
|
if (categoriaCtrlList.getData().length == 0) {
|
||||||
|
try {
|
||||||
|
Messagebox.show(Labels.getLabel("MSG.ningunRegistro"),
|
||||||
|
Labels.getLabel("busquedaConfiguracionCategoriaController.window.title"),
|
||||||
|
Messagebox.OK, Messagebox.INFORMATION);
|
||||||
|
} catch (InterruptedException ex) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onClick$btnPesquisa(Event ev) {
|
||||||
|
refreshLista();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onClick$btnRefresh(Event ev) {
|
||||||
|
refreshLista();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onClick$btnNovo(Event ev) {
|
||||||
|
verConfigCategoria(new CategoriaCtrl());
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,130 @@
|
||||||
|
/*
|
||||||
|
* To change this template, choose Tools | Templates
|
||||||
|
* and open the template in the editor.
|
||||||
|
*/
|
||||||
|
package com.rjconsultores.ventaboletos.web.gui.controladores.configuracioneccomerciales;
|
||||||
|
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.FormaPagoDet;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.MyGenericForwardComposer;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.MyListbox;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.paginacion.HibernateSearchObject;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.paginacion.PagedListWrapper;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.render.RenderConfiguracionFormasPago;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.context.annotation.Scope;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.zkoss.util.resource.Labels;
|
||||||
|
import org.zkoss.zhtml.Messagebox;
|
||||||
|
import org.zkoss.zk.ui.Component;
|
||||||
|
import org.zkoss.zk.ui.event.Event;
|
||||||
|
import org.zkoss.zk.ui.event.EventListener;
|
||||||
|
import org.zkoss.zul.Paging;
|
||||||
|
import org.zkoss.zul.Textbox;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Administrador
|
||||||
|
*/
|
||||||
|
@Controller("busquedaConfiguracionFormaPagoController")
|
||||||
|
@Scope("prototype")
|
||||||
|
public class BusquedaConfiguracionFormaPagoController extends MyGenericForwardComposer {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private transient PagedListWrapper<FormaPagoDet> plwConfigFormaPago;
|
||||||
|
private MyListbox configFormaPagoList;
|
||||||
|
private Paging pagingConfigFormaPago;
|
||||||
|
private Textbox txtNome;
|
||||||
|
|
||||||
|
public MyListbox getConfigFormaPagoList() {
|
||||||
|
return configFormaPagoList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setConfigFormaPagoList(MyListbox configFormaPagoList) {
|
||||||
|
this.configFormaPagoList = configFormaPagoList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Paging getPagingConfigFormaPago() {
|
||||||
|
return pagingConfigFormaPago;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPagingConfigFormaPago(Paging pagingConfigFormaPago) {
|
||||||
|
this.pagingConfigFormaPago = pagingConfigFormaPago;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Textbox getTxtNome() {
|
||||||
|
return txtNome;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTxtNome(Textbox txtNome) {
|
||||||
|
this.txtNome = txtNome;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void doAfterCompose(Component comp) throws Exception {
|
||||||
|
super.doAfterCompose(comp);
|
||||||
|
|
||||||
|
configFormaPagoList.setItemRenderer(new RenderConfiguracionFormasPago());
|
||||||
|
configFormaPagoList.addEventListener("onDoubleClick", new EventListener() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onEvent(Event event) throws Exception {
|
||||||
|
FormaPagoDet fpd = (FormaPagoDet) configFormaPagoList.getSelected();
|
||||||
|
verConfigFormaPago(fpd);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
refreshLista();
|
||||||
|
|
||||||
|
txtNome.focus();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void verConfigFormaPago(FormaPagoDet fpd) {
|
||||||
|
if (fpd == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Map args = new HashMap();
|
||||||
|
args.put("formaPagoDet", fpd);
|
||||||
|
args.put("configFormaPagoList", configFormaPagoList);
|
||||||
|
|
||||||
|
openWindow("/gui/configuraciones_comerciales/editarConfiguracionFormaPago.zul",
|
||||||
|
Labels.getLabel("editarConfiguracionFormaPagoController.window.title"), args, MODAL);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void refreshLista() {
|
||||||
|
HibernateSearchObject<FormaPagoDet> configFormaPagoBusqueda =
|
||||||
|
new HibernateSearchObject<FormaPagoDet>(FormaPagoDet.class,
|
||||||
|
pagingConfigFormaPago.getPageSize());
|
||||||
|
|
||||||
|
configFormaPagoBusqueda.addFilterLike("formaPago.descpago",
|
||||||
|
"%" + txtNome.getText().trim().concat("%"));
|
||||||
|
|
||||||
|
configFormaPagoBusqueda.addSortAsc("formaPago.descpago");
|
||||||
|
configFormaPagoBusqueda.addFilterEqual("activo", Boolean.TRUE);
|
||||||
|
|
||||||
|
plwConfigFormaPago.init(configFormaPagoBusqueda, configFormaPagoList, pagingConfigFormaPago);
|
||||||
|
|
||||||
|
if (configFormaPagoList.getData().length == 0) {
|
||||||
|
try {
|
||||||
|
Messagebox.show(Labels.getLabel("MSG.ningunRegistro"),
|
||||||
|
Labels.getLabel("busquedaConfiguracionFormaPagoController.window.title"),
|
||||||
|
Messagebox.OK, Messagebox.INFORMATION);
|
||||||
|
} catch (InterruptedException ex) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onClick$btnPesquisa(Event ev) {
|
||||||
|
refreshLista();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onClick$btnRefresh(Event ev) {
|
||||||
|
refreshLista();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onClick$btnNovo(Event ev) {
|
||||||
|
verConfigFormaPago(new FormaPagoDet());
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,127 @@
|
||||||
|
/*
|
||||||
|
* To change this template, choose Tools | Templates
|
||||||
|
* and open the template in the editor.
|
||||||
|
*/
|
||||||
|
package com.rjconsultores.ventaboletos.web.gui.controladores.configuracioneccomerciales;
|
||||||
|
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.Constante;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.MyGenericForwardComposer;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.MyListbox;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.paginacion.HibernateSearchObject;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.paginacion.PagedListWrapper;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.render.RenderConfiguracionGeneral;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.context.annotation.Scope;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.zkoss.util.resource.Labels;
|
||||||
|
import org.zkoss.zhtml.Messagebox;
|
||||||
|
import org.zkoss.zk.ui.Component;
|
||||||
|
import org.zkoss.zk.ui.event.Event;
|
||||||
|
import org.zkoss.zk.ui.event.EventListener;
|
||||||
|
import org.zkoss.zul.Paging;
|
||||||
|
import org.zkoss.zul.Textbox;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Rafius
|
||||||
|
*/
|
||||||
|
@Controller("busquedaConfiguracionGeneralController")
|
||||||
|
@Scope("prototype")
|
||||||
|
public class BusquedaConfiguracionGeneralController extends MyGenericForwardComposer {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private transient PagedListWrapper<Constante> plwConstante;
|
||||||
|
private MyListbox constanteList;
|
||||||
|
private Paging pagingConstante;
|
||||||
|
private Textbox txtNombre;
|
||||||
|
|
||||||
|
public Paging getPagingConstante() {
|
||||||
|
return pagingConstante;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPagingConstante(Paging pagingConstante) {
|
||||||
|
this.pagingConstante = pagingConstante;
|
||||||
|
}
|
||||||
|
|
||||||
|
public MyListbox getConstanteList() {
|
||||||
|
return constanteList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setConstanteList(MyListbox constanteList) {
|
||||||
|
this.constanteList = constanteList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public PagedListWrapper<Constante> getPlwConstante() {
|
||||||
|
return plwConstante;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPlwConstante(PagedListWrapper<Constante> plwConstante) {
|
||||||
|
this.plwConstante = plwConstante;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onClick$btnPesquisa(Event ev) throws InterruptedException {
|
||||||
|
refreshLista();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onClick$btnRefresh(Event ev) {
|
||||||
|
refreshLista();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onClick$btnNovo(Event ev) {
|
||||||
|
verPeriodo(new Constante());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void doAfterCompose(Component comp) throws Exception {
|
||||||
|
super.doAfterCompose(comp);
|
||||||
|
|
||||||
|
constanteList.setItemRenderer(new RenderConfiguracionGeneral());
|
||||||
|
constanteList.addEventListener("onDoubleClick", new EventListener() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onEvent(Event event) throws Exception {
|
||||||
|
Constante c = (Constante) constanteList.getSelected();
|
||||||
|
verPeriodo(c);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
refreshLista();
|
||||||
|
|
||||||
|
txtNombre.focus();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void verPeriodo(Constante c) {
|
||||||
|
if (c == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Map args = new HashMap();
|
||||||
|
args.put("constante", c);
|
||||||
|
args.put("constanteList", constanteList);
|
||||||
|
|
||||||
|
openWindow("/gui/configuraciones_comerciales/editarConfiguracionGeneral.zul",
|
||||||
|
Labels.getLabel("editarConfiguracionGeneralController.window.title"), args, MODAL);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void refreshLista() {
|
||||||
|
HibernateSearchObject<Constante> claseServicioBusqueda =
|
||||||
|
new HibernateSearchObject<Constante>(Constante.class, pagingConstante.getPageSize());
|
||||||
|
|
||||||
|
claseServicioBusqueda.addFilterLike("descconstante", "%" + txtNombre.getText().trim().concat("%"));
|
||||||
|
claseServicioBusqueda.addFilterEqual("activo", Boolean.TRUE);
|
||||||
|
claseServicioBusqueda.addSortAsc("nombconstante");
|
||||||
|
|
||||||
|
plwConstante.init(claseServicioBusqueda, constanteList, pagingConstante);
|
||||||
|
|
||||||
|
if (constanteList.getData().length == 0) {
|
||||||
|
try {
|
||||||
|
Messagebox.show(Labels.getLabel("MSG.ningunRegistro"),
|
||||||
|
Labels.getLabel("busquedaConfiguracionGeneralController.window.title"),
|
||||||
|
Messagebox.OK, Messagebox.INFORMATION);
|
||||||
|
} catch (InterruptedException ex) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,143 @@
|
||||||
|
/*
|
||||||
|
* To change this template, choose Tools | Templates
|
||||||
|
* and open the template in the editor.
|
||||||
|
*/
|
||||||
|
package com.rjconsultores.ventaboletos.web.gui.controladores.configuracioneccomerciales;
|
||||||
|
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.ReservacionCtrl;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.MyGenericForwardComposer;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.MyListbox;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.paginacion.HibernateSearchObject;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.paginacion.PagedListWrapper;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.render.RenderConfiguracionReservacion;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.context.annotation.Scope;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.zkoss.util.resource.Labels;
|
||||||
|
import org.zkoss.zhtml.Messagebox;
|
||||||
|
import org.zkoss.zk.ui.Component;
|
||||||
|
import org.zkoss.zk.ui.event.Event;
|
||||||
|
import org.zkoss.zk.ui.event.EventListener;
|
||||||
|
import org.zkoss.zul.Datebox;
|
||||||
|
import org.zkoss.zul.Paging;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Rafius
|
||||||
|
*/
|
||||||
|
@Controller("busquedaConfiguracionReservacionController")
|
||||||
|
@Scope("prototype")
|
||||||
|
public class BusquedaConfiguracionReservacionController extends MyGenericForwardComposer {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private transient PagedListWrapper<ReservacionCtrl> plwReservacionCtrl;
|
||||||
|
private MyListbox reservacionCtrlList;
|
||||||
|
private Paging pagingReservacionCtrl;
|
||||||
|
private Datebox fecInicio;
|
||||||
|
private Datebox fecFinal;
|
||||||
|
|
||||||
|
public Paging getPagingReservacionCtrl() {
|
||||||
|
return pagingReservacionCtrl;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPagingReservacionCtrl(Paging pagingReservacionCtrl) {
|
||||||
|
this.pagingReservacionCtrl = pagingReservacionCtrl;
|
||||||
|
}
|
||||||
|
|
||||||
|
public MyListbox getReservacionCtrlList() {
|
||||||
|
return reservacionCtrlList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setReservacionCtrlList(MyListbox reservacionCtrlList) {
|
||||||
|
this.reservacionCtrlList = reservacionCtrlList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public PagedListWrapper<ReservacionCtrl> getPlwReservacionCtrl() {
|
||||||
|
return plwReservacionCtrl;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPlwReservacionCtrl(PagedListWrapper<ReservacionCtrl> plwReservacionCtrl) {
|
||||||
|
this.plwReservacionCtrl = plwReservacionCtrl;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onClick$btnPesquisa(Event ev) throws InterruptedException {
|
||||||
|
pesquisarLista();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onClick$btnRefresh(Event ev) throws InterruptedException {
|
||||||
|
refreshLista();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onClick$btnNovo(Event ev) {
|
||||||
|
verPeriodo(new ReservacionCtrl());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void doAfterCompose(Component comp) throws Exception {
|
||||||
|
super.doAfterCompose(comp);
|
||||||
|
|
||||||
|
reservacionCtrlList.setItemRenderer(new RenderConfiguracionReservacion());
|
||||||
|
reservacionCtrlList.addEventListener("onDoubleClick", new EventListener() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onEvent(Event event) throws Exception {
|
||||||
|
ReservacionCtrl rc = (ReservacionCtrl) reservacionCtrlList.getSelected();
|
||||||
|
verPeriodo(rc);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
refreshLista();
|
||||||
|
|
||||||
|
fecInicio.focus();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void verPeriodo(ReservacionCtrl rc) {
|
||||||
|
if (rc == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Map args = new HashMap();
|
||||||
|
args.put("reservacionCtrl", rc);
|
||||||
|
args.put("reservacionCtrlList", reservacionCtrlList);
|
||||||
|
|
||||||
|
openWindow("/gui/configuraciones_comerciales/editarConfiguracionReservacion.zul",
|
||||||
|
Labels.getLabel("editarConfiguracionReservacionController.window.title"), args, MODAL);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void refreshLista() throws InterruptedException {
|
||||||
|
HibernateSearchObject<ReservacionCtrl> claseServicioBusqueda =
|
||||||
|
new HibernateSearchObject<ReservacionCtrl>(ReservacionCtrl.class, pagingReservacionCtrl.getPageSize());
|
||||||
|
|
||||||
|
claseServicioBusqueda.addFilterEqual("activo", Boolean.TRUE);
|
||||||
|
claseServicioBusqueda.addSortAsc("fecinicio");
|
||||||
|
|
||||||
|
plwReservacionCtrl.init(claseServicioBusqueda, reservacionCtrlList, pagingReservacionCtrl);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void pesquisarLista() throws InterruptedException {
|
||||||
|
HibernateSearchObject<ReservacionCtrl> claseServicioBusqueda =
|
||||||
|
new HibernateSearchObject<ReservacionCtrl>(ReservacionCtrl.class, pagingReservacionCtrl.getPageSize());
|
||||||
|
|
||||||
|
if (fecInicio.getValue() != null && fecFinal.getValue() != null) {
|
||||||
|
claseServicioBusqueda.addFilterGreaterOrEqual("fecinicio", fecInicio.getValue());
|
||||||
|
claseServicioBusqueda.addFilterLessOrEqual("fecfinal", fecFinal.getValue());
|
||||||
|
} else {
|
||||||
|
Messagebox.show(Labels.getLabel("busquedaConfiguracionReservacionController.periodo.label"),
|
||||||
|
Labels.getLabel("busquedaConfiguracionReservacionController.window.title"),
|
||||||
|
Messagebox.OK, Messagebox.EXCLAMATION);
|
||||||
|
}
|
||||||
|
|
||||||
|
claseServicioBusqueda.addFilterEqual("activo", Boolean.TRUE);
|
||||||
|
claseServicioBusqueda.addSortAsc("fecinicio");
|
||||||
|
|
||||||
|
plwReservacionCtrl.init(claseServicioBusqueda, reservacionCtrlList, pagingReservacionCtrl);
|
||||||
|
|
||||||
|
if (reservacionCtrlList.getData().length == 0) {
|
||||||
|
Messagebox.show(Labels.getLabel("MSG.ningunRegistro"),
|
||||||
|
Labels.getLabel("busquedaConfiguracionReservacionController.window.title"),
|
||||||
|
Messagebox.OK, Messagebox.INFORMATION);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,111 @@
|
||||||
|
/*
|
||||||
|
* To change this template, choose Tools | Templates
|
||||||
|
* and open the template in the editor.
|
||||||
|
*/
|
||||||
|
package com.rjconsultores.ventaboletos.web.gui.controladores.configuracioneccomerciales;
|
||||||
|
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.Convenio;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.MyGenericForwardComposer;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.MyListbox;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.paginacion.HibernateSearchObject;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.paginacion.PagedListWrapper;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.render.RenderConvenio;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.context.annotation.Scope;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.zkoss.util.resource.Labels;
|
||||||
|
import org.zkoss.zhtml.Messagebox;
|
||||||
|
import org.zkoss.zk.ui.Component;
|
||||||
|
import org.zkoss.zk.ui.event.Event;
|
||||||
|
import org.zkoss.zk.ui.event.EventListener;
|
||||||
|
import org.zkoss.zul.Paging;
|
||||||
|
import org.zkoss.zul.Textbox;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Administrador
|
||||||
|
*/
|
||||||
|
@Controller("busquedaConvenioController")
|
||||||
|
@Scope("prototype")
|
||||||
|
public class BusquedaConvenioController extends MyGenericForwardComposer {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private transient PagedListWrapper<Convenio> plwConvenio;
|
||||||
|
private MyListbox convenioList;
|
||||||
|
private Paging pagingConvenio;
|
||||||
|
private Textbox txtDescconvenio;
|
||||||
|
private Textbox txtCveconvenio;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void doAfterCompose(Component comp) throws Exception {
|
||||||
|
super.doAfterCompose(comp);
|
||||||
|
|
||||||
|
convenioList.setItemRenderer(new RenderConvenio());
|
||||||
|
convenioList.addEventListener("onDoubleClick", new EventListener() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onEvent(Event event) throws Exception {
|
||||||
|
Convenio c = (Convenio) convenioList.getSelected();
|
||||||
|
verConvenio(c);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
refreshLista();
|
||||||
|
|
||||||
|
txtDescconvenio.focus();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void verConvenio(Convenio c) {
|
||||||
|
if (c == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Map args = new HashMap();
|
||||||
|
args.put("convenio", c);
|
||||||
|
args.put("convenioList", convenioList);
|
||||||
|
|
||||||
|
openWindow("/gui/configuraciones_comerciales/editarConvenio.zul",
|
||||||
|
Labels.getLabel("editarConvenioController.window.title"),
|
||||||
|
args, MODAL);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void refreshLista() {
|
||||||
|
HibernateSearchObject<Convenio> convenioBusqueda =
|
||||||
|
new HibernateSearchObject<Convenio>(Convenio.class,
|
||||||
|
pagingConvenio.getPageSize());
|
||||||
|
|
||||||
|
convenioBusqueda.addFilterEqual("activo", Boolean.TRUE);
|
||||||
|
|
||||||
|
convenioBusqueda.addFilterLike("descconvenio",
|
||||||
|
"%" + txtDescconvenio.getText().trim().concat("%"));
|
||||||
|
convenioBusqueda.addFilterLike("cveconvenio",
|
||||||
|
"%" + txtCveconvenio.getText().trim().concat("%"));
|
||||||
|
|
||||||
|
convenioBusqueda.addSortAsc("descconvenio");
|
||||||
|
|
||||||
|
plwConvenio.init(convenioBusqueda, convenioList, pagingConvenio);
|
||||||
|
|
||||||
|
if (convenioList.getData().length == 0) {
|
||||||
|
try {
|
||||||
|
Messagebox.show(Labels.getLabel("MSG.ningunRegistro"),
|
||||||
|
Labels.getLabel("busquedaConvenioController.window.title"),
|
||||||
|
Messagebox.OK, Messagebox.INFORMATION);
|
||||||
|
} catch (InterruptedException ex) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onClick$btnPesquisa(Event ev) {
|
||||||
|
refreshLista();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onClick$btnRefresh(Event ev) {
|
||||||
|
refreshLista();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onClick$btnNovo(Event ev) {
|
||||||
|
verConvenio(new Convenio());
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,145 @@
|
||||||
|
/*
|
||||||
|
* To change this template, choose Tools | Templates
|
||||||
|
* and open the template in the editor.
|
||||||
|
*/
|
||||||
|
package com.rjconsultores.ventaboletos.web.gui.controladores.configuracioneccomerciales;
|
||||||
|
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.MotivoCancelacion;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.MyGenericForwardComposer;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.MyListbox;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.paginacion.HibernateSearchObject;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.paginacion.PagedListWrapper;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.render.RenderMotivoCancelacion;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.context.annotation.Scope;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.zkoss.util.resource.Labels;
|
||||||
|
import org.zkoss.zhtml.Messagebox;
|
||||||
|
import org.zkoss.zk.ui.Component;
|
||||||
|
import org.zkoss.zk.ui.event.Event;
|
||||||
|
import org.zkoss.zk.ui.event.EventListener;
|
||||||
|
import org.zkoss.zul.Combobox;
|
||||||
|
import org.zkoss.zul.Comboitem;
|
||||||
|
import org.zkoss.zul.Paging;
|
||||||
|
import org.zkoss.zul.Textbox;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Rafius
|
||||||
|
*/
|
||||||
|
@Controller("busquedaMotivoCancelacionController")
|
||||||
|
@Scope("prototype")
|
||||||
|
public class BusquedaMotivoCancelacionController extends MyGenericForwardComposer {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private transient PagedListWrapper<MotivoCancelacion> plwMotivoCancelacion;
|
||||||
|
private MyListbox motivoCancelacionList;
|
||||||
|
private Paging pagingMotivoCancelacion;
|
||||||
|
private Textbox txtNombre;
|
||||||
|
private Combobox cmbTipoMotivo;
|
||||||
|
|
||||||
|
public Combobox getCmbTipoMotivo() {
|
||||||
|
return cmbTipoMotivo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCmbTipoMotivo(Combobox cmbTipoMotivo) {
|
||||||
|
this.cmbTipoMotivo = cmbTipoMotivo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Paging getPagingMotivoCancelacion() {
|
||||||
|
return pagingMotivoCancelacion;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPagingMotivoCancelacion(Paging pagingMotivoCancelacion) {
|
||||||
|
this.pagingMotivoCancelacion = pagingMotivoCancelacion;
|
||||||
|
}
|
||||||
|
|
||||||
|
public MyListbox getMotivoCancelacionList() {
|
||||||
|
return motivoCancelacionList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMotivoCancelacionList(MyListbox motivoCancelacionList) {
|
||||||
|
this.motivoCancelacionList = motivoCancelacionList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public PagedListWrapper<MotivoCancelacion> getPlwMotivoCancelacion() {
|
||||||
|
return plwMotivoCancelacion;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPlwMotivoCancelacion(PagedListWrapper<MotivoCancelacion> plwMotivoCancelacion) {
|
||||||
|
this.plwMotivoCancelacion = plwMotivoCancelacion;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onClick$btnPesquisa(Event ev) throws InterruptedException {
|
||||||
|
refreshLista();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onClick$btnRefresh(Event ev) {
|
||||||
|
refreshLista();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onClick$btnNovo(Event ev) {
|
||||||
|
verPeriodo(new MotivoCancelacion());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void doAfterCompose(Component comp) throws Exception {
|
||||||
|
super.doAfterCompose(comp);
|
||||||
|
|
||||||
|
motivoCancelacionList.setItemRenderer(new RenderMotivoCancelacion());
|
||||||
|
motivoCancelacionList.addEventListener("onDoubleClick", new EventListener() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onEvent(Event event) throws Exception {
|
||||||
|
MotivoCancelacion mc = (MotivoCancelacion) motivoCancelacionList.getSelected();
|
||||||
|
verPeriodo(mc);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
refreshLista();
|
||||||
|
|
||||||
|
txtNombre.focus();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void verPeriodo(MotivoCancelacion mc) {
|
||||||
|
if (mc == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Map args = new HashMap();
|
||||||
|
args.put("motivoCancelacion", mc);
|
||||||
|
args.put("motivoCancelacionList", motivoCancelacionList);
|
||||||
|
|
||||||
|
openWindow("/gui/configuraciones_comerciales/editarMotivoCancelacion.zul",
|
||||||
|
Labels.getLabel("editarMotivoCancelacionController.window.title"), args, MODAL);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void refreshLista() {
|
||||||
|
HibernateSearchObject<MotivoCancelacion> claseServicioBusqueda =
|
||||||
|
new HibernateSearchObject<MotivoCancelacion>(MotivoCancelacion.class, pagingMotivoCancelacion.getPageSize());
|
||||||
|
|
||||||
|
Comboitem ci = cmbTipoMotivo.getSelectedItem();
|
||||||
|
String tipoMotivo = null;
|
||||||
|
if (ci != null) {
|
||||||
|
tipoMotivo = (String) ci.getValue();
|
||||||
|
}
|
||||||
|
|
||||||
|
claseServicioBusqueda.addFilterLike("descmotivo", "%" + txtNombre.getText().trim().concat("%"));
|
||||||
|
claseServicioBusqueda.addFilterEqual("tipomotivo", tipoMotivo);
|
||||||
|
claseServicioBusqueda.addFilterEqual("activo", true);
|
||||||
|
claseServicioBusqueda.addSortAsc("descmotivo");
|
||||||
|
|
||||||
|
plwMotivoCancelacion.init(claseServicioBusqueda, motivoCancelacionList, pagingMotivoCancelacion);
|
||||||
|
|
||||||
|
if (motivoCancelacionList.getData().length == 0) {
|
||||||
|
try {
|
||||||
|
Messagebox.show(Labels.getLabel("MSG.ningunRegistro"),
|
||||||
|
Labels.getLabel("busquedaMotivoCancelacionController.window.title"),
|
||||||
|
Messagebox.OK, Messagebox.INFORMATION);
|
||||||
|
} catch (InterruptedException ex) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,128 @@
|
||||||
|
/*
|
||||||
|
* To change this template, choose Tools | Templates
|
||||||
|
* and open the template in the editor.
|
||||||
|
*/
|
||||||
|
package com.rjconsultores.ventaboletos.web.gui.controladores.configuracioneccomerciales;
|
||||||
|
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.MotivoReimpresion;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.MyGenericForwardComposer;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.MyListbox;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.paginacion.HibernateSearchObject;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.paginacion.PagedListWrapper;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.render.RenderMotivoReimpresion;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.context.annotation.Scope;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.zkoss.util.resource.Labels;
|
||||||
|
import org.zkoss.zhtml.Messagebox;
|
||||||
|
import org.zkoss.zk.ui.Component;
|
||||||
|
import org.zkoss.zk.ui.event.Event;
|
||||||
|
import org.zkoss.zk.ui.event.EventListener;
|
||||||
|
import org.zkoss.zul.Paging;
|
||||||
|
import org.zkoss.zul.Textbox;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Rafius
|
||||||
|
*/
|
||||||
|
@Controller("busquedaMotivoReimpresionController")
|
||||||
|
@Scope("prototype")
|
||||||
|
public class BusquedaMotivoReimpresionController extends MyGenericForwardComposer {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private transient PagedListWrapper<MotivoReimpresion> plwMotivoReimpresion;
|
||||||
|
private MyListbox motivoReimpresionList;
|
||||||
|
private Paging pagingMotivoReimpresion;
|
||||||
|
private Textbox txtNombre;
|
||||||
|
|
||||||
|
public Paging getPagingMotivoReimpresion() {
|
||||||
|
return pagingMotivoReimpresion;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPagingMotivoReimpresion(Paging pagingMotivoReimpresion) {
|
||||||
|
this.pagingMotivoReimpresion = pagingMotivoReimpresion;
|
||||||
|
}
|
||||||
|
|
||||||
|
public MyListbox getMotivoReimpresionList() {
|
||||||
|
return motivoReimpresionList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMotivoReimpresionList(MyListbox motivoReimpresionList) {
|
||||||
|
this.motivoReimpresionList = motivoReimpresionList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public PagedListWrapper<MotivoReimpresion> getPlwMotivoReimpresion() {
|
||||||
|
return plwMotivoReimpresion;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPlwMotivoReimpresion(PagedListWrapper<MotivoReimpresion> plwMotivoReimpresion) {
|
||||||
|
this.plwMotivoReimpresion = plwMotivoReimpresion;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onClick$btnPesquisa(Event ev) throws InterruptedException {
|
||||||
|
refreshLista();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onClick$btnRefresh(Event ev) {
|
||||||
|
refreshLista();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onClick$btnNovo(Event ev) {
|
||||||
|
verPeriodo(new MotivoReimpresion());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void doAfterCompose(Component comp) throws Exception {
|
||||||
|
super.doAfterCompose(comp);
|
||||||
|
|
||||||
|
motivoReimpresionList.setItemRenderer(new RenderMotivoReimpresion());
|
||||||
|
motivoReimpresionList.addEventListener("onDoubleClick", new EventListener() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onEvent(Event event) throws Exception {
|
||||||
|
MotivoReimpresion mr = (MotivoReimpresion) motivoReimpresionList.getSelected();
|
||||||
|
verPeriodo(mr);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
refreshLista();
|
||||||
|
|
||||||
|
txtNombre.focus();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void verPeriodo(MotivoReimpresion mr) {
|
||||||
|
if (mr == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Map args = new HashMap();
|
||||||
|
args.put("motivoReimpresion", mr);
|
||||||
|
args.put("motivoReimpresionList", motivoReimpresionList);
|
||||||
|
|
||||||
|
openWindow("/gui/configuraciones_comerciales/editarMotivoReimpresion.zul",
|
||||||
|
Labels.getLabel("editarMotivoReimpresionController.window.title"), args, MODAL);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void refreshLista() {
|
||||||
|
HibernateSearchObject<MotivoReimpresion> claseServicioBusqueda =
|
||||||
|
new HibernateSearchObject<MotivoReimpresion>(MotivoReimpresion.class, pagingMotivoReimpresion.getPageSize());
|
||||||
|
|
||||||
|
claseServicioBusqueda.addFilterLike("descmotivo", "%" + txtNombre.getText().trim().concat("%"));
|
||||||
|
claseServicioBusqueda.addFilterEqual("activo", true);
|
||||||
|
claseServicioBusqueda.addSortAsc("descmotivo");
|
||||||
|
|
||||||
|
plwMotivoReimpresion.init(claseServicioBusqueda, motivoReimpresionList, pagingMotivoReimpresion);
|
||||||
|
|
||||||
|
if (motivoReimpresionList.getData().length == 0) {
|
||||||
|
try {
|
||||||
|
Messagebox.show(Labels.getLabel("MSG.ningunRegistro"),
|
||||||
|
Labels.getLabel("busquedaMotivoReimpresionController.window.title"),
|
||||||
|
Messagebox.OK, Messagebox.INFORMATION);
|
||||||
|
} catch (InterruptedException ex) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,147 @@
|
||||||
|
/*
|
||||||
|
* To change this template, choose Tools | Templates
|
||||||
|
* and open the template in the editor.
|
||||||
|
*/
|
||||||
|
package com.rjconsultores.ventaboletos.web.gui.controladores.configuracioneccomerciales;
|
||||||
|
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.PeriodoVacacional;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.MyGenericForwardComposer;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.MyListbox;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.paginacion.HibernateSearchObject;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.paginacion.PagedListWrapper;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.render.RenderPeriodoVacacional;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.context.annotation.Scope;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.zkoss.util.resource.Labels;
|
||||||
|
import org.zkoss.zk.ui.Component;
|
||||||
|
import org.zkoss.zk.ui.event.Event;
|
||||||
|
import org.zkoss.zk.ui.event.EventListener;
|
||||||
|
import org.zkoss.zul.Datebox;
|
||||||
|
import org.zkoss.zul.Messagebox;
|
||||||
|
import org.zkoss.zul.Paging;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Rafius
|
||||||
|
*/
|
||||||
|
@Controller("busquedaPeriodoVacacionalController")
|
||||||
|
@Scope("prototype")
|
||||||
|
public class BusquedaPeriodoVacacionalController extends MyGenericForwardComposer {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private transient PagedListWrapper<PeriodoVacacional> plwPeriodoVacacional;
|
||||||
|
private MyListbox periodoVacacionalList;
|
||||||
|
private Paging pagingPeriodoVacacional;
|
||||||
|
private Datebox fecInicio;
|
||||||
|
private Datebox fecFinal;
|
||||||
|
|
||||||
|
public Paging getPagingPeriodoVacacional() {
|
||||||
|
return pagingPeriodoVacacional;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPagingPeriodoVacacional(Paging pagingPeriodoVacacional) {
|
||||||
|
this.pagingPeriodoVacacional = pagingPeriodoVacacional;
|
||||||
|
}
|
||||||
|
|
||||||
|
public MyListbox getPeriodoVacacionalList() {
|
||||||
|
return periodoVacacionalList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPeriodoVacacionalList(MyListbox periodoVacacionalList) {
|
||||||
|
this.periodoVacacionalList = periodoVacacionalList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public PagedListWrapper<PeriodoVacacional> getPlwPeriodoVacacional() {
|
||||||
|
return plwPeriodoVacacional;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPlwPeriodoVacacional(PagedListWrapper<PeriodoVacacional> plwPeriodoVacacional) {
|
||||||
|
this.plwPeriodoVacacional = plwPeriodoVacacional;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onClick$btnPesquisa(Event ev) throws InterruptedException {
|
||||||
|
if (fecInicio.getValue() != null && fecFinal.getValue() != null) {
|
||||||
|
if (fecInicio.getValue().after(fecFinal.getValue())) {
|
||||||
|
Messagebox.show(
|
||||||
|
Labels.getLabel("editarPeriodoVacacionalController.MSG.busquedaPeriodo"),
|
||||||
|
Labels.getLabel("editarPeriodoVacacionalController.window.title"),
|
||||||
|
Messagebox.OK, Messagebox.INFORMATION);
|
||||||
|
} else {
|
||||||
|
refreshLista();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
refreshLista();
|
||||||
|
}
|
||||||
|
|
||||||
|
refreshLista();
|
||||||
|
|
||||||
|
fecInicio.focus();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onClick$btnRefresh(Event ev) {
|
||||||
|
refreshLista();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onClick$btnNovo(Event ev) {
|
||||||
|
verPeriodo(new PeriodoVacacional());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void doAfterCompose(Component comp) throws Exception {
|
||||||
|
super.doAfterCompose(comp);
|
||||||
|
|
||||||
|
periodoVacacionalList.setItemRenderer(new RenderPeriodoVacacional());
|
||||||
|
periodoVacacionalList.addEventListener("onDoubleClick", new EventListener() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onEvent(Event event) throws Exception {
|
||||||
|
PeriodoVacacional pv = (PeriodoVacacional) periodoVacacionalList.getSelected();
|
||||||
|
verPeriodo(pv);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
refreshLista();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void verPeriodo(PeriodoVacacional pv) {
|
||||||
|
if (pv == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Map args = new HashMap();
|
||||||
|
args.put("periodoVacacional", pv);
|
||||||
|
args.put("periodoVacacionalList", periodoVacacionalList);
|
||||||
|
|
||||||
|
openWindow("/gui/configuraciones_comerciales/editarPeriodoVacacional.zul",
|
||||||
|
Labels.getLabel("editarPeriodoVacacionalController.window.title"), args, MODAL);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void refreshLista() {
|
||||||
|
HibernateSearchObject<PeriodoVacacional> claseServicioBusqueda =
|
||||||
|
new HibernateSearchObject<PeriodoVacacional>(PeriodoVacacional.class, pagingPeriodoVacacional.getPageSize());
|
||||||
|
claseServicioBusqueda.addFilterEqual("activo", Boolean.TRUE);
|
||||||
|
|
||||||
|
if (fecInicio.getValue() != null) {
|
||||||
|
claseServicioBusqueda.addFilterGreaterOrEqual("fecinicio", fecInicio.getValue());
|
||||||
|
}
|
||||||
|
if (fecFinal.getValue() != null) {
|
||||||
|
claseServicioBusqueda.addFilterLessOrEqual("fecfinal", fecFinal.getValue());
|
||||||
|
}
|
||||||
|
|
||||||
|
claseServicioBusqueda.addSortAsc("fecinicio");
|
||||||
|
|
||||||
|
plwPeriodoVacacional.init(claseServicioBusqueda, periodoVacacionalList, pagingPeriodoVacacional);
|
||||||
|
|
||||||
|
if (periodoVacacionalList.getData().length == 0) {
|
||||||
|
try {
|
||||||
|
Messagebox.show(Labels.getLabel("MSG.ningunRegistro"),
|
||||||
|
Labels.getLabel("busquedaPeriodoVacacionalController.window.title"),
|
||||||
|
Messagebox.OK, Messagebox.INFORMATION);
|
||||||
|
} catch (InterruptedException ex) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,135 @@
|
||||||
|
/*
|
||||||
|
* To change this template, choose Tools | Templates
|
||||||
|
* and open the template in the editor.
|
||||||
|
*/
|
||||||
|
package com.rjconsultores.ventaboletos.web.gui.controladores.configuracioneccomerciales;
|
||||||
|
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.ConfigRestriccionPago;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.MyGenericForwardComposer;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.MyListbox;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.paginacion.HibernateSearchObject;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.paginacion.PagedListWrapper;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.render.RenderRestriccionFormaPago;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.context.annotation.Scope;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.zkoss.util.resource.Labels;
|
||||||
|
import org.zkoss.zhtml.Messagebox;
|
||||||
|
import org.zkoss.zk.ui.Component;
|
||||||
|
import org.zkoss.zk.ui.event.Event;
|
||||||
|
import org.zkoss.zk.ui.event.EventListener;
|
||||||
|
import org.zkoss.zul.Paging;
|
||||||
|
import org.zkoss.zul.Textbox;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Administrador
|
||||||
|
*/
|
||||||
|
@Controller("busquedaRestriccionFormaPagoController")
|
||||||
|
@Scope("prototype")
|
||||||
|
public class BusquedaRestriccionFormaPagoController extends MyGenericForwardComposer {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private transient PagedListWrapper<ConfigRestriccionPago> plwRestriccionFormaPago;
|
||||||
|
private MyListbox restriccionFormaPagoList;
|
||||||
|
private Paging pagingrestriccionFormaPago;
|
||||||
|
private Textbox txtNome;
|
||||||
|
|
||||||
|
public Paging getPagingrestriccionFormaPago() {
|
||||||
|
return pagingrestriccionFormaPago;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPagingrestriccionFormaPago(Paging pagingrestriccionFormaPago) {
|
||||||
|
this.pagingrestriccionFormaPago = pagingrestriccionFormaPago;
|
||||||
|
}
|
||||||
|
|
||||||
|
public MyListbox getRestriccionFormaPagoList() {
|
||||||
|
return restriccionFormaPagoList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRestriccionFormaPagoList(MyListbox restriccionFormaPagoList) {
|
||||||
|
this.restriccionFormaPagoList = restriccionFormaPagoList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Textbox getTxtNome() {
|
||||||
|
return txtNome;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTxtNome(Textbox txtNome) {
|
||||||
|
this.txtNome = txtNome;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void doAfterCompose(Component comp) throws Exception {
|
||||||
|
super.doAfterCompose(comp);
|
||||||
|
|
||||||
|
restriccionFormaPagoList.setItemRenderer(new RenderRestriccionFormaPago());
|
||||||
|
restriccionFormaPagoList.addEventListener("onDoubleClick",
|
||||||
|
new EventListener() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onEvent(Event event) throws Exception {
|
||||||
|
ConfigRestriccionPago c =
|
||||||
|
(ConfigRestriccionPago) restriccionFormaPagoList.getSelected();
|
||||||
|
verConfigRestriccionPago(c);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
refreshLista();
|
||||||
|
|
||||||
|
txtNome.focus();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void verConfigRestriccionPago(ConfigRestriccionPago c) {
|
||||||
|
if (c == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Map args = new HashMap();
|
||||||
|
args.put("configRestriccionPago", c);
|
||||||
|
args.put("configRestriccionFormaPagoList", restriccionFormaPagoList);
|
||||||
|
|
||||||
|
openWindow("/gui/configuraciones_comerciales/editarRestriccionFormaPago.zul",
|
||||||
|
Labels.getLabel("editarRestriccionFormaPagoController.window.title"),
|
||||||
|
args, MODAL);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void refreshLista() {
|
||||||
|
HibernateSearchObject<ConfigRestriccionPago> configRestriccionPagoBusqueda =
|
||||||
|
new HibernateSearchObject<ConfigRestriccionPago>(
|
||||||
|
ConfigRestriccionPago.class,
|
||||||
|
pagingrestriccionFormaPago.getPageSize());
|
||||||
|
|
||||||
|
configRestriccionPagoBusqueda.addFilterLike("formaPago.descpago",
|
||||||
|
"%" + txtNome.getText().trim().concat("%"));
|
||||||
|
|
||||||
|
configRestriccionPagoBusqueda.addSortAsc("formaPago.descpago");
|
||||||
|
configRestriccionPagoBusqueda.addFilterEqual("activo", Boolean.TRUE);
|
||||||
|
|
||||||
|
plwRestriccionFormaPago.init(configRestriccionPagoBusqueda,
|
||||||
|
restriccionFormaPagoList, pagingrestriccionFormaPago);
|
||||||
|
|
||||||
|
if (restriccionFormaPagoList.getData().length == 0) {
|
||||||
|
try {
|
||||||
|
Messagebox.show(Labels.getLabel("MSG.ningunRegistro"),
|
||||||
|
Labels.getLabel("busquedaRestriccionFormaPagoController.window.title"),
|
||||||
|
Messagebox.OK, Messagebox.INFORMATION);
|
||||||
|
} catch (InterruptedException ex) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onClick$btnPesquisa(Event ev) {
|
||||||
|
refreshLista();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onClick$btnRefresh(Event ev) {
|
||||||
|
refreshLista();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onClick$btnNovo(Event ev) {
|
||||||
|
verConfigRestriccionPago(new ConfigRestriccionPago());
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,143 @@
|
||||||
|
/*
|
||||||
|
* To change this template, choose Tools | Templates
|
||||||
|
* and open the template in the editor.
|
||||||
|
*/
|
||||||
|
package com.rjconsultores.ventaboletos.web.gui.controladores.configuracioneccomerciales;
|
||||||
|
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.Secretaria;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.MyGenericForwardComposer;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.MyListbox;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.paginacion.HibernateSearchObject;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.paginacion.PagedListWrapper;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.render.RenderSecretaria;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.context.annotation.Scope;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.zkoss.util.resource.Labels;
|
||||||
|
import org.zkoss.zhtml.Messagebox;
|
||||||
|
import org.zkoss.zk.ui.Component;
|
||||||
|
import org.zkoss.zk.ui.event.Event;
|
||||||
|
import org.zkoss.zk.ui.event.EventListener;
|
||||||
|
import org.zkoss.zul.Paging;
|
||||||
|
import org.zkoss.zul.Textbox;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Administrador
|
||||||
|
*/
|
||||||
|
@Controller("busquedaSecretariaController")
|
||||||
|
@Scope("prototype")
|
||||||
|
public class BusquedaSecretariaController extends MyGenericForwardComposer {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private transient PagedListWrapper<Secretaria> plwSecretaria;
|
||||||
|
private MyListbox secretariaList;
|
||||||
|
private Paging pagingSecretaria;
|
||||||
|
private Textbox txtDescSecretaria;
|
||||||
|
private Textbox txtCveSecretaria;
|
||||||
|
|
||||||
|
public Paging getPagingSecretaria() {
|
||||||
|
return pagingSecretaria;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPagingSecretaria(Paging pagingSecretaria) {
|
||||||
|
this.pagingSecretaria = pagingSecretaria;
|
||||||
|
}
|
||||||
|
|
||||||
|
public MyListbox getSecretariaList() {
|
||||||
|
return secretariaList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSecretariaList(MyListbox secretariaList) {
|
||||||
|
this.secretariaList = secretariaList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Textbox getTxtCveSecretaria() {
|
||||||
|
return txtCveSecretaria;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTxtCveSecretaria(Textbox txtCveSecretaria) {
|
||||||
|
this.txtCveSecretaria = txtCveSecretaria;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Textbox getTxtDescSecretaria() {
|
||||||
|
return txtDescSecretaria;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTxtDescSecretaria(Textbox txtDescSecretaria) {
|
||||||
|
this.txtDescSecretaria = txtDescSecretaria;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void doAfterCompose(Component comp) throws Exception {
|
||||||
|
super.doAfterCompose(comp);
|
||||||
|
|
||||||
|
secretariaList.setItemRenderer(new RenderSecretaria());
|
||||||
|
secretariaList.addEventListener("onDoubleClick", new EventListener() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onEvent(Event event) throws Exception {
|
||||||
|
Secretaria c = (Secretaria) secretariaList.getSelected();
|
||||||
|
verSecretaria(c);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
refreshLista();
|
||||||
|
|
||||||
|
txtDescSecretaria.focus();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void verSecretaria(Secretaria s) {
|
||||||
|
if (s == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Map args = new HashMap();
|
||||||
|
args.put("secretaria", s);
|
||||||
|
args.put("secretariaList", secretariaList);
|
||||||
|
|
||||||
|
openWindow("/gui/configuraciones_comerciales/editarSecretaria.zul",
|
||||||
|
Labels.getLabel("busquedaSecretariaController.window.title"),
|
||||||
|
args, MODAL);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void refreshLista() {
|
||||||
|
HibernateSearchObject<Secretaria> secretariaBusqueda =
|
||||||
|
new HibernateSearchObject<Secretaria>(Secretaria.class,
|
||||||
|
pagingSecretaria.getPageSize());
|
||||||
|
|
||||||
|
secretariaBusqueda.addFilterEqual("activo", Boolean.TRUE);
|
||||||
|
|
||||||
|
secretariaBusqueda.addFilterLike("descsecretaria",
|
||||||
|
"%" + txtDescSecretaria.getText().trim().concat("%"));
|
||||||
|
secretariaBusqueda.addFilterLike("cvesecretaria",
|
||||||
|
"%" + txtCveSecretaria.getText().trim().concat("%"));
|
||||||
|
|
||||||
|
secretariaBusqueda.addSortAsc("descsecretaria");
|
||||||
|
|
||||||
|
plwSecretaria.init(secretariaBusqueda, secretariaList, pagingSecretaria);
|
||||||
|
|
||||||
|
if (secretariaList.getData().length == 0) {
|
||||||
|
try {
|
||||||
|
Messagebox.show(Labels.getLabel("MSG.ningunRegistro"),
|
||||||
|
Labels.getLabel("busquedaSecretariaController.window.title"),
|
||||||
|
Messagebox.OK, Messagebox.INFORMATION);
|
||||||
|
} catch (InterruptedException ex) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onClick$btnPesquisa(Event ev) {
|
||||||
|
refreshLista();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onClick$btnRefresh(Event ev) {
|
||||||
|
refreshLista();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onClick$btnNovo(Event ev) {
|
||||||
|
verSecretaria(new Secretaria());
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,214 @@
|
||||||
|
/*
|
||||||
|
* To change this template, choose Tools | Templates
|
||||||
|
* and open the template in the editor.
|
||||||
|
*/
|
||||||
|
package com.rjconsultores.ventaboletos.web.gui.controladores.configuracioneccomerciales;
|
||||||
|
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.Ciudad;
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.Moneda;
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.TipoCambioCtrl;
|
||||||
|
import com.rjconsultores.ventaboletos.service.MonedaService;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.MyGenericForwardComposer;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.MyListbox;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.paginacion.HibernateSearchObject;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.paginacion.PagedListWrapper;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.render.RenderTipoCambioCtrl;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import com.trg.search.Filter;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.context.annotation.Scope;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.zkoss.util.resource.Labels;
|
||||||
|
import org.zkoss.zk.ui.Component;
|
||||||
|
import org.zkoss.zk.ui.event.Event;
|
||||||
|
import org.zkoss.zk.ui.event.EventListener;
|
||||||
|
import org.zkoss.zul.Combobox;
|
||||||
|
import org.zkoss.zul.Comboitem;
|
||||||
|
import org.zkoss.zul.Datebox;
|
||||||
|
import org.zkoss.zul.Decimalbox;
|
||||||
|
import org.zkoss.zul.Messagebox;
|
||||||
|
import org.zkoss.zul.Paging;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Administrador
|
||||||
|
*/
|
||||||
|
@Controller("busquedaTipoCambioCiudadController")
|
||||||
|
@Scope("prototype")
|
||||||
|
public class BusquedaTipoCambioCiudadController extends MyGenericForwardComposer {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private transient PagedListWrapper<TipoCambioCtrl> plwTipoCambioCiudad;
|
||||||
|
@Autowired
|
||||||
|
private MonedaService monedaService;
|
||||||
|
private MyListbox tipoCambioCiudadList;
|
||||||
|
private Paging pagingTipoCambioCiudad;
|
||||||
|
private Combobox cmbMonedaOrigen;
|
||||||
|
private Combobox cmbMonedaDestino;
|
||||||
|
private Combobox cmbCiudad;
|
||||||
|
private List<Moneda> lsMoneda;
|
||||||
|
private Decimalbox decImportecambio;
|
||||||
|
private Datebox dtFecaplicacionAte;
|
||||||
|
private Datebox dtFecaplicacionDe;
|
||||||
|
|
||||||
|
public Combobox getCmbMonedaDestino() {
|
||||||
|
return cmbMonedaDestino;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCmbMonedaDestino(Combobox cmbMonedaDestino) {
|
||||||
|
this.cmbMonedaDestino = cmbMonedaDestino;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Combobox getCmbMonedaOrigen() {
|
||||||
|
return cmbMonedaOrigen;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCmbMonedaOrigen(Combobox cmbMonedaOrigen) {
|
||||||
|
this.cmbMonedaOrigen = cmbMonedaOrigen;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Decimalbox getDecImportecambio() {
|
||||||
|
return decImportecambio;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDecImportecambio(Decimalbox decImportecambio) {
|
||||||
|
this.decImportecambio = decImportecambio;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<Moneda> getLsMoneda() {
|
||||||
|
return lsMoneda;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLsMoneda(List<Moneda> lsMoneda) {
|
||||||
|
this.lsMoneda = lsMoneda;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Paging getPagingTipoCambioCiudad() {
|
||||||
|
return pagingTipoCambioCiudad;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPagingTipoCambioCiudad(Paging pagingTipoCambioCiudad) {
|
||||||
|
this.pagingTipoCambioCiudad = pagingTipoCambioCiudad;
|
||||||
|
}
|
||||||
|
|
||||||
|
public MyListbox getTipoCambioCiudadList() {
|
||||||
|
return tipoCambioCiudadList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTipoCambioCiudadList(MyListbox tipoCambioCiudadList) {
|
||||||
|
this.tipoCambioCiudadList = tipoCambioCiudadList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Datebox getDtFecaplicacionAte() {
|
||||||
|
return dtFecaplicacionAte;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDtFecaplicacionAte(Datebox dtFecaplicacionAte) {
|
||||||
|
this.dtFecaplicacionAte = dtFecaplicacionAte;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Datebox getDtFecaplicacionDe() {
|
||||||
|
return dtFecaplicacionDe;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDtFecaplicacionDe(Datebox dtFecaplicacionDe) {
|
||||||
|
this.dtFecaplicacionDe = dtFecaplicacionDe;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void doAfterCompose(Component comp) throws Exception {
|
||||||
|
super.doAfterCompose(comp);
|
||||||
|
|
||||||
|
lsMoneda = monedaService.obtenerTodos();
|
||||||
|
|
||||||
|
tipoCambioCiudadList.setItemRenderer(new RenderTipoCambioCtrl());
|
||||||
|
tipoCambioCiudadList.addEventListener("onDoubleClick", new EventListener() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onEvent(Event event) throws Exception {
|
||||||
|
TipoCambioCtrl c = (TipoCambioCtrl) tipoCambioCiudadList.getSelected();
|
||||||
|
verTipoCambioCiudad(c);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
refreshLista();
|
||||||
|
dtFecaplicacionDe.focus();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void verTipoCambioCiudad(TipoCambioCtrl c) {
|
||||||
|
if (c == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Map args = new HashMap();
|
||||||
|
args.put("tipoCambioCtrl", c);
|
||||||
|
args.put("tipoCambioCiudadList", tipoCambioCiudadList);
|
||||||
|
|
||||||
|
openWindow("/gui/configuraciones_comerciales/editarTipoCambioCiudad.zul",
|
||||||
|
Labels.getLabel("busquedaTipoCambioCiudadController.window.title"),
|
||||||
|
args, MODAL);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void refreshLista() {
|
||||||
|
HibernateSearchObject<TipoCambioCtrl> tipoCambioCidadBusqueda =
|
||||||
|
new HibernateSearchObject<TipoCambioCtrl>(TipoCambioCtrl.class,
|
||||||
|
pagingTipoCambioCiudad.getPageSize());
|
||||||
|
|
||||||
|
tipoCambioCidadBusqueda.addFilterEqual("importecambio", decImportecambio.getValue());
|
||||||
|
|
||||||
|
Comboitem itemMonedaOrigen = cmbMonedaOrigen.getSelectedItem();
|
||||||
|
Moneda monedaOrigen;
|
||||||
|
if (itemMonedaOrigen != null) {
|
||||||
|
monedaOrigen = (Moneda) itemMonedaOrigen.getValue();
|
||||||
|
tipoCambioCidadBusqueda.addFilterEqual("monedaOrigen", monedaOrigen);
|
||||||
|
}
|
||||||
|
|
||||||
|
Comboitem itemMonedaDestino = cmbMonedaDestino.getSelectedItem();
|
||||||
|
Moneda monedaDestino;
|
||||||
|
if (itemMonedaDestino != null) {
|
||||||
|
monedaDestino = (Moneda) itemMonedaDestino.getValue();
|
||||||
|
tipoCambioCidadBusqueda.addFilterEqual("monedaDestino", monedaDestino);
|
||||||
|
}
|
||||||
|
|
||||||
|
Comboitem itemCiudad = cmbCiudad.getSelectedItem();
|
||||||
|
Ciudad ciudad;
|
||||||
|
if (itemCiudad != null) {
|
||||||
|
ciudad = (Ciudad) itemCiudad.getValue();
|
||||||
|
tipoCambioCidadBusqueda.addFilterSome("tipoCambioCiudadList",
|
||||||
|
Filter.equal("ciudad.ciudadId", ciudad.getCiudadId()));
|
||||||
|
}
|
||||||
|
|
||||||
|
tipoCambioCidadBusqueda.addFilterGreaterOrEqual("fecaplicacion",
|
||||||
|
dtFecaplicacionDe.getValue());
|
||||||
|
tipoCambioCidadBusqueda.addFilterLessOrEqual("fecaplicacion",
|
||||||
|
dtFecaplicacionAte.getValue());
|
||||||
|
|
||||||
|
tipoCambioCidadBusqueda.addFilterEqual("activo", Boolean.TRUE);
|
||||||
|
tipoCambioCidadBusqueda.addSortAsc("tipoCambioCiudadList.ciudad.nombciudad");
|
||||||
|
|
||||||
|
plwTipoCambioCiudad.init(tipoCambioCidadBusqueda, tipoCambioCiudadList, pagingTipoCambioCiudad);
|
||||||
|
|
||||||
|
if (tipoCambioCiudadList.getData().length == 0) {
|
||||||
|
try {
|
||||||
|
Messagebox.show(Labels.getLabel("MSG.ningunRegistro"),
|
||||||
|
Labels.getLabel("busquedaTipoCambioCiudadController.window.title"),
|
||||||
|
Messagebox.OK, Messagebox.INFORMATION);
|
||||||
|
} catch (InterruptedException ex) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onClick$btnPesquisa(Event ev) {
|
||||||
|
refreshLista();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onClick$btnRefresh(Event ev) {
|
||||||
|
refreshLista();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onClick$btnNovo(Event ev) {
|
||||||
|
verTipoCambioCiudad(new TipoCambioCtrl());
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,669 @@
|
||||||
|
/*
|
||||||
|
* To change this template, choose Tools | Templates
|
||||||
|
* and open the template in the editor.
|
||||||
|
*/
|
||||||
|
package com.rjconsultores.ventaboletos.web.gui.controladores.configuracioneccomerciales;
|
||||||
|
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.AlertaCtrl;
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.ClaseServicio;
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.Corrida;
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.Parada;
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.Ruta;
|
||||||
|
import com.rjconsultores.ventaboletos.exception.BusinessException;
|
||||||
|
import com.rjconsultores.ventaboletos.service.AlertaCtrlService;
|
||||||
|
import com.rjconsultores.ventaboletos.service.ClaseServicioService;
|
||||||
|
import com.rjconsultores.ventaboletos.service.CorridaService;
|
||||||
|
import com.rjconsultores.ventaboletos.service.RutaService;
|
||||||
|
import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.MyComboboxParada;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.MyGenericForwardComposer;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.MyListbox;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.MyTextboxDecimal;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Calendar;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
import org.apache.log4j.Logger;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.context.annotation.Scope;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.zkoss.util.resource.Labels;
|
||||||
|
import org.zkoss.zhtml.Messagebox;
|
||||||
|
import org.zkoss.zk.ui.Component;
|
||||||
|
import org.zkoss.zk.ui.Executions;
|
||||||
|
import org.zkoss.zk.ui.event.Event;
|
||||||
|
import org.zkoss.zk.ui.util.Clients;
|
||||||
|
import org.zkoss.zkplus.databind.BindingListModelList;
|
||||||
|
import org.zkoss.zul.Button;
|
||||||
|
import org.zkoss.zul.Checkbox;
|
||||||
|
import org.zkoss.zul.Combobox;
|
||||||
|
import org.zkoss.zul.Comboitem;
|
||||||
|
import org.zkoss.zul.Datebox;
|
||||||
|
import org.zkoss.zul.Intbox;
|
||||||
|
import org.zkoss.zul.Listcell;
|
||||||
|
import org.zkoss.zul.Listitem;
|
||||||
|
import org.zkoss.zul.ListitemRenderer;
|
||||||
|
import org.zkoss.zul.Radio;
|
||||||
|
import org.zkoss.zul.Tab;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Administrador
|
||||||
|
*/
|
||||||
|
@Controller("editarAlertaCtrlController")
|
||||||
|
@Scope("prototype")
|
||||||
|
public class EditarAlertaCtrlController extends MyGenericForwardComposer implements ListitemRenderer {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private AlertaCtrlService arlertaCtrlService;
|
||||||
|
@Autowired
|
||||||
|
private RutaService rutaService;
|
||||||
|
@Autowired
|
||||||
|
private CorridaService corridaService;
|
||||||
|
@Autowired
|
||||||
|
private ClaseServicioService claseServicioService;
|
||||||
|
private List<ClaseServicio> lsClaseServicio;
|
||||||
|
private List<Ruta> lsRuta;
|
||||||
|
private AlertaCtrl alertaCtrl;
|
||||||
|
private MyListbox alertaCtrlList;
|
||||||
|
private Button btnApagar;
|
||||||
|
private MyComboboxParada cmbOrigem;
|
||||||
|
private MyComboboxParada cmbDestino;
|
||||||
|
private MyComboboxParada cmbOrigemCorrida;
|
||||||
|
private MyComboboxParada cmbDestinoCorrida;
|
||||||
|
private MyComboboxParada cmbOrigemBusqueda;
|
||||||
|
private MyComboboxParada cmbDestinoBusqueda;
|
||||||
|
private Combobox cmbTipoServicioBusqueda;
|
||||||
|
private Combobox cmbRuta;
|
||||||
|
private Combobox cmbClaseServicio;
|
||||||
|
private Combobox cmbTipoServicio;
|
||||||
|
private Datebox horaCorrida;
|
||||||
|
private Datebox horaCorridaBusqueda;
|
||||||
|
private Intbox txtIdCorrida;
|
||||||
|
private Intbox txtTiempo;
|
||||||
|
private Intbox txtTiempoCorrida;
|
||||||
|
private MyTextboxDecimal txtPorc;
|
||||||
|
private MyTextboxDecimal txtPorcCorrida;
|
||||||
|
private Radio rdAlta;
|
||||||
|
private Radio rdAltaCorrida;
|
||||||
|
private Radio rdBaja;
|
||||||
|
private Radio rdBajaCorrida;
|
||||||
|
private Radio rdGenerica;
|
||||||
|
private Radio rdCorrida;
|
||||||
|
private Tab tabGenerico;
|
||||||
|
private Tab tabCorrida;
|
||||||
|
private Tab tabOpcion;
|
||||||
|
private Boolean isGenerico;
|
||||||
|
private Checkbox rdLun;
|
||||||
|
private Checkbox rdMar;
|
||||||
|
private Checkbox rdMie;
|
||||||
|
private Checkbox rdJue;
|
||||||
|
private Checkbox rdVie;
|
||||||
|
private Checkbox rdSab;
|
||||||
|
private Checkbox rdDom;
|
||||||
|
private static Logger log = Logger.getLogger(EditarAlertaCtrlController.class);
|
||||||
|
|
||||||
|
public AlertaCtrl getAlertaCtrl() {
|
||||||
|
return alertaCtrl;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAlertaCtrl(AlertaCtrl alertaCtrl) {
|
||||||
|
this.alertaCtrl = alertaCtrl;
|
||||||
|
}
|
||||||
|
|
||||||
|
public MyListbox getAlertaCtrlList() {
|
||||||
|
return alertaCtrlList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAlertaCtrlList(MyListbox alertaCtrlList) {
|
||||||
|
this.alertaCtrlList = alertaCtrlList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Button getBtnApagar() {
|
||||||
|
return btnApagar;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBtnApagar(Button btnApagar) {
|
||||||
|
this.btnApagar = btnApagar;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Combobox getCmbClaseServicio() {
|
||||||
|
return cmbClaseServicio;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCmbClaseServicio(Combobox cmbClaseServicio) {
|
||||||
|
this.cmbClaseServicio = cmbClaseServicio;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Combobox getCmbRuta() {
|
||||||
|
return cmbRuta;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCmbRuta(Combobox cmbRuta) {
|
||||||
|
this.cmbRuta = cmbRuta;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<ClaseServicio> getLsClaseServicio() {
|
||||||
|
return lsClaseServicio;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLsClaseServicio(List<ClaseServicio> lsClaseServicio) {
|
||||||
|
this.lsClaseServicio = lsClaseServicio;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<Ruta> getLsRuta() {
|
||||||
|
return lsRuta;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLsRuta(List<Ruta> lsRuta) {
|
||||||
|
this.lsRuta = lsRuta;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Intbox getTxtIdCorrida() {
|
||||||
|
return txtIdCorrida;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTxtIdCorrida(Intbox txtIdCorrida) {
|
||||||
|
this.txtIdCorrida = txtIdCorrida;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void doAfterCompose(Component comp) throws Exception {
|
||||||
|
super.doAfterCompose(comp);
|
||||||
|
|
||||||
|
alertaCtrl = (AlertaCtrl) Executions.getCurrent().getArg().get("alertaCtrl");
|
||||||
|
alertaCtrlList = (MyListbox) Executions.getCurrent().getArg().get("alertaCtrlList");
|
||||||
|
|
||||||
|
lsClaseServicio = claseServicioService.obtenerTodos();
|
||||||
|
BindingListModelList modelClaseServicio = new BindingListModelList(lsClaseServicio, true);
|
||||||
|
cmbClaseServicio.setModel(modelClaseServicio);
|
||||||
|
|
||||||
|
cmbOrigemCorrida.setDisabled(Boolean.TRUE);
|
||||||
|
cmbDestinoCorrida.setDisabled(Boolean.TRUE);
|
||||||
|
cmbTipoServicio.setDisabled(Boolean.TRUE);
|
||||||
|
|
||||||
|
horaCorrida.setDisabled(Boolean.TRUE);
|
||||||
|
|
||||||
|
if (alertaCtrl.getAlertactrlId() == null) {
|
||||||
|
btnApagar.setVisible(Boolean.FALSE);
|
||||||
|
tabGenerico.setVisible(Boolean.FALSE);
|
||||||
|
tabCorrida.setVisible(Boolean.FALSE);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
if (alertaCtrl.getCorrida() != null) {
|
||||||
|
List<Corrida> lsCorridas = new ArrayList<Corrida>();
|
||||||
|
lsCorridas.add(alertaCtrl.getCorrida());
|
||||||
|
if (alertaCtrl.getPorcalta() != null) {
|
||||||
|
rdAltaCorrida.setSelected(true);
|
||||||
|
txtPorcCorrida.setValue(alertaCtrl.getPorcalta().toString());
|
||||||
|
txtTiempoCorrida.setValue(alertaCtrl.getTiempoalta());
|
||||||
|
} else {
|
||||||
|
rdBajaCorrida.setSelected(true);
|
||||||
|
txtPorcCorrida.setValue(alertaCtrl.getPorcbaja().toString());
|
||||||
|
txtTiempoCorrida.setValue(alertaCtrl.getTiempobaja());
|
||||||
|
}
|
||||||
|
|
||||||
|
horaCorrida.setValue(alertaCtrl.getCorrida().getFechorsalida());
|
||||||
|
|
||||||
|
if (alertaCtrl.getIndlunes() == Boolean.TRUE) {
|
||||||
|
rdLun.setChecked(true);
|
||||||
|
}
|
||||||
|
if (alertaCtrl.getIndmartes() == Boolean.TRUE) {
|
||||||
|
rdMar.setChecked(true);
|
||||||
|
}
|
||||||
|
if (alertaCtrl.getIndmiercoles() == Boolean.TRUE) {
|
||||||
|
rdMie.setChecked(true);
|
||||||
|
}
|
||||||
|
if (alertaCtrl.getIndjueves() == Boolean.TRUE) {
|
||||||
|
rdJue.setChecked(true);
|
||||||
|
}
|
||||||
|
if (alertaCtrl.getIndviernes() == Boolean.TRUE) {
|
||||||
|
rdVie.setChecked(true);
|
||||||
|
}
|
||||||
|
if (alertaCtrl.getIndsabado() == Boolean.TRUE) {
|
||||||
|
rdSab.setChecked(true);
|
||||||
|
}
|
||||||
|
if (alertaCtrl.getInddomingo() == Boolean.TRUE) {
|
||||||
|
rdDom.setChecked(true);
|
||||||
|
}
|
||||||
|
corrida();
|
||||||
|
} else {
|
||||||
|
generico();
|
||||||
|
if (alertaCtrl.getOrigem() != null) {
|
||||||
|
cmbOrigem.setText(alertaCtrl.getOrigem().getDescparada());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (alertaCtrl.getDestino() != null) {
|
||||||
|
cmbDestino.setText(alertaCtrl.getDestino().getDescparada());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (alertaCtrl.getClaseServicio() != null) {
|
||||||
|
cmbClaseServicio.setText(alertaCtrl.getClaseServicio().getDescclase());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (alertaCtrl.getRuta() != null) {
|
||||||
|
cmbRuta.setText(alertaCtrl.getRuta().getDescruta());
|
||||||
|
}
|
||||||
|
if (alertaCtrl.getPorcalta() != null) {
|
||||||
|
rdAlta.setSelected(true);
|
||||||
|
txtPorc.setValue(alertaCtrl.getPorcalta().toString());
|
||||||
|
txtTiempo.setValue(alertaCtrl.getTiempoalta());
|
||||||
|
} else {
|
||||||
|
rdBaja.setSelected(true);
|
||||||
|
txtPorc.setValue(alertaCtrl.getPorcbaja().toString());
|
||||||
|
txtTiempo.setValue(alertaCtrl.getTiempobaja());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void corrida() {
|
||||||
|
tabGenerico.setVisible(Boolean.FALSE);
|
||||||
|
tabOpcion.setVisible(Boolean.FALSE);
|
||||||
|
tabCorrida.setSelected(Boolean.TRUE);
|
||||||
|
isGenerico = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void generico() {
|
||||||
|
tabCorrida.setVisible(Boolean.FALSE);
|
||||||
|
tabOpcion.setVisible(Boolean.FALSE);
|
||||||
|
tabGenerico.setSelected(Boolean.TRUE);
|
||||||
|
isGenerico = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onClick$rdGenerica(Event ev) {
|
||||||
|
generico();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onClick$rdCorrida(Event ev) {
|
||||||
|
corrida();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onClick$btnSalvar(Event ev) throws InterruptedException {
|
||||||
|
if (isGenerico) {
|
||||||
|
cmbRuta.getValue();
|
||||||
|
cmbClaseServicio.getValue();
|
||||||
|
cmbOrigem.getValue();
|
||||||
|
cmbDestino.getValue();
|
||||||
|
txtPorc.getValue();
|
||||||
|
txtTiempo.getValue();
|
||||||
|
} else {
|
||||||
|
txtPorcCorrida.getValue();
|
||||||
|
txtTiempoCorrida.getValue();
|
||||||
|
if (alertaCtrl.getCorrida() == null) {
|
||||||
|
Messagebox.show(Labels.getLabel("editarAlertaCtrlController.MSG.seleccionar.corrida"), Labels.getLabel("editarAlertaCtrlController.window.title"), Messagebox.OK,
|
||||||
|
Messagebox.EXCLAMATION);
|
||||||
|
}
|
||||||
|
if (!rdLun.isChecked() && !rdMar.isChecked() && !rdMie.isChecked() && !rdJue.isChecked() && !rdVie.isChecked() && !rdSab.isChecked() && !rdDom.isChecked()) {
|
||||||
|
Clients.alert(Labels.getLabel("editarAlertaCtrlController.MSG.obligatorioDia"), Labels.getLabel("editarAlertaCtrlController.window.title"), Messagebox.EXCLAMATION);
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
if (isGenerico) {
|
||||||
|
if (!rdAlta.isChecked() && !rdBaja.isChecked()) {
|
||||||
|
Messagebox.show(Labels.getLabel("editarAlertaCtrlController.MSG.necessitaTipo"), Labels.getLabel("editarAlertaCtrlController.window.title"), Messagebox.OK,
|
||||||
|
Messagebox.EXCLAMATION);
|
||||||
|
return;
|
||||||
|
} else if (rdAlta.isChecked()) {
|
||||||
|
alertaCtrl.setPorcalta(txtPorc.getValueDecimal());
|
||||||
|
alertaCtrl.setPorcbaja(null);
|
||||||
|
|
||||||
|
alertaCtrl.setTiempoalta(txtTiempo.getValue());
|
||||||
|
alertaCtrl.setTiempobaja(null);
|
||||||
|
} else if (rdBaja.isChecked()) {
|
||||||
|
alertaCtrl.setPorcalta(null);
|
||||||
|
alertaCtrl.setPorcbaja(txtPorc.getValueDecimal());
|
||||||
|
|
||||||
|
alertaCtrl.setTiempoalta(null);
|
||||||
|
alertaCtrl.setTiempobaja(txtTiempo.getValue());
|
||||||
|
}
|
||||||
|
Parada origem = (Parada) (cmbOrigem.getSelectedItem() == null ? null : cmbOrigem.getSelectedItem().getValue());
|
||||||
|
if (origem != null) {
|
||||||
|
alertaCtrl.setOrigem(origem);
|
||||||
|
} else {
|
||||||
|
Messagebox.show(Labels.getLabel("MSG.necesita.origen"), Labels.getLabel("editarAlertaCtrlController.window.title"), Messagebox.OK, Messagebox.EXCLAMATION);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Parada destino = (Parada) (cmbDestino.getSelectedItem() == null ? null : cmbDestino.getSelectedItem().getValue());
|
||||||
|
if (destino != null) {
|
||||||
|
alertaCtrl.setDestino(destino);
|
||||||
|
} else {
|
||||||
|
Messagebox.show(Labels.getLabel("MSG.necesita.destino"), Labels.getLabel("editarAlertaCtrlController.window.title"), Messagebox.OK, Messagebox.EXCLAMATION);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Ruta ruta = (Ruta) (cmbRuta.getSelectedItem() == null ? null : cmbRuta.getSelectedItem().getValue());
|
||||||
|
if (ruta != null) {
|
||||||
|
alertaCtrl.setRuta(ruta);
|
||||||
|
}
|
||||||
|
|
||||||
|
ClaseServicio claseServicio = (ClaseServicio) (cmbClaseServicio.getSelectedItem() == null ? null : cmbClaseServicio.getSelectedItem().getValue());
|
||||||
|
if (claseServicio != null) {
|
||||||
|
alertaCtrl.setClaseServicio(claseServicio);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (!rdAltaCorrida.isChecked() && !rdBajaCorrida.isChecked()) {
|
||||||
|
Messagebox.show(Labels.getLabel("editarAlertaCtrlController.MSG.necessitaTipo"), Labels.getLabel("editarAlertaCtrlController.window.title"), Messagebox.OK,
|
||||||
|
Messagebox.EXCLAMATION);
|
||||||
|
return;
|
||||||
|
} else if (rdAltaCorrida.isChecked()) {
|
||||||
|
alertaCtrl.setPorcalta(txtPorcCorrida.getValueDecimal());
|
||||||
|
alertaCtrl.setPorcbaja(null);
|
||||||
|
|
||||||
|
alertaCtrl.setTiempoalta(txtTiempoCorrida.getValue());
|
||||||
|
alertaCtrl.setTiempobaja(null);
|
||||||
|
} else if (rdBajaCorrida.isChecked()) {
|
||||||
|
alertaCtrl.setPorcalta(null);
|
||||||
|
alertaCtrl.setPorcbaja(txtPorcCorrida.getValueDecimal());
|
||||||
|
|
||||||
|
alertaCtrl.setTiempoalta(null);
|
||||||
|
alertaCtrl.setTiempobaja(txtTiempoCorrida.getValue());
|
||||||
|
}
|
||||||
|
alertaCtrl.setRuta(alertaCtrl.getCorrida().getRuta());
|
||||||
|
alertaCtrl.setClaseServicio(alertaCtrl.getCorrida().getClaseServicio());
|
||||||
|
alertaCtrl.setOrigem(alertaCtrl.getCorrida().getOrigem());
|
||||||
|
alertaCtrl.setDestino(alertaCtrl.getCorrida().getDestino());
|
||||||
|
}
|
||||||
|
|
||||||
|
alertaCtrl.setActivo(Boolean.TRUE);
|
||||||
|
alertaCtrl.setFecmodif(Calendar.getInstance().getTime());
|
||||||
|
alertaCtrl.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
|
||||||
|
|
||||||
|
List<AlertaCtrl> lsAlertaCtrl = new ArrayList<AlertaCtrl>();
|
||||||
|
if (isGenerico) {
|
||||||
|
Integer tiempoAlta = alertaCtrl.getTiempoalta();
|
||||||
|
Integer tiempoBaja = alertaCtrl.getTiempobaja();
|
||||||
|
BigDecimal percAlta = alertaCtrl.getPorcalta();
|
||||||
|
BigDecimal percBaja = alertaCtrl.getPorcbaja();
|
||||||
|
|
||||||
|
lsAlertaCtrl = arlertaCtrlService.buscar(alertaCtrl.getOrigem(), alertaCtrl.getDestino(), alertaCtrl.getRuta(), alertaCtrl.getClaseServicio(), tiempoAlta,
|
||||||
|
tiempoBaja, percAlta, percBaja);
|
||||||
|
|
||||||
|
boolean podeSalvar = false;
|
||||||
|
if (lsAlertaCtrl.isEmpty()) {
|
||||||
|
podeSalvar = true;
|
||||||
|
} else {
|
||||||
|
if (alertaCtrl.getAlertactrlId() != null) {
|
||||||
|
for (AlertaCtrl c : lsAlertaCtrl) {
|
||||||
|
if (c.getAlertactrlId().equals(alertaCtrl.getAlertactrlId())) {
|
||||||
|
podeSalvar = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!podeSalvar) {
|
||||||
|
Messagebox.show(Labels.getLabel("MSG.Registro.Existe"), Labels.getLabel("editarAlertaCtrlController.window.title"), Messagebox.OK, Messagebox.EXCLAMATION);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
alertaCtrl.setIndlunes(rdLun.isChecked() ? Boolean.TRUE : Boolean.FALSE);
|
||||||
|
alertaCtrl.setIndmartes(rdMar.isChecked() ? Boolean.TRUE : Boolean.FALSE);
|
||||||
|
alertaCtrl.setIndmiercoles(rdMie.isChecked() ? Boolean.TRUE : Boolean.FALSE);
|
||||||
|
alertaCtrl.setIndjueves(rdJue.isChecked() ? Boolean.TRUE : Boolean.FALSE);
|
||||||
|
alertaCtrl.setIndviernes(rdVie.isChecked() ? Boolean.TRUE : Boolean.FALSE);
|
||||||
|
alertaCtrl.setIndsabado(rdSab.isChecked() ? Boolean.TRUE : Boolean.FALSE);
|
||||||
|
alertaCtrl.setInddomingo(rdDom.isChecked() ? Boolean.TRUE : Boolean.FALSE);
|
||||||
|
|
||||||
|
if (!noTraslapa()) {
|
||||||
|
Messagebox.show(Labels.getLabel("editarAlertaCtrlController.MSG.traslapa"), Labels.getLabel("editarAlertaCtrlController.window.title"), Messagebox.OK,
|
||||||
|
Messagebox.EXCLAMATION);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
alertaCtrl = arlertaCtrlService.suscribirActualizar(alertaCtrl);
|
||||||
|
if (alertaCtrl.getAlertactrlId() == null) {
|
||||||
|
alertaCtrlList.addItem(alertaCtrl);
|
||||||
|
} else {
|
||||||
|
alertaCtrlList.updateItem(alertaCtrl);
|
||||||
|
}
|
||||||
|
|
||||||
|
Messagebox.show(Labels.getLabel("editarAlertaCtrlController.MSG.suscribirOK"), Labels.getLabel("editarAlertaCtrlController.window.title"), Messagebox.OK,
|
||||||
|
Messagebox.INFORMATION);
|
||||||
|
|
||||||
|
closeWindow();
|
||||||
|
|
||||||
|
} catch (BusinessException ex) {
|
||||||
|
Messagebox.show(ex.getLocalizedMessage(), Labels.getLabel("editarAlertaCtrlController.window.title"), Messagebox.OK, Messagebox.ERROR);
|
||||||
|
} catch (Exception ex) {
|
||||||
|
log.error("editarAlertaCtrlController: " + ex, ex);
|
||||||
|
Messagebox.show(Labels.getLabel("MSG.Error"), Labels.getLabel("editarAlertaCtrlController.window.title"), Messagebox.OK, Messagebox.ERROR);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onClick$btnApagar(Event ev) {
|
||||||
|
try {
|
||||||
|
int resp = Messagebox.show(Labels.getLabel("editarAlertaCtrlController.MSG.borrarPergunta"), Labels.getLabel("editarAlertaCtrlController.window.title"), Messagebox.YES
|
||||||
|
| Messagebox.NO, Messagebox.QUESTION);
|
||||||
|
|
||||||
|
if (resp == Messagebox.YES) {
|
||||||
|
|
||||||
|
arlertaCtrlService.borrar(alertaCtrl);
|
||||||
|
|
||||||
|
Messagebox.show(Labels.getLabel("editarAlertaCtrlController.MSG.borrarOK"), Labels.getLabel("editarAlertaCtrlController.window.title"), Messagebox.OK,
|
||||||
|
Messagebox.INFORMATION);
|
||||||
|
|
||||||
|
alertaCtrlList.removeItem(alertaCtrl);
|
||||||
|
|
||||||
|
closeWindow();
|
||||||
|
}
|
||||||
|
} catch (Exception ex) {
|
||||||
|
log.error(ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onChange$cmbClaseServicio(Event ev) {
|
||||||
|
Comboitem cbiClaseServicio = cmbClaseServicio.getSelectedItem();
|
||||||
|
|
||||||
|
if (cbiClaseServicio != null) {
|
||||||
|
ClaseServicio claseServicio = (ClaseServicio) cbiClaseServicio.getValue();
|
||||||
|
lsRuta = rutaService.buscarPorClaseServicio(claseServicio);
|
||||||
|
|
||||||
|
cmbRuta.setConstraint("");
|
||||||
|
|
||||||
|
cmbRuta.setSelectedItem(null);
|
||||||
|
cmbRuta.setText(null);
|
||||||
|
|
||||||
|
BindingListModelList modelRuta = new BindingListModelList(lsRuta, true);
|
||||||
|
cmbRuta.setModel(modelRuta);
|
||||||
|
|
||||||
|
cmbRuta.setConstraint("no empty");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onClick$btnProcurarCorrida(Event ev) throws InterruptedException {
|
||||||
|
|
||||||
|
Integer idCorrida = txtIdCorrida.getValue();
|
||||||
|
if (idCorrida != null) {
|
||||||
|
List<Corrida> lsCorrida = corridaService.buscarPorId(idCorrida);
|
||||||
|
|
||||||
|
if (lsCorrida.isEmpty()) {
|
||||||
|
Messagebox.show(Labels.getLabel("MSG.ningunRegistro"), Labels.getLabel("editarAlertaCtrlController.window.title"), Messagebox.OK, Messagebox.INFORMATION);
|
||||||
|
} else {
|
||||||
|
alertaCtrl.setCorrida(lsCorrida.get(0));
|
||||||
|
horaCorrida.setValue(alertaCtrl.getCorrida().getFechorsalida());
|
||||||
|
cmbOrigemCorrida.setText(alertaCtrl.getCorrida().getOrigem().getDescparada());
|
||||||
|
cmbDestinoCorrida.setText(alertaCtrl.getCorrida().getDestino().getDescparada());
|
||||||
|
cmbTipoServicio.setText(alertaCtrl.getCorrida().getClaseServicio().getDescclase());
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
|
||||||
|
cmbOrigemBusqueda.getValue();
|
||||||
|
cmbDestinoBusqueda.getValue();
|
||||||
|
horaCorridaBusqueda.getValue();
|
||||||
|
cmbTipoServicioBusqueda.getValue();
|
||||||
|
|
||||||
|
Parada ori = (Parada) cmbOrigemBusqueda.getSelectedItem().getValue();
|
||||||
|
Parada des = (Parada) cmbDestinoBusqueda.getSelectedItem().getValue();
|
||||||
|
Date hora = horaCorridaBusqueda.getValue();
|
||||||
|
ClaseServicio cs = (ClaseServicio) cmbTipoServicioBusqueda.getSelectedItem().getValue();
|
||||||
|
|
||||||
|
List<Corrida> lsCorrida = corridaService.buscarFiltro(ori, des, hora, cs);
|
||||||
|
|
||||||
|
if (lsCorrida.isEmpty()) {
|
||||||
|
Messagebox.show(Labels.getLabel("MSG.ningunRegistro"), Labels.getLabel("editarAlertaCtrlController.window.title"), Messagebox.OK, Messagebox.INFORMATION);
|
||||||
|
} else {
|
||||||
|
alertaCtrl.setCorrida(lsCorrida.get(0));
|
||||||
|
horaCorrida.setValue(alertaCtrl.getCorrida().getFechorsalida());
|
||||||
|
cmbOrigemCorrida.setText(alertaCtrl.getCorrida().getOrigem().getDescparada());
|
||||||
|
cmbDestinoCorrida.setText(alertaCtrl.getCorrida().getDestino().getDescparada());
|
||||||
|
cmbTipoServicio.setText(alertaCtrl.getCorrida().getClaseServicio().getDescclase());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// HibernateSearchObject<Corrida> corridaBusqueda =
|
||||||
|
// new HibernateSearchObject<Corrida>(Corrida.class,
|
||||||
|
// pagingCorrida.getPageSize());
|
||||||
|
// corridaBusqueda.addFilterEqual("activo", Boolean.TRUE);
|
||||||
|
//
|
||||||
|
// Date dataCorrida = fecCorrida.getValue();
|
||||||
|
// if (dataCorrida != null) {
|
||||||
|
// corridaBusqueda.addFilterEqual("id.feccorrida", dataCorrida);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// Integer idCorrida = txtIdCorrida.getValue();
|
||||||
|
// if (idCorrida != null) {
|
||||||
|
// corridaBusqueda.addFilterEqual("id.corridaId", idCorrida);
|
||||||
|
// }
|
||||||
|
|
||||||
|
// plwCorrida.init(corridaBusqueda, corridaList, pagingCorrida);
|
||||||
|
// if (corridaList.getData().length == 0) {
|
||||||
|
// try {
|
||||||
|
// Messagebox.show(Labels.getLabel("MSG.ningunRegistro"),
|
||||||
|
// Labels.getLabel("editarAlertaCtrlController.window.title"),
|
||||||
|
// Messagebox.OK, Messagebox.INFORMATION);
|
||||||
|
// } catch (InterruptedException ex) {
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean noTraslapa() {
|
||||||
|
List<AlertaCtrl> lsVT1 = arlertaCtrlService.buscarCorrida(alertaCtrl.getCorrida());
|
||||||
|
|
||||||
|
// Nao Traslapen
|
||||||
|
Boolean podeSalvar = false;
|
||||||
|
Boolean[] podeTodos = new Boolean[lsVT1.isEmpty() ? 1 : lsVT1.size()];
|
||||||
|
boolean podeMesmo = true;
|
||||||
|
|
||||||
|
// Se a lista for nula / Salva
|
||||||
|
if (lsVT1.isEmpty()) {
|
||||||
|
podeMesmo = true;
|
||||||
|
podeTodos[0] = true;
|
||||||
|
// Se a lista não for nula e for algo novo... não pode salvar
|
||||||
|
} else {
|
||||||
|
int i = 0;
|
||||||
|
for (AlertaCtrl p : lsVT1) {
|
||||||
|
if (p.getAlertactrlId().equals(alertaCtrl.getAlertactrlId())) {
|
||||||
|
podeTodos[i] = true;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
podeSalvar = true;
|
||||||
|
if (alertaCtrl.getIndlunes()) {
|
||||||
|
if (p.getIndlunes() == alertaCtrl.getIndlunes()) {
|
||||||
|
podeSalvar = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (alertaCtrl.getIndmartes()) {
|
||||||
|
if (p.getIndmartes() == alertaCtrl.getIndmartes()) {
|
||||||
|
podeSalvar = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (alertaCtrl.getIndmiercoles()) {
|
||||||
|
if (p.getIndmiercoles() == alertaCtrl.getIndmiercoles()) {
|
||||||
|
podeSalvar = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (alertaCtrl.getIndjueves()) {
|
||||||
|
if (p.getIndjueves() == alertaCtrl.getIndjueves()) {
|
||||||
|
podeSalvar = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (alertaCtrl.getIndviernes()) {
|
||||||
|
if (p.getIndviernes() == alertaCtrl.getIndviernes()) {
|
||||||
|
podeSalvar = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (alertaCtrl.getIndsabado()) {
|
||||||
|
if (p.getIndsabado() == alertaCtrl.getIndsabado()) {
|
||||||
|
podeSalvar = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (alertaCtrl.getInddomingo()) {
|
||||||
|
if (p.getInddomingo() == alertaCtrl.getInddomingo()) {
|
||||||
|
podeSalvar = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
podeTodos[i] = podeSalvar;
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int i = 0; i < podeTodos.length; i++) {
|
||||||
|
if (podeTodos[i] != null) {
|
||||||
|
if (!podeTodos[i]) {
|
||||||
|
podeMesmo = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return podeMesmo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void render(Listitem lstm, Object o) throws Exception {
|
||||||
|
Corrida corrida = (Corrida) o;
|
||||||
|
|
||||||
|
Listcell lc = new Listcell();
|
||||||
|
|
||||||
|
lc = new Listcell(corrida.getId().getCorridaId().toString());
|
||||||
|
lc.setParent(lstm);
|
||||||
|
|
||||||
|
SimpleDateFormat format = new SimpleDateFormat("dd/MM/yyyy");
|
||||||
|
lc = new Listcell(format.format(corrida.getId().getFeccorrida()));
|
||||||
|
lc.setParent(lstm);
|
||||||
|
|
||||||
|
if (corrida.getOrigem() != null) {
|
||||||
|
lc = new Listcell(corrida.getOrigem().getDescparada());
|
||||||
|
} else {
|
||||||
|
lc = new Listcell("");
|
||||||
|
}
|
||||||
|
lc.setParent(lstm);
|
||||||
|
|
||||||
|
if (corrida.getDestino() != null) {
|
||||||
|
lc = new Listcell(corrida.getDestino().getDescparada());
|
||||||
|
} else {
|
||||||
|
lc = new Listcell("");
|
||||||
|
}
|
||||||
|
lc.setParent(lstm);
|
||||||
|
|
||||||
|
if (corrida.getRuta() != null) {
|
||||||
|
lc = new Listcell(corrida.getRuta().getDescruta());
|
||||||
|
} else {
|
||||||
|
lc = new Listcell("");
|
||||||
|
}
|
||||||
|
lc.setParent(lstm);
|
||||||
|
|
||||||
|
if (corrida.getClaseServicio() != null) {
|
||||||
|
lc = new Listcell(corrida.getClaseServicio().getDescclase());
|
||||||
|
} else {
|
||||||
|
lc = new Listcell("");
|
||||||
|
}
|
||||||
|
lc.setParent(lstm);
|
||||||
|
|
||||||
|
if (alertaCtrl.getCorrida() != null) {
|
||||||
|
if (corrida != null) {
|
||||||
|
if ((alertaCtrl.getCorrida().getId().getCorridaId().equals(corrida.getId().getCorridaId()))
|
||||||
|
&& (alertaCtrl.getCorrida().getId().getFeccorrida()).equals(corrida.getId().getFeccorrida())) {
|
||||||
|
String style = "color:blue;Font-weight:bold";
|
||||||
|
lstm.setStyle(style);
|
||||||
|
lstm.setSelected(Boolean.TRUE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
lstm.setAttribute("data", corrida);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,143 @@
|
||||||
|
/*
|
||||||
|
* To change this template, choose Tools | Templates
|
||||||
|
* and open the template in the editor.
|
||||||
|
*/
|
||||||
|
package com.rjconsultores.ventaboletos.web.gui.controladores.configuracioneccomerciales;
|
||||||
|
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.ComisionistaExterno;
|
||||||
|
import com.rjconsultores.ventaboletos.service.ComisionistaExternoService;
|
||||||
|
import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.MyGenericForwardComposer;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.MyListbox;
|
||||||
|
import java.util.Calendar;
|
||||||
|
import java.util.List;
|
||||||
|
import org.apache.log4j.Logger;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.context.annotation.Scope;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.zkoss.util.resource.Labels;
|
||||||
|
import org.zkoss.zhtml.Messagebox;
|
||||||
|
import org.zkoss.zk.ui.Component;
|
||||||
|
import org.zkoss.zk.ui.Executions;
|
||||||
|
import org.zkoss.zk.ui.event.Event;
|
||||||
|
import org.zkoss.zul.Button;
|
||||||
|
import org.zkoss.zul.Textbox;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Administrador
|
||||||
|
*/
|
||||||
|
@Controller("editarComisionistaExternoController")
|
||||||
|
@Scope("prototype")
|
||||||
|
public class EditarComisionistaExternoController extends MyGenericForwardComposer {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ComisionistaExternoService comisionistaExternoService;
|
||||||
|
private ComisionistaExterno comisionistaExterno;
|
||||||
|
private MyListbox comisionistaExternoList;
|
||||||
|
private Textbox txtNome;
|
||||||
|
private Button btnApagar;
|
||||||
|
private static Logger log = Logger.getLogger(EditarComisionistaExternoController.class);
|
||||||
|
|
||||||
|
public Button getBtnApagar() {
|
||||||
|
return btnApagar;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBtnApagar(Button btnApagar) {
|
||||||
|
this.btnApagar = btnApagar;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ComisionistaExterno getComisionistaExterno() {
|
||||||
|
return comisionistaExterno;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setComisionistaExterno(ComisionistaExterno comisionistaExterno) {
|
||||||
|
this.comisionistaExterno = comisionistaExterno;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Textbox getTxtNome() {
|
||||||
|
return txtNome;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTxtNome(Textbox txtNome) {
|
||||||
|
this.txtNome = txtNome;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void doAfterCompose(Component comp) throws Exception {
|
||||||
|
super.doAfterCompose(comp);
|
||||||
|
|
||||||
|
comisionistaExterno =
|
||||||
|
(ComisionistaExterno) Executions.getCurrent().getArg().get("comisionistaExterno");
|
||||||
|
comisionistaExternoList =
|
||||||
|
(MyListbox) Executions.getCurrent().getArg().get("comisionistaExternoList");
|
||||||
|
|
||||||
|
if (comisionistaExterno.getComisionistaexternoId() == null) {
|
||||||
|
btnApagar.setVisible(Boolean.FALSE);
|
||||||
|
}
|
||||||
|
|
||||||
|
txtNome.focus();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onClick$btnSalvar(Event ev) {
|
||||||
|
txtNome.getValue();
|
||||||
|
|
||||||
|
try {
|
||||||
|
comisionistaExterno.setActivo(true);
|
||||||
|
comisionistaExterno.setFecmodif(Calendar.getInstance().getTime());
|
||||||
|
comisionistaExterno.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
|
||||||
|
|
||||||
|
List<ComisionistaExterno> lsComisionistaExterno =
|
||||||
|
comisionistaExternoService.buscar(comisionistaExterno.getDesccomisionista());
|
||||||
|
|
||||||
|
if (!lsComisionistaExterno.isEmpty()) {
|
||||||
|
Messagebox.show(
|
||||||
|
Labels.getLabel("MSG.Registro.Existe"),
|
||||||
|
Labels.getLabel("editarComisionistaExternoController.window.title"),
|
||||||
|
Messagebox.OK, Messagebox.EXCLAMATION);
|
||||||
|
} else {
|
||||||
|
if (comisionistaExterno.getComisionistaexternoId() == null) {
|
||||||
|
comisionistaExternoService.suscribir(comisionistaExterno);
|
||||||
|
comisionistaExternoList.addItem(comisionistaExterno);
|
||||||
|
} else {
|
||||||
|
comisionistaExternoService.actualizacion(comisionistaExterno);
|
||||||
|
comisionistaExternoList.updateItem(comisionistaExterno);
|
||||||
|
}
|
||||||
|
|
||||||
|
Messagebox.show(
|
||||||
|
Labels.getLabel("editarComisionistaExternoController.MSG.suscribirOK"),
|
||||||
|
Labels.getLabel("editarComisionistaExternoController.window.title"),
|
||||||
|
Messagebox.OK, Messagebox.INFORMATION);
|
||||||
|
|
||||||
|
closeWindow();
|
||||||
|
}
|
||||||
|
} catch (Exception ex) {
|
||||||
|
log.error(ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onClick$btnApagar(Event ev) {
|
||||||
|
try {
|
||||||
|
int resp = Messagebox.show(
|
||||||
|
Labels.getLabel("editarComisionistaExternoController.MSG.borrarPergunta"),
|
||||||
|
Labels.getLabel("editarComisionistaExternoController.window.title"),
|
||||||
|
Messagebox.YES | Messagebox.NO, Messagebox.QUESTION);
|
||||||
|
|
||||||
|
if (resp == Messagebox.YES) {
|
||||||
|
|
||||||
|
comisionistaExternoService.borrar(comisionistaExterno);
|
||||||
|
|
||||||
|
Messagebox.show(
|
||||||
|
Labels.getLabel("editarComisionistaExternoController.MSG.borrarOK"),
|
||||||
|
Labels.getLabel("editarComisionistaExternoController.window.title"),
|
||||||
|
Messagebox.OK, Messagebox.INFORMATION);
|
||||||
|
|
||||||
|
comisionistaExternoList.removeItem(comisionistaExterno);
|
||||||
|
|
||||||
|
closeWindow();
|
||||||
|
}
|
||||||
|
} catch (Exception ex) {
|
||||||
|
log.error(ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,628 @@
|
||||||
|
/*
|
||||||
|
* To change this template, choose Tools | Templates
|
||||||
|
* and open the template in the editor.
|
||||||
|
*/
|
||||||
|
package com.rjconsultores.ventaboletos.web.gui.controladores.configuracioneccomerciales;
|
||||||
|
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.CancelacionCargo;
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.Marca;
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.Parada;
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.PuntoVenta;
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.CancelacionCtrl;
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.MotivoCancelacion;
|
||||||
|
import com.rjconsultores.ventaboletos.service.MarcaService;
|
||||||
|
import com.rjconsultores.ventaboletos.service.ParadaService;
|
||||||
|
import com.rjconsultores.ventaboletos.service.CancelacionCtrlService;
|
||||||
|
import com.rjconsultores.ventaboletos.service.MotivoCancelacionService;
|
||||||
|
import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.MyComboboxParada;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.MyGenericForwardComposer;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.MyListbox;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.MyTextboxDecimal;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.render.RenderCancelacionCargo;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import org.apache.log4j.Logger;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.context.annotation.Scope;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import java.util.Calendar;
|
||||||
|
import java.util.List;
|
||||||
|
import org.zkoss.util.resource.Labels;
|
||||||
|
import org.zkoss.zk.ui.Component;
|
||||||
|
import org.zkoss.zk.ui.Executions;
|
||||||
|
import org.zkoss.zk.ui.event.Event;
|
||||||
|
import org.zkoss.zkplus.databind.BindingListModelList;
|
||||||
|
import org.zkoss.zul.Button;
|
||||||
|
import org.zkoss.zul.Combobox;
|
||||||
|
import org.zkoss.zul.Comboitem;
|
||||||
|
import org.zkoss.zul.Messagebox;
|
||||||
|
import org.zkoss.zul.Radio;
|
||||||
|
import org.zkoss.zul.Tab;
|
||||||
|
import org.zkoss.zul.Textbox;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Rafius
|
||||||
|
*/
|
||||||
|
@Controller("editarConfiguracionCancelacionController")
|
||||||
|
@Scope("prototype")
|
||||||
|
public class EditarConfiguracionCancelacionController extends MyGenericForwardComposer {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private CancelacionCtrlService cancelacionCtrlService;
|
||||||
|
@Autowired
|
||||||
|
private MarcaService marcaService;
|
||||||
|
@Autowired
|
||||||
|
private ParadaService paradaService;
|
||||||
|
@Autowired
|
||||||
|
private MotivoCancelacionService motivoCancelacionService;
|
||||||
|
private CancelacionCtrl cancelacionCtrl;
|
||||||
|
private static Logger log = Logger.getLogger(EditarConfiguracionCancelacionController.class);
|
||||||
|
private List<PuntoVenta> lsPuntoVenta;
|
||||||
|
private List<Marca> lsMarca;
|
||||||
|
private List<CancelacionCargo> lsCancelacionCargo;
|
||||||
|
private List<MotivoCancelacion> lsMotivoCancelacion;
|
||||||
|
private Combobox cmbMarca;
|
||||||
|
private Combobox cmbPuntoVenta;
|
||||||
|
private MyComboboxParada cmbParadaOrigem;
|
||||||
|
private MyComboboxParada cmbParadaDestino;
|
||||||
|
private Combobox cmbMotivoCancelacion;
|
||||||
|
private MyListbox cancelacionCtrlList;
|
||||||
|
private MyListbox cancelacionCargoList;
|
||||||
|
private Button btnApagar;
|
||||||
|
private MyTextboxDecimal txtMinimo;
|
||||||
|
private MyTextboxDecimal txtMaximo;
|
||||||
|
private Textbox porcentaje;
|
||||||
|
private Textbox importe;
|
||||||
|
private Radio radioImp;
|
||||||
|
private Tab tabCtrl;
|
||||||
|
|
||||||
|
public Button getBtnApagar() {
|
||||||
|
return btnApagar;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBtnApagar(Button btnApagar) {
|
||||||
|
this.btnApagar = btnApagar;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void doAfterCompose(Component comp) throws Exception {
|
||||||
|
lsMarca = marcaService.obtenerTodos();
|
||||||
|
|
||||||
|
Integer[] motivos = {10, 13, 14, -1};
|
||||||
|
lsMotivoCancelacion = motivoCancelacionService.obtenerTodosEspecificos(motivos);
|
||||||
|
|
||||||
|
super.doAfterCompose(comp);
|
||||||
|
|
||||||
|
cancelacionCtrl = (CancelacionCtrl) Executions.getCurrent().getArg().get("cancelacionCtrl");
|
||||||
|
cancelacionCtrlList = (MyListbox) Executions.getCurrent().getArg().get("cancelacionCtrlList");
|
||||||
|
|
||||||
|
cancelacionCargoList.setItemRenderer(new RenderCancelacionCargo());
|
||||||
|
lsCancelacionCargo = new ArrayList<CancelacionCargo>();
|
||||||
|
|
||||||
|
if (cancelacionCtrl.getCancelacionctrlId() == null) {
|
||||||
|
btnApagar.setVisible(Boolean.FALSE);
|
||||||
|
|
||||||
|
radioImp.setChecked(true);
|
||||||
|
onClick$radioImp(null);
|
||||||
|
|
||||||
|
txtMaximo.setValue("0");
|
||||||
|
txtMaximo.setDisabled(true);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
cancelacionCtrl = cancelacionCtrlService.obtenerID(cancelacionCtrl.getCancelacionctrlId());
|
||||||
|
|
||||||
|
lsCancelacionCargo = cancelacionCtrl.getCancelacionCargoList();
|
||||||
|
cancelacionCargoList.setData(lsCancelacionCargo);
|
||||||
|
|
||||||
|
Parada origem = cancelacionCtrl.getParadaOrigem();
|
||||||
|
if (origem != null) {
|
||||||
|
cmbParadaOrigem.setValue(origem.getDescparada());
|
||||||
|
}
|
||||||
|
|
||||||
|
Parada destino = cancelacionCtrl.getParadaDestino();
|
||||||
|
if (destino != null) {
|
||||||
|
cmbParadaDestino.setValue(destino.getDescparada());
|
||||||
|
}
|
||||||
|
PuntoVenta puntoVenta = cancelacionCtrl.getPuntoVenta();
|
||||||
|
if (puntoVenta != null) {
|
||||||
|
List<PuntoVenta> ls = new ArrayList<PuntoVenta>();
|
||||||
|
ls.add(puntoVenta);
|
||||||
|
|
||||||
|
cmbPuntoVenta.setModel(new BindingListModelList(ls, false));
|
||||||
|
cmbPuntoVenta.setText(puntoVenta.getNombpuntoventa());
|
||||||
|
}
|
||||||
|
|
||||||
|
//Habilitar tempo conforme motivo de cancelacion.
|
||||||
|
motivosCancelacion();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
importe.setDisabled(true);
|
||||||
|
porcentaje.setDisabled(true);
|
||||||
|
|
||||||
|
radioImp.setChecked(true);
|
||||||
|
onClick$radioImp(null);
|
||||||
|
|
||||||
|
cmbMotivoCancelacion.focus();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void motivosCancelacion() {
|
||||||
|
if (cancelacionCtrl.getMotivoCancelacion() == null) {
|
||||||
|
txtMaximo.setValue("");
|
||||||
|
txtMaximo.setDisabled(true);
|
||||||
|
txtMinimo.setDisabled(false);
|
||||||
|
txtMinimo.setConstraint("no empty");
|
||||||
|
} else {
|
||||||
|
if (cancelacionCtrl.getMotivoCancelacion().getMotivocancelacionId().equals(13)) {
|
||||||
|
txtMinimo.setConstraint("");
|
||||||
|
txtMinimo.setValue("");
|
||||||
|
txtMinimo.setDisabled(true);
|
||||||
|
txtMaximo.setDisabled(false);
|
||||||
|
txtMaximo.setConstraint("no empty");
|
||||||
|
} else {
|
||||||
|
txtMaximo.setConstraint("");
|
||||||
|
txtMaximo.setValue("");
|
||||||
|
txtMaximo.setDisabled(true);
|
||||||
|
txtMinimo.setDisabled(false);
|
||||||
|
txtMinimo.setConstraint("no empty");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onChange$cmbParadaOrigem(Event e) {
|
||||||
|
Comboitem origem = cmbParadaOrigem.getSelectedItem();
|
||||||
|
if (origem != null) {
|
||||||
|
Parada ori = (Parada) origem.getValue();
|
||||||
|
if (ori.getParadaId().equals(-1)) {
|
||||||
|
cmbParadaDestino.setText(ori.getDescparada());
|
||||||
|
cmbParadaDestino.setInitialValue(ori);
|
||||||
|
cancelacionCtrl.setParadaOrigem(ori);
|
||||||
|
cancelacionCtrl.setParadaDestino(ori);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onChange$cmbParadaDestino(Event e) {
|
||||||
|
Comboitem destino = cmbParadaDestino.getSelectedItem();
|
||||||
|
if (destino != null) {
|
||||||
|
Parada des = (Parada) destino.getValue();
|
||||||
|
if (des.getParadaId().equals(-1)) {
|
||||||
|
cmbParadaOrigem.setText(des.getDescparada());
|
||||||
|
cmbParadaOrigem.setInitialValue(des);
|
||||||
|
cancelacionCtrl.setParadaOrigem(des);
|
||||||
|
cancelacionCtrl.setParadaDestino(des);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onClick$btnSalvar(Event ev) throws InterruptedException {
|
||||||
|
|
||||||
|
//Motivo de cancelacion pode ser branco
|
||||||
|
cmbMotivoCancelacion.getValue();
|
||||||
|
tabCtrl.setSelected(Boolean.TRUE);
|
||||||
|
cmbPuntoVenta.getValue();
|
||||||
|
cmbMarca.setConstraint("no empty");
|
||||||
|
cmbMarca.getValue();
|
||||||
|
cmbParadaOrigem.getValue(true);
|
||||||
|
cmbParadaDestino.getValue(true);
|
||||||
|
|
||||||
|
PuntoVenta punto = (PuntoVenta) (cmbPuntoVenta.getSelectedItem() == null ? null : cmbPuntoVenta.getSelectedItem().getValue());
|
||||||
|
if (punto != null) {
|
||||||
|
cancelacionCtrl.setPuntoVenta(punto);
|
||||||
|
} else {
|
||||||
|
Messagebox.show(
|
||||||
|
Labels.getLabel("editarConfiguracionGeneralController.MSG.punto"),
|
||||||
|
Labels.getLabel("editarConfiguracionCancelacionController.window.title"),
|
||||||
|
Messagebox.OK, Messagebox.EXCLAMATION);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Comboitem cbiMotivo = cmbMotivoCancelacion.getSelectedItem();
|
||||||
|
MotivoCancelacion motivo = new MotivoCancelacion();
|
||||||
|
if (cbiMotivo != null) {
|
||||||
|
motivo = (MotivoCancelacion) cbiMotivo.getValue();
|
||||||
|
cancelacionCtrl.setMotivoCancelacion(motivo);
|
||||||
|
} else {
|
||||||
|
cancelacionCtrl.setMotivoCancelacion(null);
|
||||||
|
}
|
||||||
|
|
||||||
|
Parada origem = cancelacionCtrl.getParadaOrigem();
|
||||||
|
Parada destino = cancelacionCtrl.getParadaDestino();
|
||||||
|
|
||||||
|
try {
|
||||||
|
boolean podeIguais = false;
|
||||||
|
if (origem.getParadaId().equals(destino.getParadaId())) {
|
||||||
|
if (origem.getParadaId().equals(-1) && destino.getParadaId().equals(-1)) {
|
||||||
|
podeIguais = true;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (origem.getParadaId().equals(-1) || destino.getParadaId().equals(-1)) {
|
||||||
|
Messagebox.show(
|
||||||
|
Labels.getLabel("editarConfiguracionCancelacionController.MSG.selectItemTodas"),
|
||||||
|
Labels.getLabel("editarConfiguracionCancelacionController.window.title"),
|
||||||
|
Messagebox.OK, Messagebox.EXCLAMATION);
|
||||||
|
return;
|
||||||
|
|
||||||
|
} else {
|
||||||
|
podeIguais = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (podeIguais) {
|
||||||
|
cancelacionCtrl.setActivo(Boolean.TRUE);
|
||||||
|
cancelacionCtrl.setFecmodif(Calendar.getInstance().getTime());
|
||||||
|
cancelacionCtrl.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
|
||||||
|
cancelacionCtrl.setMarca((Marca) cmbMarca.getSelectedItem().getValue());
|
||||||
|
|
||||||
|
|
||||||
|
List<CancelacionCtrl> lsCancelacion = cancelacionCtrlService.buscar(cancelacionCtrl.getTiempoprevsalida(),
|
||||||
|
cancelacionCtrl.getPuntoVenta(), cancelacionCtrl.getParadaOrigem(),
|
||||||
|
cancelacionCtrl.getParadaDestino(), cancelacionCtrl.getMarca());
|
||||||
|
|
||||||
|
boolean podeSalvar = false;
|
||||||
|
if (lsCancelacion.isEmpty()) {
|
||||||
|
podeSalvar = true;
|
||||||
|
} else {
|
||||||
|
for (CancelacionCtrl cc : lsCancelacion) {
|
||||||
|
if (cc.getCancelacionctrlId().equals(cancelacionCtrl.getCancelacionctrlId())) {
|
||||||
|
podeSalvar = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (podeSalvar) {
|
||||||
|
|
||||||
|
if (cancelacionCtrl.getCancelacionctrlId() == null) {
|
||||||
|
cancelacionCtrlService.suscribir(cancelacionCtrl);
|
||||||
|
cancelacionCtrlList.addItem(cancelacionCtrl);
|
||||||
|
} else {
|
||||||
|
cancelacionCtrlService.actualizacion(cancelacionCtrl);
|
||||||
|
cancelacionCtrlList.updateItem(cancelacionCtrl);
|
||||||
|
}
|
||||||
|
|
||||||
|
Messagebox.show(
|
||||||
|
Labels.getLabel("editarConfiguracionCancelacionController.MSG.suscribirOK"),
|
||||||
|
Labels.getLabel("editarConfiguracionCancelacionController.window.title"),
|
||||||
|
Messagebox.OK, Messagebox.INFORMATION);
|
||||||
|
|
||||||
|
|
||||||
|
closeWindow();
|
||||||
|
} else {
|
||||||
|
Messagebox.show(
|
||||||
|
Labels.getLabel("MSG.Registro.Existe"),
|
||||||
|
Labels.getLabel("editarConfiguracionGeneralController.window.title"),
|
||||||
|
Messagebox.OK, Messagebox.EXCLAMATION);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
Messagebox.show(
|
||||||
|
Labels.getLabel("editarConfiguracionCancelacionController.MSG.selectItemDiferente"),
|
||||||
|
Labels.getLabel("editarConfiguracionCancelacionController.window.title"),
|
||||||
|
Messagebox.OK, Messagebox.EXCLAMATION);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
} catch (Exception ex) {
|
||||||
|
log.error(ex);
|
||||||
|
Messagebox.show(
|
||||||
|
Labels.getLabel("MSG.Error"),
|
||||||
|
Labels.getLabel("editarCategoriaController.window.title"),
|
||||||
|
Messagebox.OK, Messagebox.ERROR);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onClick$btnApagar(Event ev) throws InterruptedException {
|
||||||
|
try {
|
||||||
|
int resp = Messagebox.show(
|
||||||
|
Labels.getLabel("editarConfiguracionCancelacionController.MSG.borrarPergunta"),
|
||||||
|
Labels.getLabel("editarConfiguracionCancelacionController.window.title"),
|
||||||
|
Messagebox.YES | Messagebox.NO, Messagebox.QUESTION);
|
||||||
|
|
||||||
|
if (resp == Messagebox.YES) {
|
||||||
|
|
||||||
|
cancelacionCtrlService.borrar(cancelacionCtrl);
|
||||||
|
|
||||||
|
Messagebox.show(
|
||||||
|
Labels.getLabel("editarConfiguracionCancelacionController.MSG.borrarOK"),
|
||||||
|
Labels.getLabel("editarConfiguracionCancelacionController.window.title"),
|
||||||
|
Messagebox.OK, Messagebox.INFORMATION);
|
||||||
|
|
||||||
|
cancelacionCtrlList.removeItem(cancelacionCtrl);
|
||||||
|
|
||||||
|
closeWindow();
|
||||||
|
}
|
||||||
|
} catch (Exception ex) {
|
||||||
|
log.error(ex);
|
||||||
|
Messagebox.show(
|
||||||
|
Labels.getLabel("MSG.Error"),
|
||||||
|
Labels.getLabel("editarCategoriaController.window.title"),
|
||||||
|
Messagebox.OK, Messagebox.ERROR);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onChange$cmbMotivoCancelacion(Event ev) {
|
||||||
|
|
||||||
|
Comboitem cbiMotivo = cmbMotivoCancelacion.getSelectedItem();
|
||||||
|
MotivoCancelacion motivo = new MotivoCancelacion();
|
||||||
|
if (cbiMotivo != null) {
|
||||||
|
motivo = (MotivoCancelacion) cbiMotivo.getValue();
|
||||||
|
|
||||||
|
cancelacionCtrl.setMotivoCancelacion(motivo);
|
||||||
|
motivosCancelacion();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onClick$radioImp(Event ev) {
|
||||||
|
importe.setConstraint("");
|
||||||
|
porcentaje.setConstraint("");
|
||||||
|
|
||||||
|
importe.setText("");
|
||||||
|
porcentaje.setText("");
|
||||||
|
|
||||||
|
porcentaje.setDisabled(true);
|
||||||
|
importe.setDisabled(false);
|
||||||
|
|
||||||
|
porcentaje.setConstraint("");
|
||||||
|
porcentaje.setValue("");
|
||||||
|
importe.setConstraint("no empty, no negative");
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onClick$radioPor(Event ev) {
|
||||||
|
importe.setConstraint("");
|
||||||
|
porcentaje.setConstraint("");
|
||||||
|
|
||||||
|
importe.setText("");
|
||||||
|
porcentaje.setText("");
|
||||||
|
|
||||||
|
importe.setDisabled(true);
|
||||||
|
porcentaje.setDisabled(false);
|
||||||
|
|
||||||
|
importe.setConstraint("");
|
||||||
|
importe.setValue("");
|
||||||
|
porcentaje.setConstraint("no empty, no zero, no negative");
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onClick$btnAdicionarCargo(Event ev) throws InterruptedException {
|
||||||
|
|
||||||
|
txtMinimo.getValue();
|
||||||
|
txtMaximo.getValue();
|
||||||
|
porcentaje.getValue();
|
||||||
|
importe.getValue();
|
||||||
|
|
||||||
|
try {
|
||||||
|
|
||||||
|
boolean existe = false;
|
||||||
|
for (CancelacionCargo cc : lsCancelacionCargo) {
|
||||||
|
if (cc.getTiempomaximo() == null) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
// if (txtMaximo.getValueDecimal() != null) {
|
||||||
|
// if (cc.getActivo() && (cc.getTiempomaximo().compareTo(txtMaximo.getValueDecimal()) == 0)) {
|
||||||
|
// existe = true;
|
||||||
|
// }
|
||||||
|
// } else {
|
||||||
|
// if (cc.getActivo() && (cc.getTiempominimo().compareTo(txtMinimo.getValueDecimal()) == 0)) {
|
||||||
|
// existe = true;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
if (!existe) {
|
||||||
|
CancelacionCargo cCargo = new CancelacionCargo();
|
||||||
|
cCargo.setCancelacionCtrl(cancelacionCtrl);
|
||||||
|
cCargo.setActivo(Boolean.TRUE);
|
||||||
|
cCargo.setFecmodif(Calendar.getInstance().getTime());
|
||||||
|
cCargo.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
|
||||||
|
|
||||||
|
cCargo.setTiempominimo(txtMinimo.getValueDecimal());
|
||||||
|
cCargo.setTiempomaximo(txtMaximo.getValueDecimal());
|
||||||
|
if ((!porcentaje.getValue().equals("")) && (porcentaje.getValue() != null)) {
|
||||||
|
cCargo.setPorccargo((BigDecimal.valueOf(Double.parseDouble(porcentaje.getValue()))));
|
||||||
|
}
|
||||||
|
if ((!importe.getValue().equals("")) && (importe.getValue() != null)) {
|
||||||
|
cCargo.setImportecargo((BigDecimal.valueOf(Double.parseDouble(importe.getValue()))));
|
||||||
|
}
|
||||||
|
lsCancelacionCargo.add(cCargo);
|
||||||
|
cancelacionCtrl.setCancelacionCargoList(lsCancelacionCargo);
|
||||||
|
|
||||||
|
txtMaximo.setConstraint("");
|
||||||
|
txtMinimo.setConstraint("");
|
||||||
|
|
||||||
|
txtMinimo.setText("");
|
||||||
|
txtMaximo.setText("");
|
||||||
|
|
||||||
|
importe.setDisabled(true);
|
||||||
|
porcentaje.setDisabled(true);
|
||||||
|
radioImp.setChecked(true);
|
||||||
|
|
||||||
|
onClick$radioImp(null);
|
||||||
|
motivosCancelacion();
|
||||||
|
|
||||||
|
cancelacionCargoList.setData(new ArrayList<CancelacionCargo>());
|
||||||
|
List<CancelacionCargo> lsTemp = new ArrayList<CancelacionCargo>();
|
||||||
|
for (CancelacionCargo cc : lsCancelacionCargo) {
|
||||||
|
if (cc.getActivo()) {
|
||||||
|
lsTemp.add(cc);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
cancelacionCargoList.setData(lsTemp);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
Messagebox.show(
|
||||||
|
Labels.getLabel("MSG.Registro.Existe"),
|
||||||
|
Labels.getLabel("editarConfiguracionCancelacionController.window.title"),
|
||||||
|
Messagebox.OK, Messagebox.EXCLAMATION);
|
||||||
|
}
|
||||||
|
// }
|
||||||
|
} catch (Exception ex) {
|
||||||
|
log.error("Erro adicionar cargo : " + ex);
|
||||||
|
Messagebox.show(
|
||||||
|
Labels.getLabel("MSG.Error"),
|
||||||
|
Labels.getLabel("editarCategoriaController.window.title"),
|
||||||
|
Messagebox.OK, Messagebox.ERROR);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onClick$btnRemoverCargo(Event ev) throws InterruptedException {
|
||||||
|
try {
|
||||||
|
CancelacionCargo cCargo = (CancelacionCargo) cancelacionCargoList.getSelected();
|
||||||
|
if (cCargo != null) {
|
||||||
|
//removo o antigo
|
||||||
|
lsCancelacionCargo.remove(cCargo);
|
||||||
|
cCargo.setFecmodif(Calendar.getInstance().getTime());
|
||||||
|
cCargo.setActivo(Boolean.FALSE);
|
||||||
|
cCargo.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
|
||||||
|
cancelacionCargoList.updateItem(cCargo);
|
||||||
|
cancelacionCargoList.removeItem(cCargo);
|
||||||
|
lsCancelacionCargo.add(cCargo);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
Messagebox.show(
|
||||||
|
Labels.getLabel("editarConfiguracionCategoriaController.MSG.selectItem"),
|
||||||
|
Labels.getLabel("editarConfiguracionCancelacionController.window.title"),
|
||||||
|
Messagebox.OK, Messagebox.EXCLAMATION);
|
||||||
|
}
|
||||||
|
} catch (Exception ex) {
|
||||||
|
log.error("Erro remover cargo: " + ex);
|
||||||
|
Messagebox.show(
|
||||||
|
Labels.getLabel("MSG.Error"),
|
||||||
|
Labels.getLabel("editarConfiguracionCancelacionController.window.title"),
|
||||||
|
Messagebox.OK, Messagebox.ERROR);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public CancelacionCtrl getCancelacionCtrl() {
|
||||||
|
return cancelacionCtrl;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCancelacionCtrl(CancelacionCtrl cancelacionCtrl) {
|
||||||
|
this.cancelacionCtrl = cancelacionCtrl;
|
||||||
|
}
|
||||||
|
|
||||||
|
public CancelacionCtrlService getCancelacionCtrlService() {
|
||||||
|
return cancelacionCtrlService;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCancelacionCtrlService(CancelacionCtrlService cancelacionCtrlService) {
|
||||||
|
this.cancelacionCtrlService = cancelacionCtrlService;
|
||||||
|
}
|
||||||
|
|
||||||
|
public MyListbox getCancelacionCtrlList() {
|
||||||
|
return cancelacionCtrlList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCancelacionCtrlList(MyListbox cancelacionCtrlList) {
|
||||||
|
this.cancelacionCtrlList = cancelacionCtrlList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Logger getLog() {
|
||||||
|
return log;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void setLog(Logger log) {
|
||||||
|
EditarConfiguracionCancelacionController.log = log;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<Marca> getLsMarca() {
|
||||||
|
return lsMarca;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLsMarca(List<Marca> lsMarca) {
|
||||||
|
this.lsMarca = lsMarca;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<PuntoVenta> getLsPuntoVenta() {
|
||||||
|
return lsPuntoVenta;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLsPuntoVenta(List<PuntoVenta> lsPuntoVenta) {
|
||||||
|
this.lsPuntoVenta = lsPuntoVenta;
|
||||||
|
}
|
||||||
|
|
||||||
|
public MarcaService getMarcaService() {
|
||||||
|
return marcaService;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMarcaService(MarcaService marcaService) {
|
||||||
|
this.marcaService = marcaService;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Combobox getCmbMarca() {
|
||||||
|
return cmbMarca;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCmbMarca(Combobox cmbMarca) {
|
||||||
|
this.cmbMarca = cmbMarca;
|
||||||
|
}
|
||||||
|
|
||||||
|
public MyComboboxParada getCmbParadaDestino() {
|
||||||
|
return cmbParadaDestino;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCmbParadaDestino(MyComboboxParada cmbParadaDestino) {
|
||||||
|
this.cmbParadaDestino = cmbParadaDestino;
|
||||||
|
}
|
||||||
|
|
||||||
|
public MyComboboxParada getCmbParadaOrigem() {
|
||||||
|
return cmbParadaOrigem;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCmbParadaOrigem(MyComboboxParada cmbParadaOrigem) {
|
||||||
|
this.cmbParadaOrigem = cmbParadaOrigem;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Combobox getCmbPuntoVenta() {
|
||||||
|
return cmbPuntoVenta;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCmbPuntoVenta(Combobox cmbPuntoVenta) {
|
||||||
|
this.cmbPuntoVenta = cmbPuntoVenta;
|
||||||
|
}
|
||||||
|
|
||||||
|
public MyListbox getCancelacionCargoList() {
|
||||||
|
return cancelacionCargoList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCancelacionCargoList(MyListbox cancelacionCargoList) {
|
||||||
|
this.cancelacionCargoList = cancelacionCargoList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<CancelacionCargo> getLsCancelacionCargo() {
|
||||||
|
return lsCancelacionCargo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLsCancelacionCargo(List<CancelacionCargo> lsCancelacionCargo) {
|
||||||
|
this.lsCancelacionCargo = lsCancelacionCargo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Textbox getTxtMaximo() {
|
||||||
|
return txtMaximo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Combobox getCmbMotivoCancelacion() {
|
||||||
|
return cmbMotivoCancelacion;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCmbMotivoCancelacion(Combobox cmbMotivoCancelacion) {
|
||||||
|
this.cmbMotivoCancelacion = cmbMotivoCancelacion;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<MotivoCancelacion> getLsMotivoCancelacion() {
|
||||||
|
return lsMotivoCancelacion;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLsMotivoCancelacion(List<MotivoCancelacion> lsMotivoCancelacion) {
|
||||||
|
this.lsMotivoCancelacion = lsMotivoCancelacion;
|
||||||
|
}
|
||||||
|
|
||||||
|
public MotivoCancelacionService getMotivoCancelacionService() {
|
||||||
|
return motivoCancelacionService;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMotivoCancelacionService(MotivoCancelacionService motivoCancelacionService) {
|
||||||
|
this.motivoCancelacionService = motivoCancelacionService;
|
||||||
|
}
|
||||||
|
}
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,87 @@
|
||||||
|
/*
|
||||||
|
* To change this template, choose Tools | Templates
|
||||||
|
* and open the template in the editor.
|
||||||
|
*/
|
||||||
|
package com.rjconsultores.ventaboletos.web.gui.controladores.configuracioneccomerciales;
|
||||||
|
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.CategoriaDescuento;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.MyGenericForwardComposer;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.MyListbox;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.springframework.context.annotation.Scope;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.zkoss.zk.ui.Component;
|
||||||
|
import org.zkoss.zk.ui.Executions;
|
||||||
|
import org.zkoss.zk.ui.event.Event;
|
||||||
|
import org.zkoss.zul.Radio;
|
||||||
|
import org.zkoss.zul.Textbox;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author rodrigo
|
||||||
|
*/
|
||||||
|
@Controller("editarConfiguracionCategoriaDatosCategoriaController")
|
||||||
|
@Scope("prototype")
|
||||||
|
public class EditarConfiguracionCategoriaDatosCategoriaController extends MyGenericForwardComposer {
|
||||||
|
|
||||||
|
private static Logger log = LoggerFactory.getLogger(EditarConfiguracionCategoriaDatosCategoriaController.class);
|
||||||
|
private CategoriaDescuento categoriaDescuento;
|
||||||
|
private MyListbox categoriaDescuentoList;
|
||||||
|
private Radio radioImp;
|
||||||
|
private Radio radioPor;
|
||||||
|
private Textbox descuentoPorc;
|
||||||
|
private Textbox descuentoImporte;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void doAfterCompose(Component comp) throws Exception {
|
||||||
|
categoriaDescuentoList = (MyListbox) Executions.getCurrent().getArg().get("categoriaDescuentoList");
|
||||||
|
categoriaDescuento = (CategoriaDescuento) Executions.getCurrent().getArg().get("categoriaDescuento");
|
||||||
|
|
||||||
|
super.doAfterCompose(comp);
|
||||||
|
|
||||||
|
if ((categoriaDescuento.getDescuentoimporte() != null) && (!categoriaDescuento.getDescuentoimporte().equals(BigDecimal.ZERO))) {
|
||||||
|
radioImp.setSelected(true);
|
||||||
|
descuentoPorc.setDisabled(true);
|
||||||
|
}
|
||||||
|
if ((categoriaDescuento.getDescuentoporc() != null) && (!categoriaDescuento.getDescuentoporc().equals(BigDecimal.ZERO))) {
|
||||||
|
radioPor.setSelected(true);
|
||||||
|
descuentoImporte.setDisabled(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onClick$btnSalvar(Event ev) {
|
||||||
|
categoriaDescuentoList.updateItem(categoriaDescuento);
|
||||||
|
this.closeWindow();
|
||||||
|
}
|
||||||
|
|
||||||
|
public CategoriaDescuento getCategoriaDescuento() {
|
||||||
|
return categoriaDescuento;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCategoriaDescuento(CategoriaDescuento categoriaDescuento) {
|
||||||
|
this.categoriaDescuento = categoriaDescuento;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onClick$radioImp(Event ev) {
|
||||||
|
descuentoPorc.setDisabled(true);
|
||||||
|
descuentoImporte.setDisabled(false);
|
||||||
|
|
||||||
|
descuentoPorc.setConstraint("");
|
||||||
|
descuentoPorc.setValue("0");
|
||||||
|
categoriaDescuento.setDescuentoporc(BigDecimal.ZERO);
|
||||||
|
descuentoImporte.setConstraint("no empty, no negative");
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onClick$radioPor(Event ev) {
|
||||||
|
descuentoImporte.setDisabled(true);
|
||||||
|
descuentoPorc.setDisabled(false);
|
||||||
|
|
||||||
|
descuentoImporte.setConstraint("");
|
||||||
|
descuentoImporte.setValue("0");
|
||||||
|
categoriaDescuento.setDescuentoimporte(BigDecimal.ZERO);
|
||||||
|
descuentoPorc.setConstraint("no empty, no zero, no negative");
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,186 @@
|
||||||
|
/*
|
||||||
|
* To change this template, choose Tools | Templates
|
||||||
|
* and open the template in the editor.
|
||||||
|
*/
|
||||||
|
package com.rjconsultores.ventaboletos.web.gui.controladores.configuracioneccomerciales;
|
||||||
|
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.CategoriaDescuento;
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.CategoriaPeriodo;
|
||||||
|
import com.rjconsultores.ventaboletos.service.CategoriaDescuentoService;
|
||||||
|
import com.rjconsultores.ventaboletos.service.CategoriaPeriodoService;
|
||||||
|
import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.MyGenericForwardComposer;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.MyListbox;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.render.RenderConfiguracionCategoriaPeriodo;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Calendar;
|
||||||
|
import java.util.List;
|
||||||
|
import org.apache.log4j.Logger;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.context.annotation.Scope;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.zkoss.util.resource.Labels;
|
||||||
|
import org.zkoss.zul.Datebox;
|
||||||
|
import org.zkoss.zk.ui.Component;
|
||||||
|
import org.zkoss.zk.ui.Executions;
|
||||||
|
import org.zkoss.zk.ui.event.Event;
|
||||||
|
import org.zkoss.zul.Messagebox;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Rafius
|
||||||
|
*/
|
||||||
|
@Controller("editarConfiguracionCategoriaPeriodoController")
|
||||||
|
@Scope("prototype")
|
||||||
|
public class EditarConfiguracionCategoriaPeriodoController extends MyGenericForwardComposer {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private CategoriaDescuentoService categoriaDescuentoService;
|
||||||
|
@Autowired
|
||||||
|
private CategoriaPeriodoService categoriaPeriodoService;
|
||||||
|
private MyListbox categoriaDescuentoList;
|
||||||
|
private MyListbox categoriaPeriodoList;
|
||||||
|
private CategoriaDescuento categoriaDescuento;
|
||||||
|
private CategoriaPeriodo categoriaPeriodo;
|
||||||
|
private List<CategoriaPeriodo> lsCategoriaPeriodo;
|
||||||
|
private Datebox fecInicio;
|
||||||
|
private Datebox fecFinal;
|
||||||
|
private static Logger log = Logger.getLogger(EditarConfiguracionCategoriaPeriodoController.class);
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void doAfterCompose(Component comp) throws Exception {
|
||||||
|
super.doAfterCompose(comp);
|
||||||
|
|
||||||
|
categoriaDescuentoList = (MyListbox) Executions.getCurrent().getArg().get("categoriaDescuentoList");
|
||||||
|
categoriaDescuento = (CategoriaDescuento) Executions.getCurrent().getArg().get("categoriaDescuento");
|
||||||
|
|
||||||
|
categoriaPeriodoList.setItemRenderer(new RenderConfiguracionCategoriaPeriodo());
|
||||||
|
lsCategoriaPeriodo = new ArrayList<CategoriaPeriodo>();
|
||||||
|
|
||||||
|
if (categoriaDescuento.getCategoriadescuentoId() != null) {
|
||||||
|
//categoriaDescuento = categoriaDescuentoService.obtenerID(categoriaDescuento.getCategoriadescuentoId());
|
||||||
|
|
||||||
|
lsCategoriaPeriodo = categoriaDescuento.getCategoriaPeriodoList();
|
||||||
|
categoriaPeriodoList.setData(lsCategoriaPeriodo);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onClick$btnSalvarPeriodo(Event ev) throws InterruptedException {
|
||||||
|
|
||||||
|
fecInicio.setConstraint("no empty, no past");
|
||||||
|
fecFinal.setConstraint("no empty, no past");
|
||||||
|
|
||||||
|
fecInicio.getValue();
|
||||||
|
fecFinal.getValue();
|
||||||
|
|
||||||
|
if (fecInicio.getValue().after(fecFinal.getValue())) {
|
||||||
|
try {
|
||||||
|
Messagebox.show(Labels.getLabel("editarConfiguracionCategoriaController.MSG.busquedaPeriodo"),
|
||||||
|
Labels.getLabel("editarConfiguracionCategoriaController.window.title"), Messagebox.OK, Messagebox.INFORMATION);
|
||||||
|
} catch (InterruptedException ex) {
|
||||||
|
log.error(ex);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
try {
|
||||||
|
|
||||||
|
CategoriaPeriodo cPeriodo = new CategoriaPeriodo();
|
||||||
|
cPeriodo.setFecmodif(Calendar.getInstance().getTime());
|
||||||
|
cPeriodo.setActivo(Boolean.TRUE);
|
||||||
|
cPeriodo.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
|
||||||
|
cPeriodo.setCategoriaDescuento(categoriaDescuento);
|
||||||
|
|
||||||
|
cPeriodo.setFecinicio(fecInicio.getValue());
|
||||||
|
cPeriodo.setFecfin(fecFinal.getValue());
|
||||||
|
|
||||||
|
List<CategoriaPeriodo> lsVT1 = categoriaPeriodoService.buscarPeriodoIntervalo(cPeriodo);
|
||||||
|
|
||||||
|
Boolean podeSalvar = lsVT1.isEmpty() ? true : false;
|
||||||
|
//Se for ele mesmo pode salvar.
|
||||||
|
if (lsVT1.size() == 1) {
|
||||||
|
//Somente edição
|
||||||
|
if (categoriaDescuento.getCategoriadescuentoId() != null) {
|
||||||
|
if (categoriaDescuento.getCategoriadescuentoId().equals(lsVT1.get(0).getCategoriaperiodoId())) {
|
||||||
|
podeSalvar = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (podeSalvar) {
|
||||||
|
|
||||||
|
lsCategoriaPeriodo.add(cPeriodo);
|
||||||
|
categoriaPeriodoList.setData(lsCategoriaPeriodo);
|
||||||
|
|
||||||
|
categoriaDescuento.setCategoriaPeriodoList(lsCategoriaPeriodo);
|
||||||
|
categoriaDescuentoList.updateItem(categoriaDescuento);
|
||||||
|
|
||||||
|
categoriaPeriodoService.suscribir(cPeriodo);
|
||||||
|
|
||||||
|
fecInicio.setConstraint("");
|
||||||
|
fecFinal.setConstraint("");
|
||||||
|
|
||||||
|
fecInicio.setValue(null);
|
||||||
|
fecFinal.setValue(null);
|
||||||
|
|
||||||
|
fecInicio.setConstraint("no empty");
|
||||||
|
fecFinal.setConstraint("no empty");
|
||||||
|
|
||||||
|
} else {
|
||||||
|
Messagebox.show(
|
||||||
|
Labels.getLabel("editarConfiguracionCategoriaController.MSG.conflitoVigencias"),
|
||||||
|
Labels.getLabel("editarConfiguracionCategoriaController.window.title"),
|
||||||
|
Messagebox.OK, Messagebox.EXCLAMATION);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
} catch (Exception ex) {
|
||||||
|
log.error(ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onClick$btnApagarPeriodo(Event ev) {
|
||||||
|
try {
|
||||||
|
CategoriaPeriodo cPeriodo = (CategoriaPeriodo) categoriaPeriodoList.getSelected();
|
||||||
|
|
||||||
|
if (cPeriodo != null) {
|
||||||
|
|
||||||
|
categoriaPeriodoService.borrar(cPeriodo);
|
||||||
|
lsCategoriaPeriodo.remove(cPeriodo);
|
||||||
|
categoriaPeriodoList.setData(lsCategoriaPeriodo);
|
||||||
|
//categoriaPeriodoList.removeItem(cPeriodo);
|
||||||
|
|
||||||
|
categoriaDescuento.setCategoriaPeriodoList(lsCategoriaPeriodo);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
Messagebox.show(
|
||||||
|
Labels.getLabel("editarConfiguracionCategoriaController.MSG.selecionarPeriodo"),
|
||||||
|
Labels.getLabel("editarConfiguracionCategoriaController.window.title"),
|
||||||
|
Messagebox.OK, Messagebox.EXCLAMATION);
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch (Exception ex) {
|
||||||
|
log.error(ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onClick$btnSalvar(Event ev) {
|
||||||
|
try {
|
||||||
|
categoriaDescuento.setActivo(true);
|
||||||
|
categoriaDescuento.setFecmodif(Calendar.getInstance().getTime());
|
||||||
|
categoriaDescuento.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
|
||||||
|
|
||||||
|
|
||||||
|
if (categoriaDescuento.getCategoriadescuentoId() != null) {
|
||||||
|
// categoriaDescuentoService.suscribir(categoriaDescuento);
|
||||||
|
// categoriaDescuentoList.addItem(categoriaDescuento);
|
||||||
|
// } else {
|
||||||
|
categoriaDescuentoService.actualizacion(categoriaDescuento);
|
||||||
|
categoriaDescuentoList.updateItem(categoriaDescuento);
|
||||||
|
}
|
||||||
|
|
||||||
|
closeWindow();
|
||||||
|
} catch (Exception ex) {
|
||||||
|
log.error(ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,193 @@
|
||||||
|
/*
|
||||||
|
* To change this template, choose Tools | Templates
|
||||||
|
* and open the template in the editor.
|
||||||
|
*/
|
||||||
|
package com.rjconsultores.ventaboletos.web.gui.controladores.configuracioneccomerciales;
|
||||||
|
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.Empresa;
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.FormaPago;
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.FormaPagoDet;
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.PuntoVenta;
|
||||||
|
import com.rjconsultores.ventaboletos.service.EmpresaService;
|
||||||
|
import com.rjconsultores.ventaboletos.service.FormaPagoDetService;
|
||||||
|
import com.rjconsultores.ventaboletos.service.FormaPagoService;
|
||||||
|
import com.rjconsultores.ventaboletos.service.PuntoVentaService;
|
||||||
|
import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.MyGenericForwardComposer;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.MyListbox;
|
||||||
|
import java.util.Calendar;
|
||||||
|
import java.util.List;
|
||||||
|
import org.apache.log4j.Logger;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.context.annotation.Scope;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.zkoss.util.resource.Labels;
|
||||||
|
import org.zkoss.zhtml.Messagebox;
|
||||||
|
import org.zkoss.zk.ui.Component;
|
||||||
|
import org.zkoss.zk.ui.Executions;
|
||||||
|
import org.zkoss.zk.ui.event.Event;
|
||||||
|
import org.zkoss.zul.Button;
|
||||||
|
import org.zkoss.zul.Combobox;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Administrador
|
||||||
|
*/
|
||||||
|
@Controller("editarConfiguracionFormaPagoController")
|
||||||
|
@Scope("prototype")
|
||||||
|
public class EditarConfiguracionFormaPagoController extends MyGenericForwardComposer {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private FormaPagoDetService formaPagoDetService;
|
||||||
|
@Autowired
|
||||||
|
private EmpresaService empresaService;
|
||||||
|
@Autowired
|
||||||
|
private PuntoVentaService puntoVentaService;
|
||||||
|
@Autowired
|
||||||
|
private FormaPagoService formaPagoService;
|
||||||
|
private MyListbox configFormaPagoList;
|
||||||
|
private FormaPagoDet formaPagoDet;
|
||||||
|
private List<Empresa> lsEmpresas;
|
||||||
|
private List<PuntoVenta> lsPuntosVentas;
|
||||||
|
private List<FormaPago> lsFormaPago;
|
||||||
|
private Combobox cmbFormaPago;
|
||||||
|
private Combobox cmbPuntoVenta;
|
||||||
|
private Combobox cmbRestriccionFormaPago;
|
||||||
|
private Button btnApagar;
|
||||||
|
private static Logger log = Logger.getLogger(EditarConfiguracionFormaPagoController.class);
|
||||||
|
|
||||||
|
public Button getBtnApagar() {
|
||||||
|
return btnApagar;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBtnApagar(Button btnApagar) {
|
||||||
|
this.btnApagar = btnApagar;
|
||||||
|
}
|
||||||
|
|
||||||
|
public FormaPagoDet getFormaPagoDet() {
|
||||||
|
return formaPagoDet;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFormaPagoDet(FormaPagoDet formaPagoDet) {
|
||||||
|
this.formaPagoDet = formaPagoDet;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<Empresa> getLsEmpresas() {
|
||||||
|
return lsEmpresas;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLsEmpresas(List<Empresa> lsEmpresas) {
|
||||||
|
this.lsEmpresas = lsEmpresas;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<PuntoVenta> getLsPuntosVentas() {
|
||||||
|
return lsPuntosVentas;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLsPuntosVentas(List<PuntoVenta> lsPuntosVentas) {
|
||||||
|
this.lsPuntosVentas = lsPuntosVentas;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<FormaPago> getLsFormaPago() {
|
||||||
|
return lsFormaPago;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLsFormaPago(List<FormaPago> lsFormaPago) {
|
||||||
|
this.lsFormaPago = lsFormaPago;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Combobox getCmbFormaPago() {
|
||||||
|
return cmbFormaPago;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCmbFormaPago(Combobox cmbFormaPago) {
|
||||||
|
this.cmbFormaPago = cmbFormaPago;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Combobox getCmbPuntoVenta() {
|
||||||
|
return cmbPuntoVenta;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCmbPuntoVenta(Combobox cmbPuntoVenta) {
|
||||||
|
this.cmbPuntoVenta = cmbPuntoVenta;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Combobox getCmbRestriccionFormaPago() {
|
||||||
|
return cmbRestriccionFormaPago;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCmbRestriccionFormaPago(Combobox cmbRestriccionFormaPago) {
|
||||||
|
this.cmbRestriccionFormaPago = cmbRestriccionFormaPago;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void doAfterCompose(Component comp) throws Exception {
|
||||||
|
lsEmpresas = empresaService.obtenerTodos();
|
||||||
|
lsPuntosVentas = puntoVentaService.obtenerTodos();
|
||||||
|
lsFormaPago = formaPagoService.obtenerTodos();
|
||||||
|
|
||||||
|
super.doAfterCompose(comp);
|
||||||
|
|
||||||
|
formaPagoDet = (FormaPagoDet) Executions.getCurrent().getArg().get("formaPagoDet");
|
||||||
|
configFormaPagoList = (MyListbox) Executions.getCurrent().getArg().get("configFormaPagoList");
|
||||||
|
|
||||||
|
if (formaPagoDet.getFormapagodetId() == null) {
|
||||||
|
btnApagar.setVisible(Boolean.FALSE);
|
||||||
|
}
|
||||||
|
|
||||||
|
cmbFormaPago.focus();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onClick$btnSalvar(Event ev) {
|
||||||
|
cmbFormaPago.getSelectedItem().getValue();
|
||||||
|
cmbPuntoVenta.getSelectedItem().getValue();
|
||||||
|
cmbRestriccionFormaPago.getSelectedItem().getValue();
|
||||||
|
|
||||||
|
try {
|
||||||
|
formaPagoDet.setActivo(Boolean.TRUE);
|
||||||
|
formaPagoDet.setFecmodif(Calendar.getInstance().getTime());
|
||||||
|
formaPagoDet.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
|
||||||
|
|
||||||
|
if (formaPagoDet.getFormapagodetId() == null) {
|
||||||
|
formaPagoDetService.suscribir(formaPagoDet);
|
||||||
|
configFormaPagoList.addItem(formaPagoDet);
|
||||||
|
} else {
|
||||||
|
formaPagoDetService.actualizacion(formaPagoDet);
|
||||||
|
configFormaPagoList.updateItem(formaPagoDet);
|
||||||
|
}
|
||||||
|
|
||||||
|
Messagebox.show(
|
||||||
|
Labels.getLabel("editarConfiguracionFormaPagoController.MSG.suscribirOK"),
|
||||||
|
Labels.getLabel("editarConfiguracionFormaPagoController.window.title"),
|
||||||
|
Messagebox.OK, Messagebox.INFORMATION);
|
||||||
|
|
||||||
|
closeWindow();
|
||||||
|
} catch (Exception ex) {
|
||||||
|
log.error(ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onClick$btnApagar(Event ev) {
|
||||||
|
try {
|
||||||
|
int resp = Messagebox.show(
|
||||||
|
Labels.getLabel("editarConfiguracionFormaPagoController.MSG.borrarPergunta"),
|
||||||
|
Labels.getLabel("editarConfiguracionFormaPagoController.window.title"),
|
||||||
|
Messagebox.YES | Messagebox.NO, Messagebox.QUESTION);
|
||||||
|
|
||||||
|
if (resp == Messagebox.YES) {
|
||||||
|
formaPagoDetService.borrar(formaPagoDet);
|
||||||
|
|
||||||
|
Messagebox.show(
|
||||||
|
Labels.getLabel("editarConfiguracionFormaPagoController.MSG.borrarOK"),
|
||||||
|
Labels.getLabel("editarConfiguracionFormaPagoController.window.title"),
|
||||||
|
Messagebox.OK, Messagebox.INFORMATION);
|
||||||
|
|
||||||
|
configFormaPagoList.removeItem(formaPagoDet);
|
||||||
|
|
||||||
|
closeWindow();
|
||||||
|
}
|
||||||
|
} catch (Exception ex) {
|
||||||
|
log.error(ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,218 @@
|
||||||
|
/*
|
||||||
|
* To change this template, choose Tools | Templates
|
||||||
|
* and open the template in the editor.
|
||||||
|
*/
|
||||||
|
package com.rjconsultores.ventaboletos.web.gui.controladores.configuracioneccomerciales;
|
||||||
|
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.Constante;
|
||||||
|
import com.rjconsultores.ventaboletos.service.ConstanteService;
|
||||||
|
import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.MyGenericForwardComposer;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.MyListbox;
|
||||||
|
import org.apache.log4j.Logger;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.context.annotation.Scope;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import java.util.Calendar;
|
||||||
|
import java.util.List;
|
||||||
|
import org.zkoss.util.resource.Labels;
|
||||||
|
import org.zkoss.zk.ui.Component;
|
||||||
|
import org.zkoss.zk.ui.Executions;
|
||||||
|
import org.zkoss.zk.ui.event.Event;
|
||||||
|
import org.zkoss.zul.Button;
|
||||||
|
import org.zkoss.zul.Messagebox;
|
||||||
|
import org.zkoss.zul.Radio;
|
||||||
|
import org.zkoss.zul.Textbox;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Rafius
|
||||||
|
*/
|
||||||
|
@Controller("editarConfiguracionGeneralController")
|
||||||
|
@Scope("prototype")
|
||||||
|
public class EditarConfiguracionGeneralController extends MyGenericForwardComposer {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ConstanteService constanteService;
|
||||||
|
private Constante constante;
|
||||||
|
private MyListbox constanteList;
|
||||||
|
private static Logger log = Logger.getLogger(EditarConfiguracionGeneralController.class);
|
||||||
|
private Textbox txtNome;
|
||||||
|
private Textbox descconstante;
|
||||||
|
private Textbox valorconstante;
|
||||||
|
private Textbox indtipoconstante;
|
||||||
|
private Radio radMantenimientoUsuarioSi;
|
||||||
|
private Radio radMantenimientoUsuarioNo;
|
||||||
|
private Button btnApagar;
|
||||||
|
private Button btnSalvar;
|
||||||
|
|
||||||
|
public Button getBtnApagar() {
|
||||||
|
return btnApagar;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBtnApagar(Button btnApagar) {
|
||||||
|
this.btnApagar = btnApagar;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Radio getRadMantenimientoUsuarioNo() {
|
||||||
|
return radMantenimientoUsuarioNo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRadMantenimientoUsuarioNo(Radio radMantenimientoUsuarioNo) {
|
||||||
|
this.radMantenimientoUsuarioNo = radMantenimientoUsuarioNo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Radio getRadMantenimientoUsuarioSi() {
|
||||||
|
return radMantenimientoUsuarioSi;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRadMantenimientoUsuarioSi(Radio radMantenimientoUsuarioSi) {
|
||||||
|
this.radMantenimientoUsuarioSi = radMantenimientoUsuarioSi;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Textbox getTxtNome() {
|
||||||
|
return txtNome;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTxtNome(Textbox txtNome) {
|
||||||
|
this.txtNome = txtNome;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void doAfterCompose(Component comp) throws Exception {
|
||||||
|
super.doAfterCompose(comp);
|
||||||
|
|
||||||
|
constante = (Constante) Executions.getCurrent().getArg().get("constante");
|
||||||
|
constanteList = (MyListbox) Executions.getCurrent().getArg().get("constanteList");
|
||||||
|
|
||||||
|
radMantenimientoUsuarioSi.setChecked(true);
|
||||||
|
radMantenimientoUsuarioNo.setChecked(false);
|
||||||
|
|
||||||
|
if (constante.getConstanteId() != null) {
|
||||||
|
if (constante.getIndmantenimientousuario() == Boolean.FALSE) {
|
||||||
|
radMantenimientoUsuarioSi.setChecked(false);
|
||||||
|
radMantenimientoUsuarioNo.setChecked(true);
|
||||||
|
|
||||||
|
//Se mantenimiento es NO, não se pode fazer nada na tela.
|
||||||
|
valorconstante.setDisabled(Boolean.TRUE);
|
||||||
|
|
||||||
|
radMantenimientoUsuarioSi.setDisabled(Boolean.TRUE);
|
||||||
|
radMantenimientoUsuarioNo.setDisabled(Boolean.TRUE);
|
||||||
|
|
||||||
|
btnApagar.setVisible(Boolean.FALSE);
|
||||||
|
btnSalvar.setVisible(Boolean.FALSE);
|
||||||
|
|
||||||
|
Messagebox.show(
|
||||||
|
Labels.getLabel("MSG.noEditabled"),
|
||||||
|
Labels.getLabel("editarConfiguracionGeneralController.window.title"),
|
||||||
|
Messagebox.OK, Messagebox.INFORMATION);
|
||||||
|
}
|
||||||
|
|
||||||
|
txtNome.setDisabled(Boolean.TRUE);
|
||||||
|
descconstante.setDisabled(Boolean.TRUE);
|
||||||
|
indtipoconstante.setDisabled(Boolean.TRUE);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (constante.getConstanteId() == null) {
|
||||||
|
btnApagar.setVisible(Boolean.FALSE);
|
||||||
|
}
|
||||||
|
|
||||||
|
txtNome.focus();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onClick$btnSalvar(Event ev) {
|
||||||
|
txtNome.getValue();
|
||||||
|
valorconstante.getValue();
|
||||||
|
//indtipoconstante.getValue();
|
||||||
|
|
||||||
|
try {
|
||||||
|
constante.setActivo(true);
|
||||||
|
constante.setFecmodif(Calendar.getInstance().getTime());
|
||||||
|
constante.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
|
||||||
|
constante.setIndmantenimientousuario(radMantenimientoUsuarioSi.isChecked() ? Boolean.TRUE : Boolean.FALSE);
|
||||||
|
|
||||||
|
if (constante.getConstanteId() == null) {
|
||||||
|
List<Constante> lsConstante = constanteService.buscar(constante.getNombconstante());
|
||||||
|
|
||||||
|
if (!lsConstante.isEmpty()) {
|
||||||
|
Messagebox.show(
|
||||||
|
Labels.getLabel("MSG.Registro.Existe"),
|
||||||
|
Labels.getLabel("editarConfiguracionGeneralController.window.title"),
|
||||||
|
Messagebox.OK, Messagebox.EXCLAMATION);
|
||||||
|
} else {
|
||||||
|
constanteService.suscribir(constante);
|
||||||
|
constanteList.addItem(constante);
|
||||||
|
|
||||||
|
Messagebox.show(
|
||||||
|
Labels.getLabel("editarConfiguracionGeneralController.MSG.suscribirOK"),
|
||||||
|
Labels.getLabel("editarConfiguracionGeneralController.window.title"),
|
||||||
|
Messagebox.OK, Messagebox.INFORMATION);
|
||||||
|
|
||||||
|
closeWindow();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
constanteService.actualizacion(constante);
|
||||||
|
constanteList.updateItem(constante);
|
||||||
|
|
||||||
|
Messagebox.show(
|
||||||
|
Labels.getLabel("editarConfiguracionGeneralController.MSG.suscribirOK"),
|
||||||
|
Labels.getLabel("editarConfiguracionGeneralController.window.title"),
|
||||||
|
Messagebox.OK, Messagebox.INFORMATION);
|
||||||
|
|
||||||
|
closeWindow();
|
||||||
|
}
|
||||||
|
} catch (Exception ex) {
|
||||||
|
log.error(ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onClick$btnApagar(Event ev) {
|
||||||
|
try {
|
||||||
|
int resp = Messagebox.show(
|
||||||
|
Labels.getLabel("editarConfiguracionGeneralController.MSG.borrarPergunta"),
|
||||||
|
Labels.getLabel("editarConfiguracionGeneralController.window.title"),
|
||||||
|
Messagebox.YES | Messagebox.NO, Messagebox.QUESTION);
|
||||||
|
|
||||||
|
if (resp == Messagebox.YES) {
|
||||||
|
|
||||||
|
constanteService.borrar(constante);
|
||||||
|
|
||||||
|
Messagebox.show(
|
||||||
|
Labels.getLabel("editarConfiguracionGeneralController.MSG.borrarOK"),
|
||||||
|
Labels.getLabel("editarConfiguracionGeneralController.window.title"),
|
||||||
|
Messagebox.OK, Messagebox.INFORMATION);
|
||||||
|
|
||||||
|
constanteList.removeItem(constante);
|
||||||
|
|
||||||
|
closeWindow();
|
||||||
|
}
|
||||||
|
} catch (Exception ex) {
|
||||||
|
log.error(ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public Constante getConstante() {
|
||||||
|
return constante;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setConstante(Constante constante) {
|
||||||
|
this.constante = constante;
|
||||||
|
}
|
||||||
|
|
||||||
|
public MyListbox getConstanteList() {
|
||||||
|
return constanteList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setConstanteList(MyListbox constanteList) {
|
||||||
|
this.constanteList = constanteList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ConstanteService getConstanteService() {
|
||||||
|
return constanteService;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setConstanteService(ConstanteService constanteService) {
|
||||||
|
this.constanteService = constanteService;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,936 @@
|
||||||
|
/*
|
||||||
|
* To change this template, choose Tools | Templates
|
||||||
|
* and open the template in the editor.
|
||||||
|
*/
|
||||||
|
package com.rjconsultores.ventaboletos.web.gui.controladores.configuracioneccomerciales;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Calendar;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.apache.log4j.Logger;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.context.annotation.Scope;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.zkoss.util.resource.Labels;
|
||||||
|
import org.zkoss.zk.ui.Component;
|
||||||
|
import org.zkoss.zk.ui.Executions;
|
||||||
|
import org.zkoss.zk.ui.event.Event;
|
||||||
|
import org.zkoss.zk.ui.util.Clients;
|
||||||
|
import org.zkoss.zul.Button;
|
||||||
|
import org.zkoss.zul.Combobox;
|
||||||
|
import org.zkoss.zul.Datebox;
|
||||||
|
import org.zkoss.zul.Intbox;
|
||||||
|
import org.zkoss.zul.Messagebox;
|
||||||
|
import org.zkoss.zul.Spinner;
|
||||||
|
import org.zkoss.zul.Tab;
|
||||||
|
import org.zkoss.zul.Textbox;
|
||||||
|
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.Categoria;
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.ClaseServicio;
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.Marca;
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.Parada;
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.PuntoVenta;
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.ReservacionCategoria;
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.ReservacionClase;
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.ReservacionCtrl;
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.ReservacionMarca;
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.ReservacionMercado;
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.ReservacionPuntoVenta;
|
||||||
|
import com.rjconsultores.ventaboletos.service.CategoriaService;
|
||||||
|
import com.rjconsultores.ventaboletos.service.ClaseServicioService;
|
||||||
|
import com.rjconsultores.ventaboletos.service.MarcaService;
|
||||||
|
import com.rjconsultores.ventaboletos.service.ParadaService;
|
||||||
|
import com.rjconsultores.ventaboletos.service.PuntoVentaService;
|
||||||
|
import com.rjconsultores.ventaboletos.service.ReservacionCtrlService;
|
||||||
|
import com.rjconsultores.ventaboletos.utilerias.DateUtil;
|
||||||
|
import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.MyGenericForwardComposer;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.MyListbox;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.render.RenderConfiguracionReservacionCategoria;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.render.RenderConfiguracionReservacionClase;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.render.RenderConfiguracionReservacionMarca;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.render.RenderConfiguracionReservacionMercado;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.render.RenderConfiguracionReservacionPuntoVenta;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Rafius
|
||||||
|
*/
|
||||||
|
@Controller("editarConfiguracionReservacionController")
|
||||||
|
@Scope("prototype")
|
||||||
|
public class EditarConfiguracionReservacionController extends MyGenericForwardComposer {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ReservacionCtrlService reservacionCtrlService;
|
||||||
|
@Autowired
|
||||||
|
private CategoriaService categoriaService;
|
||||||
|
@Autowired
|
||||||
|
private PuntoVentaService puntoVentaService;
|
||||||
|
@Autowired
|
||||||
|
private ClaseServicioService claseService;
|
||||||
|
@Autowired
|
||||||
|
private MarcaService marcaService;
|
||||||
|
@Autowired
|
||||||
|
private ParadaService paradaService;
|
||||||
|
private ReservacionCtrl reservacionCtrl;
|
||||||
|
private static Logger log = Logger.getLogger(EditarConfiguracionReservacionController.class);
|
||||||
|
private Datebox fecInicio;
|
||||||
|
private Datebox fecFinal;
|
||||||
|
private Textbox txtDescripcion;
|
||||||
|
private List<Categoria> lsCategoria;
|
||||||
|
private List<ClaseServicio> lsClase;
|
||||||
|
private List<Marca> lsMarca;
|
||||||
|
private MyListbox reservacionCtrlList;
|
||||||
|
private MyListbox reservacionCategoriaList;
|
||||||
|
private MyListbox reservacionClaseList;
|
||||||
|
private MyListbox reservacionMarcaList;
|
||||||
|
private MyListbox reservacionMercadoList;
|
||||||
|
private MyListbox reservacionPuntoVentaList;
|
||||||
|
private List<ReservacionCategoria> lsReservacionCategoria;
|
||||||
|
private List<ReservacionClase> lsReservacionClase;
|
||||||
|
private List<ReservacionMarca> lsReservacionMarca;
|
||||||
|
private List<ReservacionMercado> lsReservacionMercado;
|
||||||
|
private List<ReservacionPuntoVenta> lsReservacionPuntoVenta;
|
||||||
|
private Combobox cmbCategoria;
|
||||||
|
private Combobox cmbClase;
|
||||||
|
private Combobox cmbMarca;
|
||||||
|
private Combobox cmbPuntoVenta;
|
||||||
|
private Combobox cmbParadaOrigem;
|
||||||
|
private Combobox cmbParadaDestino;
|
||||||
|
private Intbox NumAsientosCorrida;
|
||||||
|
private Button btnApagar;
|
||||||
|
private Tab tabControl;
|
||||||
|
private Tab tabCategoria;
|
||||||
|
private Tab tabPunto;
|
||||||
|
private Tab tabClase;
|
||||||
|
private Tab tabMercado;
|
||||||
|
private Tab tabMarca;
|
||||||
|
private Spinner spTiempoLiberacionHora;
|
||||||
|
private Spinner spTiempoLiberacionMinuto;
|
||||||
|
private Spinner spTiempoLiberacionInternetHora;
|
||||||
|
private Spinner spTiempoLiberacionInternetMinuto;
|
||||||
|
private Spinner spTiempoPrevioHora;
|
||||||
|
private Spinner spTiempoPrevioMinuto;
|
||||||
|
private Spinner spTiempoPrevioInternetHora;
|
||||||
|
private Spinner spTiempoPrevioInternetMinuto;
|
||||||
|
|
||||||
|
public Button getBtnApagar() {
|
||||||
|
return btnApagar;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBtnApagar(Button btnApagar) {
|
||||||
|
this.btnApagar = btnApagar;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void doAfterCompose(Component comp) throws Exception {
|
||||||
|
|
||||||
|
lsCategoria = categoriaService.obtenerTodos();
|
||||||
|
lsClase = claseService.obtenerTodos();
|
||||||
|
lsMarca = marcaService.obtenerTodos();
|
||||||
|
|
||||||
|
super.doAfterCompose(comp);
|
||||||
|
|
||||||
|
reservacionCtrl = (ReservacionCtrl) Executions.getCurrent().getArg().get("reservacionCtrl");
|
||||||
|
reservacionCtrlList = (MyListbox) Executions.getCurrent().getArg().get("reservacionCtrlList");
|
||||||
|
|
||||||
|
//Categoria
|
||||||
|
reservacionCategoriaList.setItemRenderer(new RenderConfiguracionReservacionCategoria());
|
||||||
|
lsReservacionCategoria = new ArrayList<ReservacionCategoria>();
|
||||||
|
//Clase
|
||||||
|
reservacionClaseList.setItemRenderer(new RenderConfiguracionReservacionClase());
|
||||||
|
lsReservacionClase = new ArrayList<ReservacionClase>();
|
||||||
|
//Marca
|
||||||
|
reservacionMarcaList.setItemRenderer(new RenderConfiguracionReservacionMarca());
|
||||||
|
lsReservacionMarca = new ArrayList<ReservacionMarca>();
|
||||||
|
//PuntoVenta
|
||||||
|
reservacionPuntoVentaList.setItemRenderer(new RenderConfiguracionReservacionPuntoVenta());
|
||||||
|
lsReservacionPuntoVenta = new ArrayList<ReservacionPuntoVenta>();
|
||||||
|
//Mercado
|
||||||
|
reservacionMercadoList.setItemRenderer(new RenderConfiguracionReservacionMercado());
|
||||||
|
lsReservacionMercado = new ArrayList<ReservacionMercado>();
|
||||||
|
|
||||||
|
//Recarrega Listas
|
||||||
|
if (reservacionCtrl.getReservacionctrlId() != null) {
|
||||||
|
reservacionCtrl = reservacionCtrlService.obtenerID(reservacionCtrl.getReservacionctrlId());
|
||||||
|
|
||||||
|
lsReservacionCategoria = reservacionCtrl.getReservacionCategoriaList();
|
||||||
|
reservacionCategoriaList.setData(lsReservacionCategoria);
|
||||||
|
|
||||||
|
lsReservacionClase = reservacionCtrl.getReservacionClaseList();
|
||||||
|
reservacionClaseList.setData(lsReservacionClase);
|
||||||
|
|
||||||
|
lsReservacionMarca = reservacionCtrl.getReservacionMarcaList();
|
||||||
|
reservacionMarcaList.setData(lsReservacionMarca);
|
||||||
|
|
||||||
|
lsReservacionPuntoVenta = reservacionCtrl.getReservacionPuntoVentaList();
|
||||||
|
reservacionPuntoVentaList.setData(lsReservacionPuntoVenta);
|
||||||
|
|
||||||
|
lsReservacionMercado = reservacionCtrl.getReservacionMercadoList();
|
||||||
|
reservacionMercadoList.setData(lsReservacionMercado);
|
||||||
|
|
||||||
|
//Tiempos
|
||||||
|
String[] horaMinutoTiempoliberacion = capturarHoraMinuto(reservacionCtrl.getTiempoliberacion());
|
||||||
|
String[] horaMinutoTiempoliberacioninternet = capturarHoraMinuto(reservacionCtrl.getTiempoliberacioninternet());
|
||||||
|
String[] horaMinutoTiempoprevio = capturarHoraMinuto(reservacionCtrl.getTiempoprevio());
|
||||||
|
String[] horaMinutoTiempopreviointernet = capturarHoraMinuto(reservacionCtrl.getTiempopreviointernet());
|
||||||
|
|
||||||
|
spTiempoLiberacionHora.setText(horaMinutoTiempoliberacion[0]);
|
||||||
|
spTiempoLiberacionMinuto.setText(horaMinutoTiempoliberacion[1]);
|
||||||
|
spTiempoLiberacionInternetHora.setText(horaMinutoTiempoliberacioninternet[0]);
|
||||||
|
spTiempoLiberacionInternetMinuto.setText(horaMinutoTiempoliberacioninternet[1]);
|
||||||
|
spTiempoPrevioHora.setText(horaMinutoTiempoprevio[0]);
|
||||||
|
spTiempoPrevioMinuto.setText(horaMinutoTiempoprevio[1]);
|
||||||
|
spTiempoPrevioInternetHora.setText(horaMinutoTiempopreviointernet[0]);
|
||||||
|
spTiempoPrevioInternetMinuto.setText(horaMinutoTiempopreviointernet[1]);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if (reservacionCtrl.getReservacionctrlId() == null) {
|
||||||
|
btnApagar.setVisible(Boolean.FALSE);
|
||||||
|
}
|
||||||
|
|
||||||
|
txtDescripcion.focus();
|
||||||
|
}
|
||||||
|
|
||||||
|
public String[] capturarHoraMinuto(Date data) {
|
||||||
|
String[] horaMinuto = new String[2];
|
||||||
|
Calendar c = Calendar.getInstance();
|
||||||
|
c.setTime(data);
|
||||||
|
System.out.println(DateUtil.getFecInicio().getTime() + " " + c.getTime());
|
||||||
|
Long tempo = DateUtil.getElapsedMinutos(DateUtil.getFecInicio().getTime(), c.getTime());
|
||||||
|
long minutos = (tempo % 60);
|
||||||
|
Integer horas = (tempo.intValue() / 60);
|
||||||
|
String sMinutos = String.valueOf(minutos);
|
||||||
|
horaMinuto[0] = horas.toString();
|
||||||
|
horaMinuto[1] = ((sMinutos.length() < 2) ? "0" + sMinutos : sMinutos);
|
||||||
|
|
||||||
|
return horaMinuto;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onClick$btnAdicionarCategoria(Event ev) throws InterruptedException {
|
||||||
|
if (cmbCategoria.getSelectedItem() == null) {
|
||||||
|
Messagebox.show(
|
||||||
|
Labels.getLabel("MSG.Error.combobox"),
|
||||||
|
Labels.getLabel("editarPricingController.windowMarca.title"),
|
||||||
|
Messagebox.OK, Messagebox.EXCLAMATION);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
cmbCategoria.getSelectedItem().getValue();
|
||||||
|
try {
|
||||||
|
ReservacionCategoria rCategoria = new ReservacionCategoria();
|
||||||
|
rCategoria.setReservacionCtrl(reservacionCtrl);
|
||||||
|
rCategoria.setActivo(Boolean.TRUE);
|
||||||
|
rCategoria.setCategoria((Categoria) cmbCategoria.getSelectedItem().getValue());
|
||||||
|
rCategoria.setFecmodif(Calendar.getInstance().getTime());
|
||||||
|
rCategoria.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
|
||||||
|
boolean existe = false;
|
||||||
|
for (ReservacionCategoria rc : lsReservacionCategoria) {
|
||||||
|
if (rc.getCategoria().equals(rCategoria.getCategoria()) && rc.getActivo()) {
|
||||||
|
existe = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!existe) {
|
||||||
|
lsReservacionCategoria.add(rCategoria);
|
||||||
|
|
||||||
|
reservacionCtrl.setReservacionCategoriaList(lsReservacionCategoria);
|
||||||
|
}
|
||||||
|
List<ReservacionCategoria> lsReservacionCategoriaAtivo = new ArrayList<ReservacionCategoria>();
|
||||||
|
for (ReservacionCategoria rc : lsReservacionCategoria) {
|
||||||
|
if (rc.getActivo()) {
|
||||||
|
lsReservacionCategoriaAtivo.add(rc);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
reservacionCategoriaList.setData(lsReservacionCategoriaAtivo);
|
||||||
|
} catch (Exception ex) {
|
||||||
|
log.error(ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onClick$btnAdicionarClase(Event ev) throws InterruptedException {
|
||||||
|
if (cmbClase.getSelectedItem() == null) {
|
||||||
|
Messagebox.show(
|
||||||
|
Labels.getLabel("MSG.Error.combobox"),
|
||||||
|
Labels.getLabel("editarPricingController.windowMarca.title"),
|
||||||
|
Messagebox.OK, Messagebox.EXCLAMATION);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
cmbClase.getSelectedItem().getValue();
|
||||||
|
try {
|
||||||
|
ReservacionClase rClase = new ReservacionClase();
|
||||||
|
rClase.setReservacionCtrl(reservacionCtrl);
|
||||||
|
rClase.setActivo(Boolean.TRUE);
|
||||||
|
rClase.setClaseServicio((ClaseServicio) cmbClase.getSelectedItem().getValue());
|
||||||
|
rClase.setFecmodif(Calendar.getInstance().getTime());
|
||||||
|
rClase.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
|
||||||
|
boolean existe = false;
|
||||||
|
for (ReservacionClase rc : lsReservacionClase) {
|
||||||
|
if (rc.getClaseServicio().equals(rClase.getClaseServicio()) && rc.getActivo()) {
|
||||||
|
existe = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!existe) {
|
||||||
|
lsReservacionClase.add(rClase);
|
||||||
|
//reservacionClaseList.addItem(rClase);
|
||||||
|
reservacionCtrl.setReservacionClaseList(lsReservacionClase);
|
||||||
|
}
|
||||||
|
List<ReservacionClase> lsReservacionCategoriaAtivo = new ArrayList<ReservacionClase>();
|
||||||
|
for (ReservacionClase rc : lsReservacionClase) {
|
||||||
|
if (rc.getActivo()) {
|
||||||
|
lsReservacionCategoriaAtivo.add(rc);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
reservacionClaseList.setData(lsReservacionCategoriaAtivo);
|
||||||
|
} catch (Exception ex) {
|
||||||
|
log.error(ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onClick$btnAdicionarMarca(Event ev) throws InterruptedException {
|
||||||
|
if (cmbMarca.getSelectedItem() == null) {
|
||||||
|
Messagebox.show(
|
||||||
|
Labels.getLabel("MSG.Error.combobox"),
|
||||||
|
Labels.getLabel("editarPricingController.windowMarca.title"),
|
||||||
|
Messagebox.OK, Messagebox.EXCLAMATION);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
cmbMarca.getSelectedItem().getValue();
|
||||||
|
try {
|
||||||
|
ReservacionMarca rMarca = new ReservacionMarca();
|
||||||
|
rMarca.setReservacionCtrl(reservacionCtrl);
|
||||||
|
rMarca.setActivo(Boolean.TRUE);
|
||||||
|
rMarca.setMarca((Marca) cmbMarca.getSelectedItem().getValue());
|
||||||
|
rMarca.setFecmodif(Calendar.getInstance().getTime());
|
||||||
|
rMarca.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
|
||||||
|
boolean existe = false;
|
||||||
|
for (ReservacionMarca rm : lsReservacionMarca) {
|
||||||
|
if (rm.getMarca().equals(rMarca.getMarca()) && rm.getActivo()) {
|
||||||
|
existe = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!existe) {
|
||||||
|
lsReservacionMarca.add(rMarca);
|
||||||
|
//reservacionMarcaList.addItem(rMarca);
|
||||||
|
reservacionCtrl.setReservacionMarcaList(lsReservacionMarca);
|
||||||
|
}
|
||||||
|
List<ReservacionMarca> lsReservacionMarcaAtivo = new ArrayList<ReservacionMarca>();
|
||||||
|
for (ReservacionMarca rc : lsReservacionMarca) {
|
||||||
|
if (rc.getActivo()) {
|
||||||
|
lsReservacionMarcaAtivo.add(rc);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
reservacionMarcaList.setData(lsReservacionMarcaAtivo);
|
||||||
|
} catch (Exception ex) {
|
||||||
|
log.error(ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onClick$btnAdicionarPuntoVenta(Event ev) throws InterruptedException {
|
||||||
|
if (cmbPuntoVenta.getSelectedItem() == null) {
|
||||||
|
Messagebox.show(
|
||||||
|
Labels.getLabel("MSG.Error.combobox"),
|
||||||
|
Labels.getLabel("editarPricingController.windowMarca.title"),
|
||||||
|
Messagebox.OK, Messagebox.EXCLAMATION);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
cmbPuntoVenta.getSelectedItem().getValue();
|
||||||
|
try {
|
||||||
|
ReservacionPuntoVenta rPuntoVenta = new ReservacionPuntoVenta();
|
||||||
|
rPuntoVenta.setReservacionCtrl(reservacionCtrl);
|
||||||
|
rPuntoVenta.setActivo(Boolean.TRUE);
|
||||||
|
rPuntoVenta.setPuntoVenta((PuntoVenta) cmbPuntoVenta.getSelectedItem().getValue());
|
||||||
|
rPuntoVenta.setFecmodif(Calendar.getInstance().getTime());
|
||||||
|
rPuntoVenta.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
|
||||||
|
boolean existe = false;
|
||||||
|
for (ReservacionPuntoVenta rpv : lsReservacionPuntoVenta) {
|
||||||
|
if (rpv.getPuntoVenta().equals(rPuntoVenta.getPuntoVenta()) && rpv.getActivo()) {
|
||||||
|
existe = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!existe) {
|
||||||
|
lsReservacionPuntoVenta.add(rPuntoVenta);
|
||||||
|
// reservacionPuntoVentaList.addItem(rPuntoVenta);
|
||||||
|
reservacionCtrl.setReservacionPuntoVentaList(lsReservacionPuntoVenta);
|
||||||
|
}
|
||||||
|
List<ReservacionPuntoVenta> lsReservacionPuntoVentaAtivo = new ArrayList<ReservacionPuntoVenta>();
|
||||||
|
for (ReservacionPuntoVenta rc : lsReservacionPuntoVenta) {
|
||||||
|
if (rc.getActivo()) {
|
||||||
|
lsReservacionPuntoVentaAtivo.add(rc);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
reservacionPuntoVentaList.setData(lsReservacionPuntoVentaAtivo);
|
||||||
|
} catch (Exception ex) {
|
||||||
|
log.error(ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onClick$btnAdicionarMercado(Event ev) throws InterruptedException {
|
||||||
|
if (cmbParadaOrigem.getSelectedItem() == null || cmbParadaDestino.getSelectedItem() == null) {
|
||||||
|
Messagebox.show(
|
||||||
|
Labels.getLabel("MSG.Error.combobox"),
|
||||||
|
Labels.getLabel("editarPricingController.windowMarca.title"),
|
||||||
|
Messagebox.OK, Messagebox.EXCLAMATION);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Parada origem = (Parada) cmbParadaOrigem.getSelectedItem().getValue();
|
||||||
|
Parada destino = (Parada) cmbParadaDestino.getSelectedItem().getValue();
|
||||||
|
|
||||||
|
try {
|
||||||
|
if (origem.equals(destino)
|
||||||
|
&& (origem.getParadaId() != -1 && destino.getParadaId() != -1)) {
|
||||||
|
Messagebox.show(
|
||||||
|
Labels.getLabel("editarConfiguracionReservacionController.MSG.selectItemDiferente"),
|
||||||
|
Labels.getLabel("editarConfiguracionReservacionController.window.title"),
|
||||||
|
Messagebox.OK, Messagebox.EXCLAMATION);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
ReservacionMercado rMercado = new ReservacionMercado();
|
||||||
|
rMercado.setReservacionCtrl(reservacionCtrl);
|
||||||
|
rMercado.setActivo(Boolean.TRUE);
|
||||||
|
rMercado.setParadaOrigem(origem);
|
||||||
|
rMercado.setParadaDestino(destino);
|
||||||
|
rMercado.setFecmodif(Calendar.getInstance().getTime());
|
||||||
|
rMercado.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
|
||||||
|
boolean existe = false;
|
||||||
|
for (ReservacionMercado rpv : lsReservacionMercado) {
|
||||||
|
if (rpv.getParadaOrigem().equals(rMercado.getParadaOrigem()) && rpv.getParadaDestino().equals(rMercado.getParadaDestino()) && rpv.getActivo()) {
|
||||||
|
existe = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!existe) {
|
||||||
|
lsReservacionMercado.add(rMercado);
|
||||||
|
//reservacionMercadoList.addItem(rMercado);
|
||||||
|
reservacionCtrl.setReservacionMercadoList(lsReservacionMercado);
|
||||||
|
}
|
||||||
|
List<ReservacionMercado> lsReservacionMercadoAtivo = new ArrayList<ReservacionMercado>();
|
||||||
|
for (ReservacionMercado rc : lsReservacionMercado) {
|
||||||
|
if (rc.getActivo()) {
|
||||||
|
lsReservacionMercadoAtivo.add(rc);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
reservacionMercadoList.setData(lsReservacionMercadoAtivo);
|
||||||
|
|
||||||
|
} catch (Exception ex) {
|
||||||
|
log.error(ex);
|
||||||
|
Clients.alert(
|
||||||
|
Labels.getLabel("MSG.Error"),
|
||||||
|
Labels.getLabel("editarConfiguracionReservacionController.window.title"),
|
||||||
|
Messagebox.EXCLAMATION);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onClick$btnRemoverPuntoVenta(Event ev) {
|
||||||
|
try {
|
||||||
|
ReservacionPuntoVenta reservacioPuntoVenta = (ReservacionPuntoVenta) reservacionPuntoVentaList.getSelected();
|
||||||
|
if (reservacioPuntoVenta != null) {
|
||||||
|
lsReservacionPuntoVenta.remove(reservacioPuntoVenta);
|
||||||
|
reservacioPuntoVenta.setFecmodif(Calendar.getInstance().getTime());
|
||||||
|
reservacioPuntoVenta.setActivo(Boolean.FALSE);
|
||||||
|
reservacioPuntoVenta.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
|
||||||
|
lsReservacionPuntoVenta.add(reservacioPuntoVenta);
|
||||||
|
reservacionPuntoVentaList.updateItem(reservacioPuntoVenta);
|
||||||
|
reservacionPuntoVentaList.removeItem(reservacioPuntoVenta);
|
||||||
|
reservacionCtrl.setReservacionPuntoVentaList(lsReservacionPuntoVenta);
|
||||||
|
} else {
|
||||||
|
Messagebox.show(
|
||||||
|
Labels.getLabel("editarConfiguracionReservacionController.MSG.selectItem"),
|
||||||
|
Labels.getLabel("editarConfiguracionReservacionController.window.title"),
|
||||||
|
Messagebox.OK, Messagebox.EXCLAMATION);
|
||||||
|
}
|
||||||
|
} catch (Exception ex) {
|
||||||
|
log.error(ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onClick$btnRemoverCategoria(Event ev) {
|
||||||
|
try {
|
||||||
|
ReservacionCategoria reservacionCategoria = (ReservacionCategoria) reservacionCategoriaList.getSelected();
|
||||||
|
if (reservacionCategoria != null) {
|
||||||
|
lsReservacionCategoria.remove(reservacionCategoria);
|
||||||
|
reservacionCategoria.setFecmodif(Calendar.getInstance().getTime());
|
||||||
|
reservacionCategoria.setActivo(Boolean.FALSE);
|
||||||
|
reservacionCategoria.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
|
||||||
|
lsReservacionCategoria.add(reservacionCategoria);
|
||||||
|
reservacionCategoriaList.updateItem(reservacionCategoria);
|
||||||
|
reservacionCategoriaList.removeItem(reservacionCategoria);
|
||||||
|
reservacionCtrl.setReservacionCategoriaList(lsReservacionCategoria);
|
||||||
|
} else {
|
||||||
|
Messagebox.show(
|
||||||
|
Labels.getLabel("editarConfiguracionReservacionController.MSG.selectItem"),
|
||||||
|
Labels.getLabel("editarConfiguracionReservacionController.window.title"),
|
||||||
|
Messagebox.OK, Messagebox.EXCLAMATION);
|
||||||
|
}
|
||||||
|
} catch (Exception ex) {
|
||||||
|
log.error(ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onClick$btnRemoverClase(Event ev) {
|
||||||
|
try {
|
||||||
|
ReservacionClase reservacioClase = (ReservacionClase) reservacionClaseList.getSelected();
|
||||||
|
if (reservacioClase != null) {
|
||||||
|
lsReservacionClase.remove(reservacioClase);
|
||||||
|
reservacioClase.setFecmodif(Calendar.getInstance().getTime());
|
||||||
|
reservacioClase.setActivo(Boolean.FALSE);
|
||||||
|
reservacioClase.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
|
||||||
|
lsReservacionClase.add(reservacioClase);
|
||||||
|
reservacionClaseList.updateItem(reservacioClase);
|
||||||
|
reservacionClaseList.removeItem(reservacioClase);
|
||||||
|
reservacionCtrl.setReservacionClaseList(lsReservacionClase);
|
||||||
|
} else {
|
||||||
|
Messagebox.show(
|
||||||
|
Labels.getLabel("editarConfiguracionReservacionController.MSG.selectItem"),
|
||||||
|
Labels.getLabel("editarConfiguracionReservacionController.window.title"),
|
||||||
|
Messagebox.OK, Messagebox.EXCLAMATION);
|
||||||
|
}
|
||||||
|
} catch (Exception ex) {
|
||||||
|
log.error(ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onClick$btnRemoverMarca(Event ev) {
|
||||||
|
try {
|
||||||
|
ReservacionMarca rMarca = (ReservacionMarca) reservacionMarcaList.getSelected();
|
||||||
|
if (rMarca != null) {
|
||||||
|
lsReservacionMarca.remove(rMarca);
|
||||||
|
rMarca.setFecmodif(Calendar.getInstance().getTime());
|
||||||
|
rMarca.setActivo(Boolean.FALSE);
|
||||||
|
rMarca.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
|
||||||
|
lsReservacionMarca.add(rMarca);
|
||||||
|
reservacionMarcaList.updateItem(rMarca);
|
||||||
|
reservacionMarcaList.removeItem(rMarca);
|
||||||
|
reservacionCtrl.setReservacionMarcaList(lsReservacionMarca);
|
||||||
|
} else {
|
||||||
|
Messagebox.show(
|
||||||
|
Labels.getLabel("editarConfiguracionReservacionController.MSG.selectItem"),
|
||||||
|
Labels.getLabel("editarConfiguracionReservacionController.window.title"),
|
||||||
|
Messagebox.OK, Messagebox.EXCLAMATION);
|
||||||
|
}
|
||||||
|
} catch (Exception ex) {
|
||||||
|
log.error(ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onClick$btnRemoverMercado(Event ev) {
|
||||||
|
try {
|
||||||
|
ReservacionMercado rMercado = (ReservacionMercado) reservacionMercadoList.getSelected();
|
||||||
|
if (rMercado != null) {
|
||||||
|
lsReservacionMercado.remove(rMercado);
|
||||||
|
rMercado.setFecmodif(Calendar.getInstance().getTime());
|
||||||
|
rMercado.setActivo(Boolean.FALSE);
|
||||||
|
rMercado.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
|
||||||
|
lsReservacionMercado.add(rMercado);
|
||||||
|
reservacionMercadoList.updateItem(rMercado);
|
||||||
|
reservacionMercadoList.removeItem(rMercado);
|
||||||
|
reservacionCtrl.setReservacionMercadoList(lsReservacionMercado);
|
||||||
|
} else {
|
||||||
|
Messagebox.show(
|
||||||
|
Labels.getLabel("editarConfiguracionReservacionController.MSG.selectItem"),
|
||||||
|
Labels.getLabel("editarConfiguracionReservacionController.window.title"),
|
||||||
|
Messagebox.OK, Messagebox.EXCLAMATION);
|
||||||
|
}
|
||||||
|
} catch (Exception ex) {
|
||||||
|
log.error(ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onClick$btnSalvar(Event ev) throws InterruptedException {
|
||||||
|
tabControl.setSelected(Boolean.TRUE);
|
||||||
|
txtDescripcion.getValue();
|
||||||
|
fecInicio.getValue();
|
||||||
|
fecFinal.getValue();
|
||||||
|
|
||||||
|
spTiempoLiberacionHora.getValue();
|
||||||
|
spTiempoLiberacionMinuto.getValue();
|
||||||
|
spTiempoLiberacionInternetHora.getValue();
|
||||||
|
spTiempoLiberacionInternetMinuto.getValue();
|
||||||
|
spTiempoPrevioHora.getValue();
|
||||||
|
spTiempoPrevioMinuto.getValue();
|
||||||
|
spTiempoPrevioInternetHora.getValue();
|
||||||
|
spTiempoPrevioInternetMinuto.getValue();
|
||||||
|
|
||||||
|
NumAsientosCorrida.getValue();
|
||||||
|
|
||||||
|
|
||||||
|
if (fecInicio.getValue().after(fecFinal.getValue())) {
|
||||||
|
try {
|
||||||
|
Messagebox.show(Labels.getLabel("editarPeriodoVacacionalController.MSG.busquedaPeriodo"),
|
||||||
|
Labels.getLabel("editarConfiguracionReservacionController.window.title"), Messagebox.OK, Messagebox.INFORMATION);
|
||||||
|
} catch (InterruptedException ex) {
|
||||||
|
log.error(ex);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
try {
|
||||||
|
|
||||||
|
List<ReservacionCtrl> lsTraslapa = reservacionCtrlService.buscarFechaTraslapa(reservacionCtrl);
|
||||||
|
Boolean podeSalvarTraslapa = lsTraslapa.isEmpty() ? true : false;
|
||||||
|
if (lsTraslapa.size() == 1) {
|
||||||
|
//Somente edição
|
||||||
|
if (reservacionCtrl.getReservacionctrlId() != null) {
|
||||||
|
if (reservacionCtrl.getReservacionctrlId().equals(lsTraslapa.get(0).getReservacionctrlId())) {
|
||||||
|
podeSalvarTraslapa = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//Se não pode salvar pq translapa
|
||||||
|
if (!podeSalvarTraslapa) {
|
||||||
|
Messagebox.show(
|
||||||
|
Labels.getLabel("editarConfiguracionReservacionController.MSG.conflitoVigencias"),
|
||||||
|
Labels.getLabel("editarConfiguracionReservacionController.window.title"),
|
||||||
|
Messagebox.OK, Messagebox.EXCLAMATION);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (reservacionCategoriaList.getData().length == 0) {
|
||||||
|
Messagebox.show(
|
||||||
|
Labels.getLabel("editarConfiguracionReservacionController.MSG.necesitaCategoria"),
|
||||||
|
Labels.getLabel("editarConfiguracionReservacionController.window.title"),
|
||||||
|
Messagebox.OK, Messagebox.EXCLAMATION);
|
||||||
|
tabCategoria.setSelected(Boolean.TRUE);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (reservacionPuntoVentaList.getData().length == 0) {
|
||||||
|
Messagebox.show(
|
||||||
|
Labels.getLabel("editarConfiguracionReservacionController.MSG.necesitaPunto"),
|
||||||
|
Labels.getLabel("editarConfiguracionReservacionController.window.title"),
|
||||||
|
Messagebox.OK, Messagebox.EXCLAMATION);
|
||||||
|
tabPunto.setSelected(Boolean.TRUE);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (reservacionClaseList.getData().length == 0) {
|
||||||
|
Messagebox.show(
|
||||||
|
Labels.getLabel("editarConfiguracionReservacionController.MSG.necesitaClase"),
|
||||||
|
Labels.getLabel("editarConfiguracionReservacionController.window.title"),
|
||||||
|
Messagebox.OK, Messagebox.EXCLAMATION);
|
||||||
|
tabClase.setSelected(Boolean.TRUE);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (reservacionMercadoList.getData().length == 0) {
|
||||||
|
Messagebox.show(
|
||||||
|
Labels.getLabel("editarConfiguracionReservacionController.MSG.necesitaMercado"),
|
||||||
|
Labels.getLabel("editarConfiguracionReservacionController.window.title"),
|
||||||
|
Messagebox.OK, Messagebox.EXCLAMATION);
|
||||||
|
tabMercado.setSelected(Boolean.TRUE);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (reservacionMarcaList.getData().length == 0) {
|
||||||
|
Messagebox.show(
|
||||||
|
Labels.getLabel("editarConfiguracionReservacionController.MSG.necesitaMarca"),
|
||||||
|
Labels.getLabel("editarConfiguracionReservacionController.window.title"),
|
||||||
|
Messagebox.OK, Messagebox.EXCLAMATION);
|
||||||
|
tabMarca.setSelected(Boolean.TRUE);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
List<ReservacionCtrl> lsReservacion = reservacionCtrlService.buscar(reservacionCtrl);
|
||||||
|
|
||||||
|
boolean podeSalvar = false;
|
||||||
|
if (lsReservacion.isEmpty()) {
|
||||||
|
podeSalvar = true;
|
||||||
|
} else {
|
||||||
|
for (ReservacionCtrl rc : lsReservacion) {
|
||||||
|
if (rc.getReservacionctrlId().equals(reservacionCtrl.getReservacionctrlId())) {
|
||||||
|
podeSalvar = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (podeSalvar) {
|
||||||
|
reservacionCtrl.setActivo(true);
|
||||||
|
reservacionCtrl.setFecmodif(Calendar.getInstance().getTime());
|
||||||
|
reservacionCtrl.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
|
||||||
|
|
||||||
|
reservacionCtrl.setTiempoliberacion(spTiempoLiberacionHora.getValue(), spTiempoLiberacionMinuto.getValue());
|
||||||
|
reservacionCtrl.setTiempoliberacioninternet(spTiempoLiberacionInternetHora.getValue(), spTiempoLiberacionInternetMinuto.getValue());
|
||||||
|
reservacionCtrl.setTiempoprevio(spTiempoPrevioHora.getValue(), spTiempoPrevioMinuto.getValue());
|
||||||
|
reservacionCtrl.setTiempopreviointernet(spTiempoPrevioInternetHora.getValue(), spTiempoPrevioInternetMinuto.getValue());
|
||||||
|
|
||||||
|
if (reservacionCtrl.getReservacionctrlId() == null) {
|
||||||
|
reservacionCtrlService.suscribir(reservacionCtrl);
|
||||||
|
reservacionCtrlList.addItem(reservacionCtrl);
|
||||||
|
} else {
|
||||||
|
reservacionCtrlService.actualizacion(reservacionCtrl);
|
||||||
|
reservacionCtrlList.updateItem(reservacionCtrl);
|
||||||
|
}
|
||||||
|
|
||||||
|
Messagebox.show(
|
||||||
|
Labels.getLabel("editarConfiguracionReservacionController.MSG.suscribirOK"),
|
||||||
|
Labels.getLabel("editarConfiguracionReservacionController.window.title"),
|
||||||
|
Messagebox.OK, Messagebox.INFORMATION);
|
||||||
|
|
||||||
|
closeWindow();
|
||||||
|
} else {
|
||||||
|
Messagebox.show(
|
||||||
|
Labels.getLabel("MSG.Registro.Existe"),
|
||||||
|
Labels.getLabel("editarConfiguracionReservacionController.window.title"),
|
||||||
|
Messagebox.OK, Messagebox.EXCLAMATION);
|
||||||
|
}
|
||||||
|
} catch (Exception ex) {
|
||||||
|
log.error("Erro ao salvar Configuracion Reservacion " + ex);
|
||||||
|
Messagebox.show(
|
||||||
|
Labels.getLabel("MSG.Error"),
|
||||||
|
Labels.getLabel("editarConfiguracionReservacionController.window.title"),
|
||||||
|
Messagebox.OK, Messagebox.ERROR);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onClick$btnApagar(Event ev) {
|
||||||
|
try {
|
||||||
|
int resp = Messagebox.show(
|
||||||
|
Labels.getLabel("editarConfiguracionReservacionController.MSG.borrarPergunta"),
|
||||||
|
Labels.getLabel("editarConfiguracionReservacionController.window.title"),
|
||||||
|
Messagebox.YES | Messagebox.NO, Messagebox.QUESTION);
|
||||||
|
|
||||||
|
if (resp == Messagebox.YES) {
|
||||||
|
|
||||||
|
reservacionCtrlService.borrar(reservacionCtrl);
|
||||||
|
|
||||||
|
Messagebox.show(
|
||||||
|
Labels.getLabel("editarConfiguracionReservacionController.MSG.borrarOK"),
|
||||||
|
Labels.getLabel("editarConfiguracionReservacionController.window.title"),
|
||||||
|
Messagebox.OK, Messagebox.INFORMATION);
|
||||||
|
|
||||||
|
reservacionCtrlList.removeItem(reservacionCtrl);
|
||||||
|
|
||||||
|
closeWindow();
|
||||||
|
}
|
||||||
|
} catch (Exception ex) {
|
||||||
|
log.error(ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public ReservacionCtrl getReservacionCtrl() {
|
||||||
|
return reservacionCtrl;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setReservacionCtrl(ReservacionCtrl reservacionCtrl) {
|
||||||
|
this.reservacionCtrl = reservacionCtrl;
|
||||||
|
}
|
||||||
|
|
||||||
|
public MyListbox getReservacionCtrlList() {
|
||||||
|
return reservacionCtrlList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setReservacionCtrlList(MyListbox reservacionCtrlList) {
|
||||||
|
this.reservacionCtrlList = reservacionCtrlList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ReservacionCtrlService getReservacionCtrlService() {
|
||||||
|
return reservacionCtrlService;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setReservacionCtrlService(ReservacionCtrlService reservacionCtrlService) {
|
||||||
|
this.reservacionCtrlService = reservacionCtrlService;
|
||||||
|
}
|
||||||
|
|
||||||
|
public CategoriaService getCategoriaService() {
|
||||||
|
return categoriaService;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCategoriaService(CategoriaService categoriaService) {
|
||||||
|
this.categoriaService = categoriaService;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ClaseServicioService getClaseService() {
|
||||||
|
return claseService;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setClaseService(ClaseServicioService claseService) {
|
||||||
|
this.claseService = claseService;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<ClaseServicio> getLsClase() {
|
||||||
|
return lsClase;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLsClase(List<ClaseServicio> lsClase) {
|
||||||
|
this.lsClase = lsClase;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<Marca> getLsMarca() {
|
||||||
|
return lsMarca;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLsMarca(List<Marca> lsMarca) {
|
||||||
|
this.lsMarca = lsMarca;
|
||||||
|
}
|
||||||
|
|
||||||
|
public MarcaService getMarcaService() {
|
||||||
|
return marcaService;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMarcaService(MarcaService marcaService) {
|
||||||
|
this.marcaService = marcaService;
|
||||||
|
}
|
||||||
|
|
||||||
|
public PuntoVentaService getPuntoVentaService() {
|
||||||
|
return puntoVentaService;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPuntoVentaService(PuntoVentaService puntoVentaService) {
|
||||||
|
this.puntoVentaService = puntoVentaService;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<Categoria> getLsCategoria() {
|
||||||
|
return lsCategoria;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLsCategoria(List<Categoria> lsCategoria) {
|
||||||
|
this.lsCategoria = lsCategoria;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<ReservacionCategoria> getLsReservacionCategoria() {
|
||||||
|
return lsReservacionCategoria;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLsReservacionCategoria(List<ReservacionCategoria> lsReservacionCategoria) {
|
||||||
|
this.lsReservacionCategoria = lsReservacionCategoria;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<ReservacionClase> getLsReservacionClase() {
|
||||||
|
return lsReservacionClase;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLsReservacionClase(List<ReservacionClase> lsReservacionClase) {
|
||||||
|
this.lsReservacionClase = lsReservacionClase;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<ReservacionMarca> getLsReservacionMarca() {
|
||||||
|
return lsReservacionMarca;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLsReservacionMarca(List<ReservacionMarca> lsReservacionMarca) {
|
||||||
|
this.lsReservacionMarca = lsReservacionMarca;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<ReservacionMercado> getLsReservacionMercado() {
|
||||||
|
return lsReservacionMercado;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLsReservacionMercado(List<ReservacionMercado> lsReservacionMercado) {
|
||||||
|
this.lsReservacionMercado = lsReservacionMercado;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<ReservacionPuntoVenta> getLsReservacionPuntoVenta() {
|
||||||
|
return lsReservacionPuntoVenta;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLsReservacionPuntoVenta(List<ReservacionPuntoVenta> lsReservacionPuntoVenta) {
|
||||||
|
this.lsReservacionPuntoVenta = lsReservacionPuntoVenta;
|
||||||
|
}
|
||||||
|
|
||||||
|
public MyListbox getReservacionCategoriaList() {
|
||||||
|
return reservacionCategoriaList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setReservacionCategoriaList(MyListbox reservacionCategoriaList) {
|
||||||
|
this.reservacionCategoriaList = reservacionCategoriaList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public MyListbox getReservacionClaseList() {
|
||||||
|
return reservacionClaseList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setReservacionClaseList(MyListbox reservacionClaseList) {
|
||||||
|
this.reservacionClaseList = reservacionClaseList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public MyListbox getReservacionMarcaList() {
|
||||||
|
return reservacionMarcaList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setReservacionMarcaList(MyListbox reservacionMarcaList) {
|
||||||
|
this.reservacionMarcaList = reservacionMarcaList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public MyListbox getReservacionMercadoList() {
|
||||||
|
return reservacionMercadoList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setReservacionMercadoList(MyListbox reservacionMercadoList) {
|
||||||
|
this.reservacionMercadoList = reservacionMercadoList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public MyListbox getReservacionPuntoVentaList() {
|
||||||
|
return reservacionPuntoVentaList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setReservacionPuntoVentaList(MyListbox reservacionPuntoVentaList) {
|
||||||
|
this.reservacionPuntoVentaList = reservacionPuntoVentaList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Combobox getCmbCategoria() {
|
||||||
|
return cmbCategoria;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCmbCategoria(Combobox cmbCategoria) {
|
||||||
|
this.cmbCategoria = cmbCategoria;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Datebox getFecFinal() {
|
||||||
|
return fecFinal;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFecFinal(Datebox fecFinal) {
|
||||||
|
this.fecFinal = fecFinal;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Datebox getFecInicio() {
|
||||||
|
return fecInicio;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFecInicio(Datebox fecInicio) {
|
||||||
|
this.fecInicio = fecInicio;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Combobox getCmbClase() {
|
||||||
|
return cmbClase;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCmbClase(Combobox cmbClase) {
|
||||||
|
this.cmbClase = cmbClase;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Combobox getCmbMarca() {
|
||||||
|
return cmbMarca;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCmbMarca(Combobox cmbMarca) {
|
||||||
|
this.cmbMarca = cmbMarca;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Combobox getCmbParadaDestino() {
|
||||||
|
return cmbParadaDestino;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCmbParadaDestino(Combobox cmbParadaDestino) {
|
||||||
|
this.cmbParadaDestino = cmbParadaDestino;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Combobox getCmbParadaOrigem() {
|
||||||
|
return cmbParadaOrigem;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCmbParadaOrigem(Combobox cmbParadaOrigem) {
|
||||||
|
this.cmbParadaOrigem = cmbParadaOrigem;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Combobox getCmbPuntoVenta() {
|
||||||
|
return cmbPuntoVenta;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCmbPuntoVenta(Combobox cmbPuntoVenta) {
|
||||||
|
this.cmbPuntoVenta = cmbPuntoVenta;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ParadaService getParadaService() {
|
||||||
|
return paradaService;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setParadaService(ParadaService paradaService) {
|
||||||
|
this.paradaService = paradaService;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,484 @@
|
||||||
|
/*
|
||||||
|
* To change this template, choose Tools | Templates
|
||||||
|
* and open the template in the editor.
|
||||||
|
*/
|
||||||
|
package com.rjconsultores.ventaboletos.web.gui.controladores.configuracioneccomerciales;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Calendar;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.Comparator;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.apache.log4j.Logger;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.context.annotation.Scope;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.zkoss.util.resource.Labels;
|
||||||
|
import org.zkoss.zhtml.Messagebox;
|
||||||
|
import org.zkoss.zk.ui.Component;
|
||||||
|
import org.zkoss.zk.ui.Executions;
|
||||||
|
import org.zkoss.zk.ui.event.Event;
|
||||||
|
import org.zkoss.zk.ui.util.Clients;
|
||||||
|
import org.zkoss.zul.Button;
|
||||||
|
import org.zkoss.zul.Checkbox;
|
||||||
|
import org.zkoss.zul.Longbox;
|
||||||
|
import org.zkoss.zul.Radio;
|
||||||
|
import org.zkoss.zul.Textbox;
|
||||||
|
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.Convenio;
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.ConvenioDet;
|
||||||
|
import com.rjconsultores.ventaboletos.service.ConvenioDetService;
|
||||||
|
import com.rjconsultores.ventaboletos.service.ConvenioService;
|
||||||
|
import com.rjconsultores.ventaboletos.utilerias.TraslaparUtil;
|
||||||
|
import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.MyGenericForwardComposer;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.MyListbox;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.MyTextboxDecimal;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.render.RenderConvenioDet;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Administrador
|
||||||
|
*/
|
||||||
|
@Controller("editarConvenioController")
|
||||||
|
@Scope("prototype")
|
||||||
|
public class EditarConvenioController extends MyGenericForwardComposer {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ConvenioService convenioService;
|
||||||
|
private ConvenioDetService convenioDetService;
|
||||||
|
private Convenio convenio;
|
||||||
|
private List<ConvenioDet> lsConvenioDets;
|
||||||
|
private MyListbox convenioList;
|
||||||
|
private MyListbox convenioDetList;
|
||||||
|
private Textbox txtDescConvenio;
|
||||||
|
private MyTextboxDecimal txtPorcdescuento;
|
||||||
|
private Longbox txtNumfolioinicio;
|
||||||
|
private Longbox txtNumfoliofinal;
|
||||||
|
private Button btnApagar;
|
||||||
|
private Button btnAdicionarConvenioDet;
|
||||||
|
private Radio rdPrecioTotal;
|
||||||
|
private Radio rdPrecioDescuento;
|
||||||
|
private Radio rdDescuento;
|
||||||
|
private Checkbox chkValidaFolio;
|
||||||
|
private static Logger log = Logger.getLogger(EditarConvenioController.class);
|
||||||
|
|
||||||
|
public Button getBtnApagar() {
|
||||||
|
return btnApagar;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBtnApagar(Button btnApagar) {
|
||||||
|
this.btnApagar = btnApagar;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Convenio getConvenio() {
|
||||||
|
return convenio;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setConvenio(Convenio convenio) {
|
||||||
|
this.convenio = convenio;
|
||||||
|
}
|
||||||
|
|
||||||
|
public MyListbox getConvenioDetList() {
|
||||||
|
return convenioDetList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setConvenioDetList(MyListbox convenioDetList) {
|
||||||
|
this.convenioDetList = convenioDetList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public MyListbox getConvenioList() {
|
||||||
|
return convenioList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setConvenioList(MyListbox convenioList) {
|
||||||
|
this.convenioList = convenioList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<ConvenioDet> getLsConvenioDets() {
|
||||||
|
return lsConvenioDets;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLsConvenioDets(List<ConvenioDet> lsConvenioDets) {
|
||||||
|
this.lsConvenioDets = lsConvenioDets;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Textbox getTxtDescConvenio() {
|
||||||
|
return txtDescConvenio;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTxtDescConvenio(Textbox txtDescConvenio) {
|
||||||
|
this.txtDescConvenio = txtDescConvenio;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Longbox getTxtNumfoliofinal() {
|
||||||
|
return txtNumfoliofinal;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTxtNumfoliofinal(Longbox txtNumfoliofinal) {
|
||||||
|
this.txtNumfoliofinal = txtNumfoliofinal;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Longbox getTxtNumfolioinicio() {
|
||||||
|
return txtNumfolioinicio;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTxtNumfolioinicio(Longbox txtNumfolioinicio) {
|
||||||
|
this.txtNumfolioinicio = txtNumfolioinicio;
|
||||||
|
}
|
||||||
|
|
||||||
|
public MyTextboxDecimal getTxtPorcdescuento() {
|
||||||
|
return txtPorcdescuento;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTxtPorcdescuento(MyTextboxDecimal txtPorcdescuento) {
|
||||||
|
this.txtPorcdescuento = txtPorcdescuento;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Radio getRdDescuento() {
|
||||||
|
return rdDescuento;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRdDescuento(Radio rdDescuento) {
|
||||||
|
this.rdDescuento = rdDescuento;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Radio getRdPrecioDescuento() {
|
||||||
|
return rdPrecioDescuento;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRdPrecioDescuento(Radio rdPrecioDescuento) {
|
||||||
|
this.rdPrecioDescuento = rdPrecioDescuento;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Radio getRdPrecioTotal() {
|
||||||
|
return rdPrecioTotal;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRdPrecioTotal(Radio rdPrecioTotal) {
|
||||||
|
this.rdPrecioTotal = rdPrecioTotal;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Checkbox getChkValidaFolio() {
|
||||||
|
return chkValidaFolio;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setChkValidaFolio(Checkbox chkValidaFolio) {
|
||||||
|
this.chkValidaFolio = chkValidaFolio;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Button getBtnAdicionarConvenioDet() {
|
||||||
|
return btnAdicionarConvenioDet;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBtnAdicionarConvenioDet(Button btnAdicionarConvenioDet) {
|
||||||
|
this.btnAdicionarConvenioDet = btnAdicionarConvenioDet;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void doAfterCompose(Component comp) throws Exception {
|
||||||
|
super.doAfterCompose(comp);
|
||||||
|
|
||||||
|
convenio =
|
||||||
|
(Convenio) Executions.getCurrent().getArg().get("convenio");
|
||||||
|
convenioList =
|
||||||
|
(MyListbox) Executions.getCurrent().getArg().get("convenioList");
|
||||||
|
|
||||||
|
if (convenio.getConvenioId() == null) {
|
||||||
|
btnApagar.setVisible(Boolean.FALSE);
|
||||||
|
|
||||||
|
lsConvenioDets = new ArrayList<ConvenioDet>();
|
||||||
|
} else {
|
||||||
|
convenio = convenioService.obtenerID(convenio.getConvenioId());
|
||||||
|
lsConvenioDets = convenio.getConvenioDetList();
|
||||||
|
|
||||||
|
if (convenio.getImprimeprecio() != null) {
|
||||||
|
if (convenio.getImprimeprecio().equals(Convenio.IMPRIME_DESCONTO)) {
|
||||||
|
rdDescuento.setChecked(Boolean.TRUE);
|
||||||
|
} else if (convenio.getImprimeprecio().equals(Convenio.IMPRIME_PRECO_MENOS_DESCONTO)) {
|
||||||
|
rdPrecioDescuento.setChecked(Boolean.TRUE);
|
||||||
|
} else if (convenio.getImprimeprecio().equals(Convenio.IMPRIME_PRECO_TOTAL)) {
|
||||||
|
rdPrecioTotal.setChecked(Boolean.TRUE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
chkValidaFolio.setChecked(convenio.getValidafolio());
|
||||||
|
chkValidaFolio.setDisabled(Boolean.TRUE);
|
||||||
|
|
||||||
|
onClick$chkValidaFolio(null);
|
||||||
|
|
||||||
|
// if (!chkValidaFolio.isChecked() && lsConvenioDets.size() > 0) {
|
||||||
|
// btnAdicionarConvenioDet.setDisabled(Boolean.TRUE);
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
|
||||||
|
convenioDetList.setItemRenderer(new RenderConvenioDet());
|
||||||
|
convenioDetList.setData(lsConvenioDets);
|
||||||
|
|
||||||
|
txtDescConvenio.focus();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onClick$chkValidaFolio(Event ev) {
|
||||||
|
if (chkValidaFolio.isChecked()) {
|
||||||
|
txtNumfolioinicio.setDisabled(Boolean.FALSE);
|
||||||
|
txtNumfoliofinal.setDisabled(Boolean.FALSE);
|
||||||
|
} else {
|
||||||
|
txtNumfolioinicio.setValue(null);
|
||||||
|
txtNumfoliofinal.setValue(null);
|
||||||
|
|
||||||
|
txtNumfolioinicio.setDisabled(Boolean.TRUE);
|
||||||
|
txtNumfoliofinal.setDisabled(Boolean.TRUE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onClick$btnSalvar(Event ev) {
|
||||||
|
txtDescConvenio.getValue();
|
||||||
|
|
||||||
|
try {
|
||||||
|
|
||||||
|
if (lsConvenioDets.isEmpty()) {
|
||||||
|
Messagebox.show(
|
||||||
|
Labels.getLabel("editarConvenioController.MSG.necessaitaPorcentaje.value"),
|
||||||
|
Labels.getLabel("editarConvenioController.window.title"),
|
||||||
|
Messagebox.OK, Messagebox.EXCLAMATION);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
convenio.setActivo(true);
|
||||||
|
convenio.setFecmodif(Calendar.getInstance().getTime());
|
||||||
|
convenio.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
|
||||||
|
convenio.setConvenioDetList(lsConvenioDets);
|
||||||
|
convenio.setValidafolio(chkValidaFolio.isChecked());
|
||||||
|
|
||||||
|
if (rdDescuento.isChecked()) {
|
||||||
|
convenio.setImprimeprecio(Convenio.IMPRIME_DESCONTO);
|
||||||
|
} else if (rdPrecioDescuento.isChecked()) {
|
||||||
|
convenio.setImprimeprecio(Convenio.IMPRIME_PRECO_MENOS_DESCONTO);
|
||||||
|
} else if (rdPrecioTotal.isChecked()) {
|
||||||
|
convenio.setImprimeprecio(Convenio.IMPRIME_PRECO_TOTAL);
|
||||||
|
} else {
|
||||||
|
Messagebox.show(
|
||||||
|
Labels.getLabel("editarConvenioController.ImpressionSeleccione.value"),
|
||||||
|
Labels.getLabel("editarConvenioController.window.title"),
|
||||||
|
Messagebox.OK, Messagebox.EXCLAMATION);
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
List<Convenio> lsConvenioDet =
|
||||||
|
convenioService.buscar(convenio.getDescconvenio(),
|
||||||
|
convenio.getCveconvenio());
|
||||||
|
|
||||||
|
boolean podeSalvar = false;
|
||||||
|
if (lsConvenioDet.isEmpty()) {
|
||||||
|
podeSalvar = true;
|
||||||
|
} else {
|
||||||
|
if (convenio.getConvenioId() != null) {
|
||||||
|
for (Convenio c : lsConvenioDet) {
|
||||||
|
if (c.getConvenioId().equals(convenio.getConvenioId())) {
|
||||||
|
podeSalvar = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (podeSalvar) {
|
||||||
|
if (convenio.getConvenioId() == null) {
|
||||||
|
convenioService.suscribir(convenio);
|
||||||
|
convenioList.addItem(convenio);
|
||||||
|
} else {
|
||||||
|
convenioService.actualizacion(convenio);
|
||||||
|
convenioList.updateItem(convenio);
|
||||||
|
}
|
||||||
|
Messagebox.show(
|
||||||
|
Labels.getLabel("editarConvenioController.MSG.suscribirOK"),
|
||||||
|
Labels.getLabel("editarConvenioController.window.title"),
|
||||||
|
Messagebox.OK, Messagebox.INFORMATION);
|
||||||
|
|
||||||
|
closeWindow();
|
||||||
|
} else {
|
||||||
|
Messagebox.show(
|
||||||
|
Labels.getLabel("MSG.Registro.Existe"),
|
||||||
|
Labels.getLabel("editarConvenioController.window.title"),
|
||||||
|
Messagebox.OK, Messagebox.EXCLAMATION);
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch (Exception ex) {
|
||||||
|
log.error(ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onClick$btnApagar(Event ev) {
|
||||||
|
try {
|
||||||
|
int resp = Messagebox.show(
|
||||||
|
Labels.getLabel("editarConvenioController.MSG.borrarPergunta"),
|
||||||
|
Labels.getLabel("editarConvenioController.window.title"),
|
||||||
|
Messagebox.YES | Messagebox.NO, Messagebox.QUESTION);
|
||||||
|
|
||||||
|
if (resp == Messagebox.YES) {
|
||||||
|
|
||||||
|
convenioService.borrar(convenio);
|
||||||
|
|
||||||
|
Messagebox.show(
|
||||||
|
Labels.getLabel("editarConvenioController.MSG.borrarOK"),
|
||||||
|
Labels.getLabel("editarConvenioController.window.title"),
|
||||||
|
Messagebox.OK, Messagebox.INFORMATION);
|
||||||
|
|
||||||
|
convenioList.removeItem(convenio);
|
||||||
|
|
||||||
|
closeWindow();
|
||||||
|
}
|
||||||
|
} catch (Exception ex) {
|
||||||
|
log.error(ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
* 0 - Esta ok
|
||||||
|
* 1 - Registro duplicado
|
||||||
|
* 2 - Registro traslapado
|
||||||
|
* @throws InterruptedException
|
||||||
|
*/
|
||||||
|
private int registroDuplicado(Long folioIni, Long folioFin) throws InterruptedException {
|
||||||
|
Collections.sort(lsConvenioDets, new Comparator<ConvenioDet>() {
|
||||||
|
|
||||||
|
public int compare(ConvenioDet o1, ConvenioDet o2) {
|
||||||
|
return o1.getNumfolioinicial().compareTo(o2.getNumfoliofinal());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
for (ConvenioDet pv : lsConvenioDets) {
|
||||||
|
if (!pv.getActivo()) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (TraslaparUtil.intersectNum(pv.getNumfolioinicial().longValue(), pv.getNumfoliofinal().longValue(),
|
||||||
|
folioIni, folioFin)) {
|
||||||
|
return 2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onClick$btnAdicionarConvenioDet(Event ev) {
|
||||||
|
txtPorcdescuento.setConstraint("no empty");
|
||||||
|
txtPorcdescuento.getValue();
|
||||||
|
|
||||||
|
if (txtPorcdescuento.getValueDecimal().compareTo(new BigDecimal("100")) > 0) {
|
||||||
|
Clients.wrongValue(txtPorcdescuento, Labels.getLabel("MSG.Porcentaje"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (chkValidaFolio.isChecked()) {
|
||||||
|
txtNumfolioinicio.setConstraint("no empty, no negative, no zero");
|
||||||
|
txtNumfoliofinal.setConstraint("no empty, no negative, no zero");
|
||||||
|
|
||||||
|
txtNumfolioinicio.getValue();
|
||||||
|
txtNumfoliofinal.getValue();
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
BigDecimal porcdescuento = txtPorcdescuento.getValueDecimal();
|
||||||
|
Long numfolioinicio = txtNumfolioinicio.getValue();
|
||||||
|
Long numfoliofinal = txtNumfoliofinal.getValue();
|
||||||
|
|
||||||
|
if (chkValidaFolio.isChecked() && (numfolioinicio > numfoliofinal)) {
|
||||||
|
Messagebox.show(
|
||||||
|
Labels.getLabel("MSG.Folios"),
|
||||||
|
Labels.getLabel("editarConvenioController.window.title"),
|
||||||
|
Messagebox.OK, Messagebox.EXCLAMATION);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Boolean achou = Boolean.FALSE;
|
||||||
|
for (ConvenioDet cds : convenio.getConvenioDetList()) {
|
||||||
|
if (cds.getNumfoliofinal() != null
|
||||||
|
&& cds.getNumfolioinicial() != null) {
|
||||||
|
if (cds.getNumfoliofinal().equals(numfoliofinal)
|
||||||
|
&& cds.getNumfolioinicial().equals(numfolioinicio)
|
||||||
|
&& cds.getPorcdescuento().equals(porcdescuento)) {
|
||||||
|
achou = Boolean.TRUE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!achou) {
|
||||||
|
ConvenioDet cd = new ConvenioDet();
|
||||||
|
cd.setActivo(Boolean.TRUE);
|
||||||
|
cd.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
|
||||||
|
cd.setFecmodif(Calendar.getInstance().getTime());
|
||||||
|
cd.setPorcdescuento(porcdescuento);
|
||||||
|
cd.setNumfolioinicial(numfolioinicio);
|
||||||
|
cd.setNumfoliofinal(numfoliofinal);
|
||||||
|
|
||||||
|
if (chkValidaFolio.isChecked()) {
|
||||||
|
int resp = registroDuplicado(numfolioinicio, numfoliofinal);
|
||||||
|
|
||||||
|
if (resp != 0) {
|
||||||
|
Messagebox.show(
|
||||||
|
(resp == 1) ? Labels.getLabel("MSG.Registro.Existe") : Labels.getLabel("editarConvenioController.MSG.registroTraslapado"),
|
||||||
|
Labels.getLabel("editarConvenioController.window.title"),
|
||||||
|
Messagebox.OK, Messagebox.EXCLAMATION);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (lsConvenioDets.size() >= 1) {
|
||||||
|
Messagebox.show(
|
||||||
|
Labels.getLabel("editarConvenioController.MSG.pocentaje"),
|
||||||
|
Labels.getLabel("editarConvenioController.window.title"),
|
||||||
|
Messagebox.OK, Messagebox.EXCLAMATION);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
lsConvenioDets.add(cd);
|
||||||
|
convenioDetList.setData(lsConvenioDets);
|
||||||
|
convenio.setConvenioDetList(lsConvenioDets);
|
||||||
|
|
||||||
|
chkValidaFolio.setDisabled(Boolean.TRUE);
|
||||||
|
|
||||||
|
txtPorcdescuento.setConstraint("");
|
||||||
|
txtNumfolioinicio.setConstraint("");
|
||||||
|
txtNumfoliofinal.setConstraint("");
|
||||||
|
|
||||||
|
txtPorcdescuento.setText("");
|
||||||
|
txtNumfolioinicio.setValue(null);
|
||||||
|
txtNumfoliofinal.setValue(null);
|
||||||
|
} else {
|
||||||
|
Messagebox.show(
|
||||||
|
Labels.getLabel("MSG.Registro.Existe"),
|
||||||
|
Labels.getLabel("editarConvenioController.window.title"),
|
||||||
|
Messagebox.OK, Messagebox.EXCLAMATION);
|
||||||
|
}
|
||||||
|
} catch (Exception ex) {
|
||||||
|
log.error(ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onClick$btnRemoverConvenioDet(Event ev) {
|
||||||
|
ConvenioDet cd = (ConvenioDet) convenioDetList.getSelected();
|
||||||
|
if (cd != null) {
|
||||||
|
cd.setActivo(Boolean.FALSE);
|
||||||
|
cd.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
|
||||||
|
cd.setFecmodif(Calendar.getInstance().getTime());
|
||||||
|
|
||||||
|
if (cd.getConveniodetId() != null) {
|
||||||
|
convenioDetService.borrar(cd);
|
||||||
|
}
|
||||||
|
|
||||||
|
lsConvenioDets.remove(cd);
|
||||||
|
|
||||||
|
if (lsConvenioDets.isEmpty()) {
|
||||||
|
btnAdicionarConvenioDet.setDisabled(Boolean.FALSE);
|
||||||
|
chkValidaFolio.setDisabled(Boolean.FALSE);
|
||||||
|
}
|
||||||
|
|
||||||
|
convenioDetList.setData(lsConvenioDets);
|
||||||
|
convenio.setConvenioDetList(lsConvenioDets);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,187 @@
|
||||||
|
/*
|
||||||
|
* To change this template, choose Tools | Templates
|
||||||
|
* and open the template in the editor.
|
||||||
|
*/
|
||||||
|
package com.rjconsultores.ventaboletos.web.gui.controladores.configuracioneccomerciales;
|
||||||
|
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.MotivoCancelacion;
|
||||||
|
import com.rjconsultores.ventaboletos.service.MotivoCancelacionService;
|
||||||
|
import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.MyGenericForwardComposer;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.MyListbox;
|
||||||
|
import org.apache.log4j.Logger;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.context.annotation.Scope;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import java.util.Calendar;
|
||||||
|
import java.util.List;
|
||||||
|
import org.zkoss.util.resource.Labels;
|
||||||
|
import org.zkoss.zk.ui.Component;
|
||||||
|
import org.zkoss.zk.ui.Executions;
|
||||||
|
import org.zkoss.zk.ui.event.Event;
|
||||||
|
import org.zkoss.zul.Button;
|
||||||
|
import org.zkoss.zul.Combobox;
|
||||||
|
import org.zkoss.zul.Messagebox;
|
||||||
|
import org.zkoss.zul.Textbox;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Rafius
|
||||||
|
*/
|
||||||
|
@Controller("editarMotivoCancelacionController")
|
||||||
|
@Scope("prototype")
|
||||||
|
public class EditarMotivoCancelacionController extends MyGenericForwardComposer {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private MotivoCancelacionService motivoCancelacionService;
|
||||||
|
private MotivoCancelacion motivoCancelacion;
|
||||||
|
private MyListbox motivoCancelacionList;
|
||||||
|
private static Logger log = Logger.getLogger(EditarMotivoCancelacionController.class);
|
||||||
|
private Textbox txtNome;
|
||||||
|
private Button btnApagar;
|
||||||
|
private Button btnSalvar;
|
||||||
|
private Combobox cmbTipoMotivo;
|
||||||
|
|
||||||
|
public Button getBtnApagar() {
|
||||||
|
return btnApagar;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBtnApagar(Button btnApagar) {
|
||||||
|
this.btnApagar = btnApagar;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Textbox getTxtNome() {
|
||||||
|
return txtNome;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTxtNome(Textbox txtNome) {
|
||||||
|
this.txtNome = txtNome;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void doAfterCompose(Component comp) throws Exception {
|
||||||
|
super.doAfterCompose(comp);
|
||||||
|
|
||||||
|
motivoCancelacion = (MotivoCancelacion) Executions.getCurrent().getArg().get("motivoCancelacion");
|
||||||
|
motivoCancelacionList = (MyListbox) Executions.getCurrent().getArg().get("motivoCancelacionList");
|
||||||
|
|
||||||
|
if (motivoCancelacion.getMotivocancelacionId() == null) {
|
||||||
|
btnApagar.setVisible(Boolean.FALSE);
|
||||||
|
} else {
|
||||||
|
if (motivoCancelacion.getMotivocancelacionId() <= 18) {
|
||||||
|
btnApagar.setVisible(false);
|
||||||
|
btnSalvar.setVisible(Boolean.FALSE);
|
||||||
|
txtNome.setDisabled(true);
|
||||||
|
|
||||||
|
Messagebox.show(
|
||||||
|
Labels.getLabel("MSG.noEditabled"),
|
||||||
|
Labels.getLabel("editarMotivoCancelacionController.window.title"),
|
||||||
|
Messagebox.OK, Messagebox.INFORMATION);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
txtNome.focus();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onClick$btnSalvar(Event ev) throws InterruptedException {
|
||||||
|
txtNome.getValue();
|
||||||
|
cmbTipoMotivo.getValue();
|
||||||
|
try {
|
||||||
|
motivoCancelacion.setActivo(true);
|
||||||
|
motivoCancelacion.setFecmodif(Calendar.getInstance().getTime());
|
||||||
|
motivoCancelacion.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
|
||||||
|
if (motivoCancelacion.getTipomotivo() == null) {
|
||||||
|
Messagebox.show(
|
||||||
|
Labels.getLabel("editarMotivoCancelacionController.MSG.tipo"),
|
||||||
|
Labels.getLabel("editarMotivoCancelacionController.window.title"),
|
||||||
|
Messagebox.OK, Messagebox.EXCLAMATION);
|
||||||
|
} else {
|
||||||
|
if (motivoCancelacion.getMotivocancelacionId() == null) {
|
||||||
|
List<MotivoCancelacion> lsMotivoCancelacion =
|
||||||
|
motivoCancelacionService.buscar(motivoCancelacion.getDescmotivo(),
|
||||||
|
motivoCancelacion.getTipomotivo());
|
||||||
|
|
||||||
|
if (lsMotivoCancelacion.isEmpty()) {
|
||||||
|
motivoCancelacionService.suscribir(motivoCancelacion);
|
||||||
|
motivoCancelacionList.addItem(motivoCancelacion);
|
||||||
|
|
||||||
|
Messagebox.show(
|
||||||
|
Labels.getLabel("editarMotivoCancelacionController.MSG.suscribirOK"),
|
||||||
|
Labels.getLabel("editarMotivoCancelacionController.window.title"),
|
||||||
|
Messagebox.OK, Messagebox.INFORMATION);
|
||||||
|
} else {
|
||||||
|
Messagebox.show(
|
||||||
|
Labels.getLabel("MSG.Registro.Existe"),
|
||||||
|
Labels.getLabel("editarMotivoCancelacionController.window.title"),
|
||||||
|
Messagebox.OK, Messagebox.EXCLAMATION);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
motivoCancelacionService.actualizacion(motivoCancelacion);
|
||||||
|
motivoCancelacionList.updateItem(motivoCancelacion);
|
||||||
|
|
||||||
|
Messagebox.show(
|
||||||
|
Labels.getLabel("editarMotivoCancelacionController.MSG.suscribirOK"),
|
||||||
|
Labels.getLabel("editarMotivoCancelacionController.window.title"),
|
||||||
|
Messagebox.OK, Messagebox.INFORMATION);
|
||||||
|
}
|
||||||
|
|
||||||
|
closeWindow();
|
||||||
|
}
|
||||||
|
} catch (Exception ex) {
|
||||||
|
log.error("editarMotivoCancelacionController: " + ex);
|
||||||
|
Messagebox.show(
|
||||||
|
Labels.getLabel("MSG.Error"),
|
||||||
|
Labels.getLabel("editarMotivoCancelacionController.window.title"),
|
||||||
|
Messagebox.OK, Messagebox.ERROR);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onClick$btnApagar(Event ev) {
|
||||||
|
try {
|
||||||
|
int resp = Messagebox.show(
|
||||||
|
Labels.getLabel("editarMotivoCancelacionController.MSG.borrarPergunta"),
|
||||||
|
Labels.getLabel("editarMotivoCancelacionController.window.title"),
|
||||||
|
Messagebox.YES | Messagebox.NO, Messagebox.QUESTION);
|
||||||
|
|
||||||
|
if (resp == Messagebox.YES) {
|
||||||
|
|
||||||
|
motivoCancelacionService.borrar(motivoCancelacion);
|
||||||
|
|
||||||
|
Messagebox.show(
|
||||||
|
Labels.getLabel("editarMotivoCancelacionController.MSG.borrarOK"),
|
||||||
|
Labels.getLabel("editarMotivoCancelacionController.window.title"),
|
||||||
|
Messagebox.OK, Messagebox.INFORMATION);
|
||||||
|
|
||||||
|
motivoCancelacionList.removeItem(motivoCancelacion);
|
||||||
|
|
||||||
|
closeWindow();
|
||||||
|
}
|
||||||
|
} catch (Exception ex) {
|
||||||
|
log.error(ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public MotivoCancelacion getMotivoCancelacion() {
|
||||||
|
return motivoCancelacion;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMotivoCancelacion(MotivoCancelacion motivoCancelacion) {
|
||||||
|
this.motivoCancelacion = motivoCancelacion;
|
||||||
|
}
|
||||||
|
|
||||||
|
public MyListbox getMotivoCancelacionList() {
|
||||||
|
return motivoCancelacionList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMotivoCancelacionList(MyListbox motivoCancelacionList) {
|
||||||
|
this.motivoCancelacionList = motivoCancelacionList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public MotivoCancelacionService getMotivoCancelacionService() {
|
||||||
|
return motivoCancelacionService;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMotivoCancelacionService(MotivoCancelacionService motivoCancelacionService) {
|
||||||
|
this.motivoCancelacionService = motivoCancelacionService;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,179 @@
|
||||||
|
/*
|
||||||
|
* To change this template, choose Tools | Templates
|
||||||
|
* and open the template in the editor.
|
||||||
|
*/
|
||||||
|
package com.rjconsultores.ventaboletos.web.gui.controladores.configuracioneccomerciales;
|
||||||
|
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.MotivoReimpresion;
|
||||||
|
import com.rjconsultores.ventaboletos.service.MotivoReimpresionService;
|
||||||
|
import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado;
|
||||||
|
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.MyGenericForwardComposer;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.MyListbox;
|
||||||
|
import org.apache.log4j.Logger;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.context.annotation.Scope;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import java.util.Calendar;
|
||||||
|
import java.util.List;
|
||||||
|
import org.zkoss.util.resource.Labels;
|
||||||
|
import org.zkoss.zk.ui.Component;
|
||||||
|
import org.zkoss.zk.ui.Executions;
|
||||||
|
import org.zkoss.zk.ui.event.Event;
|
||||||
|
import org.zkoss.zul.Button;
|
||||||
|
import org.zkoss.zul.Messagebox;
|
||||||
|
import org.zkoss.zul.Textbox;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Rafius
|
||||||
|
*/
|
||||||
|
@Controller("editarMotivoReimpresionController")
|
||||||
|
@Scope("prototype")
|
||||||
|
public class EditarMotivoReimpresionController extends MyGenericForwardComposer {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private MotivoReimpresionService motivoReimpresionService;
|
||||||
|
private MotivoReimpresion motivoReimpresion;
|
||||||
|
private MyListbox motivoReimpresionList;
|
||||||
|
private static Logger log = Logger.getLogger(EditarMotivoReimpresionController.class);
|
||||||
|
private Textbox txtNome;
|
||||||
|
private Button btnApagar;
|
||||||
|
private Button btnSalvar;
|
||||||
|
|
||||||
|
public Button getBtnApagar() {
|
||||||
|
return btnApagar;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBtnApagar(Button btnApagar) {
|
||||||
|
this.btnApagar = btnApagar;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Textbox getTxtNome() {
|
||||||
|
return txtNome;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTxtNome(Textbox txtNome) {
|
||||||
|
this.txtNome = txtNome;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void doAfterCompose(Component comp) throws Exception {
|
||||||
|
super.doAfterCompose(comp);
|
||||||
|
|
||||||
|
motivoReimpresion = (MotivoReimpresion) Executions.getCurrent().getArg().get("motivoReimpresion");
|
||||||
|
motivoReimpresionList = (MyListbox) Executions.getCurrent().getArg().get("motivoReimpresionList");
|
||||||
|
|
||||||
|
if (motivoReimpresion.getMotivoreimpresionId() == null) {
|
||||||
|
btnApagar.setVisible(Boolean.FALSE);
|
||||||
|
} else {
|
||||||
|
if (motivoReimpresion.getMotivoreimpresionId() < 2) {
|
||||||
|
btnApagar.setVisible(Boolean.FALSE);
|
||||||
|
btnSalvar.setVisible(Boolean.FALSE);
|
||||||
|
txtNome.setDisabled(Boolean.TRUE);
|
||||||
|
|
||||||
|
Messagebox.show(
|
||||||
|
Labels.getLabel("MSG.noEditabled"),
|
||||||
|
Labels.getLabel("editarMotivoReimpresionController.window.title"),
|
||||||
|
Messagebox.OK, Messagebox.INFORMATION);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
txtNome.focus();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onClick$btnSalvar(Event ev) throws InterruptedException {
|
||||||
|
txtNome.getValue();
|
||||||
|
|
||||||
|
try {
|
||||||
|
motivoReimpresion.setActivo(true);
|
||||||
|
motivoReimpresion.setFecmodif(Calendar.getInstance().getTime());
|
||||||
|
motivoReimpresion.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
|
||||||
|
|
||||||
|
if (motivoReimpresion.getMotivoreimpresionId() == null) {
|
||||||
|
List<MotivoReimpresion> lsMotivoReimpresion =
|
||||||
|
motivoReimpresionService.buscar(motivoReimpresion.getDescmotivo());
|
||||||
|
|
||||||
|
if (lsMotivoReimpresion.isEmpty()) {
|
||||||
|
motivoReimpresionService.suscribir(motivoReimpresion);
|
||||||
|
motivoReimpresionList.addItem(motivoReimpresion);
|
||||||
|
|
||||||
|
Messagebox.show(
|
||||||
|
Labels.getLabel("editarMotivoReimpresionController.MSG.suscribirOK"),
|
||||||
|
Labels.getLabel("editarMotivoReimpresionController.window.title"),
|
||||||
|
Messagebox.OK, Messagebox.INFORMATION);
|
||||||
|
} else {
|
||||||
|
Messagebox.show(
|
||||||
|
Labels.getLabel("MSG.Registro.Existe"),
|
||||||
|
Labels.getLabel("editarMotivoReimpresionController.window.title"),
|
||||||
|
Messagebox.OK, Messagebox.EXCLAMATION);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
motivoReimpresionService.actualizacion(motivoReimpresion);
|
||||||
|
motivoReimpresionList.updateItem(motivoReimpresion);
|
||||||
|
|
||||||
|
Messagebox.show(
|
||||||
|
Labels.getLabel("editarMotivoReimpresionController.MSG.suscribirOK"),
|
||||||
|
Labels.getLabel("editarMotivoReimpresionController.window.title"),
|
||||||
|
Messagebox.OK, Messagebox.INFORMATION);
|
||||||
|
}
|
||||||
|
|
||||||
|
closeWindow();
|
||||||
|
} catch (Exception ex) {
|
||||||
|
log.error("editarMotivoReimpresionController: " + ex);
|
||||||
|
Messagebox.show(
|
||||||
|
Labels.getLabel("MSG.Error"),
|
||||||
|
Labels.getLabel("editarMotivoReimpresionController.window.title"),
|
||||||
|
Messagebox.OK, Messagebox.ERROR);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onClick$btnApagar(Event ev) {
|
||||||
|
try {
|
||||||
|
int resp = Messagebox.show(
|
||||||
|
Labels.getLabel("editarMotivoReimpresionController.MSG.borrarPergunta"),
|
||||||
|
Labels.getLabel("editarMotivoReimpresionController.window.title"),
|
||||||
|
Messagebox.YES | Messagebox.NO, Messagebox.QUESTION);
|
||||||
|
|
||||||
|
if (resp == Messagebox.YES) {
|
||||||
|
|
||||||
|
motivoReimpresionService.borrar(motivoReimpresion);
|
||||||
|
|
||||||
|
Messagebox.show(
|
||||||
|
Labels.getLabel("editarMotivoReimpresionController.MSG.borrarOK"),
|
||||||
|
Labels.getLabel("editarMotivoReimpresionController.window.title"),
|
||||||
|
Messagebox.OK, Messagebox.INFORMATION);
|
||||||
|
|
||||||
|
motivoReimpresionList.removeItem(motivoReimpresion);
|
||||||
|
|
||||||
|
closeWindow();
|
||||||
|
}
|
||||||
|
} catch (Exception ex) {
|
||||||
|
log.error(ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public MotivoReimpresion getMotivoReimpresion() {
|
||||||
|
return motivoReimpresion;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMotivoReimpresion(MotivoReimpresion motivoReimpresion) {
|
||||||
|
this.motivoReimpresion = motivoReimpresion;
|
||||||
|
}
|
||||||
|
|
||||||
|
public MyListbox getMotivoReimpresionList() {
|
||||||
|
return motivoReimpresionList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMotivoReimpresionList(MyListbox motivoReimpresionList) {
|
||||||
|
this.motivoReimpresionList = motivoReimpresionList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public MotivoReimpresionService getMotivoReimpresionService() {
|
||||||
|
return motivoReimpresionService;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMotivoReimpresionService(MotivoReimpresionService motivoReimpresionService) {
|
||||||
|
this.motivoReimpresionService = motivoReimpresionService;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,203 @@
|
||||||
|
/*
|
||||||
|
* To change this template, choose Tools | Templates
|
||||||
|
* and open the template in the editor.
|
||||||
|
*/
|
||||||
|
package com.rjconsultores.ventaboletos.web.gui.controladores.configuracioneccomerciales;
|
||||||
|
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.PeriodoVacacional;
|
||||||
|
import com.rjconsultores.ventaboletos.service.PeriodoVacacionalService;
|
||||||
|
import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.MyGenericForwardComposer;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.MyListbox;
|
||||||
|
import org.apache.log4j.Logger;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.context.annotation.Scope;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import java.util.Calendar;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
import org.zkoss.util.resource.Labels;
|
||||||
|
import org.zkoss.zk.ui.Component;
|
||||||
|
import org.zkoss.zk.ui.Executions;
|
||||||
|
import org.zkoss.zk.ui.event.Event;
|
||||||
|
import org.zkoss.zul.Button;
|
||||||
|
import org.zkoss.zul.Datebox;
|
||||||
|
import org.zkoss.zul.Messagebox;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Rafius
|
||||||
|
*/
|
||||||
|
@Controller("editarPeriodoVacacionalController")
|
||||||
|
@Scope("prototype")
|
||||||
|
public class EditarPeriodoVacacionalController extends MyGenericForwardComposer {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private PeriodoVacacionalService periodoVacacionalService;
|
||||||
|
private PeriodoVacacional periodoVacacional;
|
||||||
|
private MyListbox periodoVacacionalList;
|
||||||
|
private static Logger log = Logger.getLogger(EditarPeriodoVacacionalController.class);
|
||||||
|
private Datebox fecInicio;
|
||||||
|
private Datebox fecFinal;
|
||||||
|
private Button btnApagar;
|
||||||
|
|
||||||
|
public Button getBtnApagar() {
|
||||||
|
return btnApagar;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBtnApagar(Button btnApagar) {
|
||||||
|
this.btnApagar = btnApagar;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Datebox getFecFinal() {
|
||||||
|
return fecFinal;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFecFinal(Datebox fecFinal) {
|
||||||
|
this.fecFinal = fecFinal;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Datebox getFecInicio() {
|
||||||
|
return fecInicio;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFecInicio(Datebox fecInicio) {
|
||||||
|
this.fecInicio = fecInicio;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void doAfterCompose(Component comp) throws Exception {
|
||||||
|
super.doAfterCompose(comp);
|
||||||
|
|
||||||
|
periodoVacacional = (PeriodoVacacional) Executions.getCurrent().getArg().get("periodoVacacional");
|
||||||
|
periodoVacacionalList = (MyListbox) Executions.getCurrent().getArg().get("periodoVacacionalList");
|
||||||
|
|
||||||
|
if (periodoVacacional.getPeriodovacacionalId() == null) {
|
||||||
|
btnApagar.setVisible(Boolean.FALSE);
|
||||||
|
}
|
||||||
|
|
||||||
|
fecInicio.focus();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onClick$btnSalvar(Event ev) throws InterruptedException {
|
||||||
|
Date dataInicio = fecInicio.getValue();
|
||||||
|
Date dataFim = fecFinal.getValue();
|
||||||
|
|
||||||
|
if (fecInicio.getValue().after(fecFinal.getValue())) {
|
||||||
|
try {
|
||||||
|
Messagebox.show(
|
||||||
|
Labels.getLabel("editarPeriodoVacacionalController.MSG.busquedaPeriodo"),
|
||||||
|
Labels.getLabel("editarPeriodoVacacionalController.window.title"),
|
||||||
|
Messagebox.OK, Messagebox.INFORMATION);
|
||||||
|
} catch (InterruptedException ex) {
|
||||||
|
log.error(ex);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
try {
|
||||||
|
List<PeriodoVacacional> lsPeriodoVacacional =
|
||||||
|
periodoVacacionalService.buscar(dataInicio, dataFim);
|
||||||
|
|
||||||
|
List<PeriodoVacacional> lsTraslapa = periodoVacacionalService.buscarFechaTraslapa(periodoVacacional);
|
||||||
|
Boolean podeSalvarTraslapa = lsTraslapa.isEmpty() ? true : false;
|
||||||
|
if (lsTraslapa.size() == 1) {
|
||||||
|
//Somente edição
|
||||||
|
if (periodoVacacional.getPeriodovacacionalId() != null) {
|
||||||
|
if (periodoVacacional.getPeriodovacacionalId().equals(lsTraslapa.get(0).getPeriodovacacionalId())) {
|
||||||
|
podeSalvarTraslapa = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//Se não pode salvar pq translapa
|
||||||
|
if (!podeSalvarTraslapa) {
|
||||||
|
Messagebox.show(
|
||||||
|
Labels.getLabel("editarPeriodoVacacionalController.MSG.conflitoVigencias"),
|
||||||
|
Labels.getLabel("editarPeriodoVacacionalController.window.title"),
|
||||||
|
Messagebox.OK, Messagebox.EXCLAMATION);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (lsPeriodoVacacional.isEmpty()) {
|
||||||
|
periodoVacacional.setActivo(Boolean.TRUE);
|
||||||
|
periodoVacacional.setFecmodif(Calendar.getInstance().getTime());
|
||||||
|
periodoVacacional.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
|
||||||
|
|
||||||
|
if (periodoVacacional.getPeriodovacacionalId() == null) {
|
||||||
|
periodoVacacionalService.suscribir(periodoVacacional);
|
||||||
|
periodoVacacionalList.addItem(periodoVacacional);
|
||||||
|
} else {
|
||||||
|
periodoVacacionalService.actualizacion(periodoVacacional);
|
||||||
|
periodoVacacionalList.updateItem(periodoVacacional);
|
||||||
|
}
|
||||||
|
|
||||||
|
Messagebox.show(
|
||||||
|
Labels.getLabel("editarPeriodoVacacionalController.MSG.suscribirOK"),
|
||||||
|
Labels.getLabel("editarPeriodoVacacionalController.window.title"),
|
||||||
|
Messagebox.OK, Messagebox.INFORMATION);
|
||||||
|
|
||||||
|
closeWindow();
|
||||||
|
} else {
|
||||||
|
Messagebox.show(
|
||||||
|
Labels.getLabel("MSG.Registro.Existe"),
|
||||||
|
Labels.getLabel("editarPeriodoVacacionalController.window.title"),
|
||||||
|
Messagebox.OK, Messagebox.EXCLAMATION);
|
||||||
|
}
|
||||||
|
} catch (Exception ex) {
|
||||||
|
log.error("editarPeriodoVacacionalController: " + ex);
|
||||||
|
Messagebox.show(
|
||||||
|
Labels.getLabel("MSG.Error"),
|
||||||
|
Labels.getLabel("editarPeriodoVacacionalController.window.title"),
|
||||||
|
Messagebox.OK, Messagebox.ERROR);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onClick$btnApagar(Event ev) {
|
||||||
|
try {
|
||||||
|
int resp = Messagebox.show(
|
||||||
|
Labels.getLabel("editarPeriodoVacacionalController.MSG.borrarPergunta"),
|
||||||
|
Labels.getLabel("editarPeriodoVacacionalController.window.title"),
|
||||||
|
Messagebox.YES | Messagebox.NO, Messagebox.QUESTION);
|
||||||
|
|
||||||
|
if (resp == Messagebox.YES) {
|
||||||
|
|
||||||
|
periodoVacacionalService.borrar(periodoVacacional);
|
||||||
|
|
||||||
|
Messagebox.show(
|
||||||
|
Labels.getLabel("editarPeriodoVacacionalController.MSG.borrarOK"),
|
||||||
|
Labels.getLabel("editarPeriodoVacacionalController.window.title"),
|
||||||
|
Messagebox.OK, Messagebox.INFORMATION);
|
||||||
|
|
||||||
|
periodoVacacionalList.removeItem(periodoVacacional);
|
||||||
|
|
||||||
|
closeWindow();
|
||||||
|
}
|
||||||
|
} catch (Exception ex) {
|
||||||
|
log.error(ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public PeriodoVacacional getPeriodoVacacional() {
|
||||||
|
return periodoVacacional;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPeriodoVacacional(PeriodoVacacional periodoVacacional) {
|
||||||
|
this.periodoVacacional = periodoVacacional;
|
||||||
|
}
|
||||||
|
|
||||||
|
public MyListbox getPeriodoVacacionalList() {
|
||||||
|
return periodoVacacionalList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPeriodoVacacionalList(MyListbox periodoVacacionalList) {
|
||||||
|
this.periodoVacacionalList = periodoVacacionalList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public PeriodoVacacionalService getPeriodoVacacionalService() {
|
||||||
|
return periodoVacacionalService;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPeriodoVacacionalService(PeriodoVacacionalService periodoVacacionalService) {
|
||||||
|
this.periodoVacacionalService = periodoVacacionalService;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,221 @@
|
||||||
|
/*
|
||||||
|
* To change this template, choose Tools | Templates
|
||||||
|
* and open the template in the editor.
|
||||||
|
*/
|
||||||
|
package com.rjconsultores.ventaboletos.web.gui.controladores.configuracioneccomerciales;
|
||||||
|
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.ConfigRestriccionPago;
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.FormaPago;
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.RestriccionPago;
|
||||||
|
import com.rjconsultores.ventaboletos.service.ConfigRestriccionPagoService;
|
||||||
|
import com.rjconsultores.ventaboletos.service.FormaPagoService;
|
||||||
|
import com.rjconsultores.ventaboletos.service.RestriccionPagoService;
|
||||||
|
import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.MyGenericForwardComposer;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.MyListbox;
|
||||||
|
import java.util.Calendar;
|
||||||
|
import java.util.List;
|
||||||
|
import org.apache.log4j.Logger;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.context.annotation.Scope;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.zkoss.util.resource.Labels;
|
||||||
|
import org.zkoss.zhtml.Messagebox;
|
||||||
|
import org.zkoss.zk.ui.Component;
|
||||||
|
import org.zkoss.zk.ui.Executions;
|
||||||
|
import org.zkoss.zk.ui.event.Event;
|
||||||
|
import org.zkoss.zul.Button;
|
||||||
|
import org.zkoss.zul.Combobox;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Administrador
|
||||||
|
*/
|
||||||
|
@Controller("editarRestriccionFormaPagoController")
|
||||||
|
@Scope("prototype")
|
||||||
|
public class EditarRestriccionFormaPagoController extends MyGenericForwardComposer {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private FormaPagoService formaPagoService;
|
||||||
|
@Autowired
|
||||||
|
private RestriccionPagoService restriccionPagoService;
|
||||||
|
@Autowired
|
||||||
|
private ConfigRestriccionPagoService configRestriccionPagoService;
|
||||||
|
private ConfigRestriccionPago configRestriccionPago;
|
||||||
|
private MyListbox restriccionFormaPagoList;
|
||||||
|
private List<FormaPago> lsFormaPago;
|
||||||
|
private List<RestriccionPago> lsRestriccionPago;
|
||||||
|
private Combobox cmbFormaPago;
|
||||||
|
private Combobox cmbRestriccionFormaPago;
|
||||||
|
private Button btnApagar;
|
||||||
|
private static Logger log = Logger.getLogger(EditarRestriccionFormaPagoController.class);
|
||||||
|
|
||||||
|
public Button getBtnApagar() {
|
||||||
|
return btnApagar;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBtnApagar(Button btnApagar) {
|
||||||
|
this.btnApagar = btnApagar;
|
||||||
|
}
|
||||||
|
|
||||||
|
public FormaPagoService getFormaPagoService() {
|
||||||
|
return formaPagoService;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFormaPagoService(FormaPagoService formaPagoService) {
|
||||||
|
this.formaPagoService = formaPagoService;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<FormaPago> getLsFormaPago() {
|
||||||
|
return lsFormaPago;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLsFormaPago(List<FormaPago> lsFormaPago) {
|
||||||
|
this.lsFormaPago = lsFormaPago;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<RestriccionPago> getLsRestriccionPago() {
|
||||||
|
return lsRestriccionPago;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLsRestriccionPago(List<RestriccionPago> lsRestriccionPago) {
|
||||||
|
this.lsRestriccionPago = lsRestriccionPago;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ConfigRestriccionPago getConfigRestriccionPago() {
|
||||||
|
return configRestriccionPago;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setConfigRestriccionPago(ConfigRestriccionPago configRestriccionPago) {
|
||||||
|
this.configRestriccionPago = configRestriccionPago;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Combobox getCmbFormaPago() {
|
||||||
|
return cmbFormaPago;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCmbFormaPago(Combobox cmbFormaPago) {
|
||||||
|
this.cmbFormaPago = cmbFormaPago;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Combobox getCmbRestriccionFormaPago() {
|
||||||
|
return cmbRestriccionFormaPago;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCmbRestriccionFormaPago(Combobox cmbRestriccionFormaPago) {
|
||||||
|
this.cmbRestriccionFormaPago = cmbRestriccionFormaPago;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void doAfterCompose(Component comp) throws Exception {
|
||||||
|
lsFormaPago = formaPagoService.obtenerTodos();
|
||||||
|
lsRestriccionPago = restriccionPagoService.obtenerTodos();
|
||||||
|
|
||||||
|
super.doAfterCompose(comp);
|
||||||
|
|
||||||
|
configRestriccionPago = (ConfigRestriccionPago) Executions.getCurrent().getArg().get("configRestriccionPago");
|
||||||
|
restriccionFormaPagoList = (MyListbox) Executions.getCurrent().getArg().get("configRestriccionFormaPagoList");
|
||||||
|
|
||||||
|
if (configRestriccionPago.getConfigrestriccionId() == null) {
|
||||||
|
btnApagar.setVisible(Boolean.FALSE);
|
||||||
|
}
|
||||||
|
|
||||||
|
cmbFormaPago.focus();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onClick$btnSalvar(Event ev) {
|
||||||
|
cmbFormaPago.getValue();
|
||||||
|
cmbRestriccionFormaPago.getValue();
|
||||||
|
|
||||||
|
|
||||||
|
try {
|
||||||
|
boolean puedoDarDeAlta = configRestriccionPagoService.puedoDarDeAlta(configRestriccionPago);
|
||||||
|
|
||||||
|
List<ConfigRestriccionPago> lsConfig = configRestriccionPagoService.buscar(configRestriccionPago.getFormaPago(), configRestriccionPago.getRestriccion());
|
||||||
|
|
||||||
|
boolean podeSalvar = false;
|
||||||
|
if (lsConfig.isEmpty()) {
|
||||||
|
podeSalvar = true;
|
||||||
|
} else {
|
||||||
|
for (ConfigRestriccionPago m : lsConfig) {
|
||||||
|
if (m.getConfigrestriccionId().equals(configRestriccionPago.getConfigrestriccionId())) {
|
||||||
|
podeSalvar = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!puedoDarDeAlta) {
|
||||||
|
|
||||||
|
Integer idRestricion = (configRestriccionPago.getRestriccion().getRestriccionId() == 1)
|
||||||
|
? 4
|
||||||
|
: (configRestriccionPago.getRestriccion().getRestriccionId() == 2)
|
||||||
|
? 5
|
||||||
|
: (configRestriccionPago.getRestriccion().getRestriccionId() == 3)
|
||||||
|
? 6 : 0;
|
||||||
|
RestriccionPago restriContraria = restriccionPagoService.obtenerID(idRestricion.shortValue());
|
||||||
|
String msg = "";
|
||||||
|
if (restriContraria != null) {
|
||||||
|
msg = restriContraria.getDescrestriccion();
|
||||||
|
}
|
||||||
|
|
||||||
|
Messagebox.show(
|
||||||
|
Labels.getLabel("editarRestriccionFormaPagoController.MSG.puedoDarDeAlta", new Object[]{msg}),
|
||||||
|
Labels.getLabel("editarRestriccionFormaPagoController.window.title"),
|
||||||
|
Messagebox.OK, Messagebox.EXCLAMATION);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (podeSalvar) {
|
||||||
|
configRestriccionPago.setActivo(Boolean.TRUE);
|
||||||
|
configRestriccionPago.setFecmodif(Calendar.getInstance().getTime());
|
||||||
|
configRestriccionPago.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
|
||||||
|
|
||||||
|
if (configRestriccionPago.getConfigrestriccionId() == null) {
|
||||||
|
configRestriccionPagoService.suscribir(configRestriccionPago);
|
||||||
|
restriccionFormaPagoList.addItem(configRestriccionPago);
|
||||||
|
} else {
|
||||||
|
configRestriccionPagoService.actualizacion(configRestriccionPago);
|
||||||
|
restriccionFormaPagoList.updateItem(configRestriccionPago);
|
||||||
|
}
|
||||||
|
|
||||||
|
Messagebox.show(
|
||||||
|
Labels.getLabel("editarRestriccionFormaPagoController.MSG.suscribirOK"),
|
||||||
|
Labels.getLabel("editarRestriccionFormaPagoController.window.title"),
|
||||||
|
Messagebox.OK, Messagebox.INFORMATION);
|
||||||
|
|
||||||
|
closeWindow();
|
||||||
|
} else {
|
||||||
|
Messagebox.show(
|
||||||
|
Labels.getLabel("MSG.Registro.Existe"),
|
||||||
|
Labels.getLabel("editarRestriccionFormaPagoController.window.title"),
|
||||||
|
Messagebox.OK, Messagebox.EXCLAMATION);
|
||||||
|
}
|
||||||
|
} catch (Exception ex) {
|
||||||
|
log.error(ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onClick$btnApagar(Event ev) {
|
||||||
|
try {
|
||||||
|
int resp = Messagebox.show(
|
||||||
|
Labels.getLabel("editarRestriccionFormaPagoController.MSG.borrarPergunta"),
|
||||||
|
Labels.getLabel("editarRestriccionFormaPagoController.window.title"),
|
||||||
|
Messagebox.YES | Messagebox.NO, Messagebox.QUESTION);
|
||||||
|
|
||||||
|
if (resp == Messagebox.YES) {
|
||||||
|
configRestriccionPagoService.borrar(configRestriccionPago);
|
||||||
|
|
||||||
|
Messagebox.show(
|
||||||
|
Labels.getLabel("editarRestriccionFormaPagoController.MSG.borrarOK"),
|
||||||
|
Labels.getLabel("editarRestriccionFormaPagoController.window.title"),
|
||||||
|
Messagebox.OK, Messagebox.INFORMATION);
|
||||||
|
|
||||||
|
restriccionFormaPagoList.removeItem(configRestriccionPago);
|
||||||
|
|
||||||
|
closeWindow();
|
||||||
|
}
|
||||||
|
} catch (Exception ex) {
|
||||||
|
log.error(ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,472 @@
|
||||||
|
/*
|
||||||
|
* To change this template, choose Tools | Templates
|
||||||
|
* and open the template in the editor.
|
||||||
|
*/
|
||||||
|
package com.rjconsultores.ventaboletos.web.gui.controladores.configuracioneccomerciales;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Calendar;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.Comparator;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.apache.log4j.Logger;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.context.annotation.Scope;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.zkoss.util.resource.Labels;
|
||||||
|
import org.zkoss.zhtml.Messagebox;
|
||||||
|
import org.zkoss.zk.ui.Component;
|
||||||
|
import org.zkoss.zk.ui.Executions;
|
||||||
|
import org.zkoss.zk.ui.event.Event;
|
||||||
|
import org.zkoss.zk.ui.util.Clients;
|
||||||
|
import org.zkoss.zul.Button;
|
||||||
|
import org.zkoss.zul.Checkbox;
|
||||||
|
import org.zkoss.zul.Longbox;
|
||||||
|
import org.zkoss.zul.Radio;
|
||||||
|
import org.zkoss.zul.Textbox;
|
||||||
|
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.CuponSecretaria;
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.Secretaria;
|
||||||
|
import com.rjconsultores.ventaboletos.service.CuponSecretariaService;
|
||||||
|
import com.rjconsultores.ventaboletos.service.SecretariaService;
|
||||||
|
import com.rjconsultores.ventaboletos.utilerias.TraslaparUtil;
|
||||||
|
import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.MyGenericForwardComposer;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.MyListbox;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.MyTextboxDecimal;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.render.RenderCuponSecretaria;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Administrador
|
||||||
|
*/
|
||||||
|
@Controller("editarSecretariaController")
|
||||||
|
@Scope("prototype")
|
||||||
|
public class EditarSecretariaController extends MyGenericForwardComposer {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private SecretariaService secretariaService;
|
||||||
|
private CuponSecretariaService cuponSecretariaService;
|
||||||
|
private Secretaria secretaria;
|
||||||
|
private List<CuponSecretaria> lsCuponSecretaria;
|
||||||
|
private MyListbox secretariaList;
|
||||||
|
private MyListbox cuponSecretariaList;
|
||||||
|
private Textbox txtDescSecretaria;
|
||||||
|
private Textbox txtCveSecretaria;
|
||||||
|
private MyTextboxDecimal txtPorcdescuento;
|
||||||
|
private Longbox txtNumfolioinicio;
|
||||||
|
private Longbox txtNumfoliofinal;
|
||||||
|
private Button btnApagar;
|
||||||
|
private Button btnAdicionarCuponSecretaria;
|
||||||
|
private Radio rdPrecioTotal;
|
||||||
|
private Radio rdPrecioDescuento;
|
||||||
|
private Radio rdDescuento;
|
||||||
|
private Checkbox chkValidaFolio;
|
||||||
|
private static Logger log = Logger.getLogger(EditarSecretariaController.class);
|
||||||
|
|
||||||
|
public Button getBtnApagar() {
|
||||||
|
return btnApagar;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBtnApagar(Button btnApagar) {
|
||||||
|
this.btnApagar = btnApagar;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Checkbox getChkValidaFolio() {
|
||||||
|
return chkValidaFolio;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setChkValidaFolio(Checkbox chkValidaFolio) {
|
||||||
|
this.chkValidaFolio = chkValidaFolio;
|
||||||
|
}
|
||||||
|
|
||||||
|
public MyListbox getCuponSecretariaList() {
|
||||||
|
return cuponSecretariaList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCuponSecretariaList(MyListbox cuponSecretariaList) {
|
||||||
|
this.cuponSecretariaList = cuponSecretariaList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Radio getRdDescuento() {
|
||||||
|
return rdDescuento;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRdDescuento(Radio rdDescuento) {
|
||||||
|
this.rdDescuento = rdDescuento;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Radio getRdPrecioDescuento() {
|
||||||
|
return rdPrecioDescuento;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRdPrecioDescuento(Radio rdPrecioDescuento) {
|
||||||
|
this.rdPrecioDescuento = rdPrecioDescuento;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Radio getRdPrecioTotal() {
|
||||||
|
return rdPrecioTotal;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRdPrecioTotal(Radio rdPrecioTotal) {
|
||||||
|
this.rdPrecioTotal = rdPrecioTotal;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Secretaria getSecretaria() {
|
||||||
|
return secretaria;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSecretaria(Secretaria secretaria) {
|
||||||
|
this.secretaria = secretaria;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Textbox getTxtCveSecretaria() {
|
||||||
|
return txtCveSecretaria;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTxtCveSecretaria(Textbox txtCveSecretaria) {
|
||||||
|
this.txtCveSecretaria = txtCveSecretaria;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Textbox getTxtDescSecretaria() {
|
||||||
|
return txtDescSecretaria;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTxtDescSecretaria(Textbox txtDescSecretaria) {
|
||||||
|
this.txtDescSecretaria = txtDescSecretaria;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Longbox getTxtNumfoliofinal() {
|
||||||
|
return txtNumfoliofinal;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTxtNumfoliofinal(Longbox txtNumfoliofinal) {
|
||||||
|
this.txtNumfoliofinal = txtNumfoliofinal;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Longbox getTxtNumfolioinicio() {
|
||||||
|
return txtNumfolioinicio;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTxtNumfolioinicio(Longbox txtNumfolioinicio) {
|
||||||
|
this.txtNumfolioinicio = txtNumfolioinicio;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public Button getBtnAdicionarCuponSecretaria() {
|
||||||
|
return btnAdicionarCuponSecretaria;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBtnAdicionarCuponSecretaria(Button btnAdicionarCuponSecretaria) {
|
||||||
|
this.btnAdicionarCuponSecretaria = btnAdicionarCuponSecretaria;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void doAfterCompose(Component comp) throws Exception {
|
||||||
|
super.doAfterCompose(comp);
|
||||||
|
|
||||||
|
secretaria =
|
||||||
|
(Secretaria) Executions.getCurrent().getArg().get("secretaria");
|
||||||
|
secretariaList =
|
||||||
|
(MyListbox) Executions.getCurrent().getArg().get("secretariaList");
|
||||||
|
|
||||||
|
cuponSecretariaList.setItemRenderer(new RenderCuponSecretaria());
|
||||||
|
lsCuponSecretaria = new ArrayList<CuponSecretaria>();
|
||||||
|
cuponSecretariaList.setData(lsCuponSecretaria);
|
||||||
|
|
||||||
|
if (secretaria.getSecretariaId() == null) {
|
||||||
|
btnApagar.setVisible(Boolean.FALSE);
|
||||||
|
} else {
|
||||||
|
secretaria = secretariaService.obtenerID(secretaria.getSecretariaId());
|
||||||
|
if (secretaria.getImprimeprecio().equals(Secretaria.DESCUENTO_COBRAR)) {
|
||||||
|
rdDescuento.setChecked(Boolean.TRUE);
|
||||||
|
} else if (secretaria.getImprimeprecio().equals(Secretaria.PRECIO_MENOS_DESCUENTO)) {
|
||||||
|
rdPrecioDescuento.setChecked(Boolean.TRUE);
|
||||||
|
} else if (secretaria.getImprimeprecio().equals(Secretaria.PRECIO_TOTAL)) {
|
||||||
|
rdPrecioTotal.setChecked(Boolean.TRUE);
|
||||||
|
}
|
||||||
|
|
||||||
|
chkValidaFolio.setChecked(secretaria.getValidafolio());
|
||||||
|
chkValidaFolio.setDisabled(Boolean.TRUE);
|
||||||
|
|
||||||
|
onClick$chkValidaFolio(null);
|
||||||
|
|
||||||
|
lsCuponSecretaria = secretaria.getLsCuponSecretaria();
|
||||||
|
cuponSecretariaList.setData(lsCuponSecretaria);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
txtDescSecretaria.focus();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onClick$chkValidaFolio(Event ev) {
|
||||||
|
if (chkValidaFolio.isChecked()) {
|
||||||
|
txtNumfolioinicio.setDisabled(Boolean.FALSE);
|
||||||
|
txtNumfoliofinal.setDisabled(Boolean.FALSE);
|
||||||
|
} else {
|
||||||
|
txtNumfolioinicio.setValue(null);
|
||||||
|
txtNumfoliofinal.setValue(null);
|
||||||
|
|
||||||
|
txtNumfolioinicio.setDisabled(Boolean.TRUE);
|
||||||
|
txtNumfoliofinal.setDisabled(Boolean.TRUE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onClick$btnSalvar(Event ev) throws InterruptedException {
|
||||||
|
txtDescSecretaria.getValue();
|
||||||
|
txtCveSecretaria.getValue();
|
||||||
|
|
||||||
|
try {
|
||||||
|
|
||||||
|
if (lsCuponSecretaria.isEmpty()) {
|
||||||
|
Messagebox.show(
|
||||||
|
Labels.getLabel("editarSecretariaController.MSG.necessaitaPorcentaje.value"),
|
||||||
|
Labels.getLabel("editarSecretariaController.window.title"),
|
||||||
|
Messagebox.OK, Messagebox.EXCLAMATION);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
secretaria.setActivo(true);
|
||||||
|
secretaria.setFecmodif(Calendar.getInstance().getTime());
|
||||||
|
secretaria.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
|
||||||
|
secretaria.setLsCuponSecretaria(lsCuponSecretaria);
|
||||||
|
secretaria.setValidafolio(chkValidaFolio.isChecked());
|
||||||
|
|
||||||
|
if (rdDescuento.isChecked()) {
|
||||||
|
secretaria.setImprimeprecio(Secretaria.DESCUENTO_COBRAR);
|
||||||
|
} else if (rdPrecioDescuento.isChecked()) {
|
||||||
|
secretaria.setImprimeprecio(Secretaria.PRECIO_MENOS_DESCUENTO);
|
||||||
|
} else if (rdPrecioTotal.isChecked()) {
|
||||||
|
secretaria.setImprimeprecio(Secretaria.PRECIO_TOTAL);
|
||||||
|
}
|
||||||
|
|
||||||
|
boolean podeSalvar = false;
|
||||||
|
List<Secretaria> lsSecretaria = secretariaService.buscar(secretaria.getDescsecretaria());
|
||||||
|
|
||||||
|
if (lsSecretaria.isEmpty()) {
|
||||||
|
podeSalvar = true;
|
||||||
|
} else {
|
||||||
|
for (Secretaria s : lsSecretaria) {
|
||||||
|
if (s.getSecretariaId().equals(secretaria.getSecretariaId())) {
|
||||||
|
podeSalvar = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (podeSalvar) {
|
||||||
|
if (secretaria.getSecretariaId() == null) {
|
||||||
|
secretariaService.suscribir(secretaria);
|
||||||
|
secretariaList.addItem(secretaria);
|
||||||
|
} else {
|
||||||
|
secretariaService.actualizacion(secretaria);
|
||||||
|
secretariaList.updateItem(secretaria);
|
||||||
|
}
|
||||||
|
Messagebox.show(
|
||||||
|
Labels.getLabel("editarSecretariaController.MSG.suscribirOK"),
|
||||||
|
Labels.getLabel("editarSecretariaController.window.title"),
|
||||||
|
Messagebox.OK, Messagebox.INFORMATION);
|
||||||
|
|
||||||
|
closeWindow();
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
Messagebox.show(
|
||||||
|
Labels.getLabel("MSG.Registro.Existe"),
|
||||||
|
Labels.getLabel("editarSecretariaController.window.title"),
|
||||||
|
Messagebox.OK, Messagebox.EXCLAMATION);
|
||||||
|
|
||||||
|
}
|
||||||
|
} catch (Exception ex) {
|
||||||
|
log.error(ex);
|
||||||
|
Messagebox.show(
|
||||||
|
Labels.getLabel("MSG.Error"),
|
||||||
|
Labels.getLabel("editarSecretariaController.window.title"),
|
||||||
|
Messagebox.OK, Messagebox.ERROR);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onClick$btnApagar(Event ev) throws InterruptedException {
|
||||||
|
try {
|
||||||
|
int resp = Messagebox.show(
|
||||||
|
Labels.getLabel("editarSecretariaController.MSG.borrarPergunta"),
|
||||||
|
Labels.getLabel("editarSecretariaController.window.title"),
|
||||||
|
Messagebox.YES | Messagebox.NO, Messagebox.QUESTION);
|
||||||
|
|
||||||
|
if (resp == Messagebox.YES) {
|
||||||
|
|
||||||
|
secretariaService.borrar(secretaria);
|
||||||
|
|
||||||
|
Messagebox.show(
|
||||||
|
Labels.getLabel("editarSecretariaController.MSG.borrarOK"),
|
||||||
|
Labels.getLabel("editarSecretariaController.window.title"),
|
||||||
|
Messagebox.OK, Messagebox.INFORMATION);
|
||||||
|
|
||||||
|
secretariaList.removeItem(secretaria);
|
||||||
|
|
||||||
|
closeWindow();
|
||||||
|
}
|
||||||
|
} catch (Exception ex) {
|
||||||
|
log.error(ex);
|
||||||
|
Messagebox.show(
|
||||||
|
Labels.getLabel("MSG.Error"),
|
||||||
|
Labels.getLabel("editarSecretariaController.window.title"),
|
||||||
|
Messagebox.OK, Messagebox.ERROR);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onClick$btnAdicionarCuponSecretaria(Event ev) throws InterruptedException {
|
||||||
|
txtPorcdescuento.setConstraint("no empty");
|
||||||
|
txtPorcdescuento.getValue();
|
||||||
|
|
||||||
|
if (txtPorcdescuento.getValueDecimal().compareTo(new BigDecimal("100")) > 0) {
|
||||||
|
Clients.wrongValue(txtPorcdescuento, Labels.getLabel("MSG.Porcentaje"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (chkValidaFolio.isChecked()) {
|
||||||
|
txtNumfolioinicio.setConstraint("no empty, no negative, no zero");
|
||||||
|
txtNumfoliofinal.setConstraint("no empty, no negative, no zero");
|
||||||
|
|
||||||
|
txtNumfolioinicio.getValue();
|
||||||
|
txtNumfoliofinal.getValue();
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
BigDecimal porcdescuento = BigDecimal.valueOf(Double.parseDouble(txtPorcdescuento.getValue()));
|
||||||
|
Long numfolioinicio = txtNumfolioinicio.getValue();
|
||||||
|
Long numfoliofinal = txtNumfoliofinal.getValue();
|
||||||
|
|
||||||
|
if (chkValidaFolio.isChecked() && (numfolioinicio > numfoliofinal)) {
|
||||||
|
Messagebox.show(
|
||||||
|
Labels.getLabel("MSG.Folios"),
|
||||||
|
Labels.getLabel("editarSecretariaController.window.title"),
|
||||||
|
Messagebox.OK, Messagebox.EXCLAMATION);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Boolean achou = Boolean.FALSE;
|
||||||
|
for (CuponSecretaria cds : secretaria.getLsCuponSecretaria()) {
|
||||||
|
if (cds.getNumfoliofinal() != null
|
||||||
|
&& cds.getNumfolioinicio() != null) {
|
||||||
|
if (cds.getNumfoliofinal().equals(numfoliofinal)
|
||||||
|
&& cds.getNumfolioinicio().equals(numfolioinicio)
|
||||||
|
&& cds.getPorcdescuento().equals(porcdescuento)) {
|
||||||
|
achou = Boolean.TRUE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!achou) {
|
||||||
|
CuponSecretaria cd = new CuponSecretaria();
|
||||||
|
cd.setActivo(Boolean.TRUE);
|
||||||
|
cd.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
|
||||||
|
cd.setFecmodif(Calendar.getInstance().getTime());
|
||||||
|
cd.setPorcdescuento(porcdescuento);
|
||||||
|
cd.setNumfolioinicio(numfolioinicio);
|
||||||
|
cd.setNumfoliofinal(numfoliofinal);
|
||||||
|
|
||||||
|
if (chkValidaFolio.isChecked()) {
|
||||||
|
int resp = registroDuplicado(numfolioinicio, numfoliofinal);
|
||||||
|
|
||||||
|
if (resp != 0) {
|
||||||
|
Messagebox.show(
|
||||||
|
(resp == 1) ? Labels.getLabel("MSG.Registro.Existe") : Labels.getLabel("editarSecretariaController.MSG.registroTraslapado"),
|
||||||
|
Labels.getLabel("editarSecretariaController.window.title"),
|
||||||
|
Messagebox.OK, Messagebox.EXCLAMATION);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (lsCuponSecretaria.size() >= 1) {
|
||||||
|
Messagebox.show(
|
||||||
|
Labels.getLabel("editarSecretariaController.MSG.pocentaje"),
|
||||||
|
Labels.getLabel("editarSecretariaController.window.title"),
|
||||||
|
Messagebox.OK, Messagebox.EXCLAMATION);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
lsCuponSecretaria.add(cd);
|
||||||
|
cuponSecretariaList.setData(lsCuponSecretaria);
|
||||||
|
secretaria.setLsCuponSecretaria(lsCuponSecretaria);
|
||||||
|
|
||||||
|
chkValidaFolio.setDisabled(Boolean.TRUE);
|
||||||
|
|
||||||
|
txtPorcdescuento.setConstraint("");
|
||||||
|
txtNumfolioinicio.setConstraint("");
|
||||||
|
txtNumfoliofinal.setConstraint("");
|
||||||
|
|
||||||
|
txtPorcdescuento.setText(null);
|
||||||
|
txtNumfolioinicio.setValue(null);
|
||||||
|
txtNumfoliofinal.setValue(null);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
Messagebox.show(
|
||||||
|
Labels.getLabel("MSG.Registro.Existe"),
|
||||||
|
Labels.getLabel("editarSecretariaController.window.title"),
|
||||||
|
Messagebox.OK, Messagebox.EXCLAMATION);
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch (Exception ex) {
|
||||||
|
log.error(ex);
|
||||||
|
Messagebox.show(
|
||||||
|
Labels.getLabel("MSG.Error"),
|
||||||
|
Labels.getLabel("editarSecretariaController.window.title"),
|
||||||
|
Messagebox.OK, Messagebox.ERROR);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
* 0 - Esta ok
|
||||||
|
* 1 - Registro duplicado
|
||||||
|
* 2 - Registro traslapado
|
||||||
|
* @throws InterruptedException
|
||||||
|
*/
|
||||||
|
private int registroDuplicado(Long folioIni, Long folioFin) throws InterruptedException {
|
||||||
|
Collections.sort(lsCuponSecretaria, new Comparator<CuponSecretaria>() {
|
||||||
|
|
||||||
|
public int compare(CuponSecretaria o1, CuponSecretaria o2) {
|
||||||
|
return o1.getNumfolioinicio().compareTo(o2.getNumfoliofinal());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
for (CuponSecretaria pv : lsCuponSecretaria) {
|
||||||
|
if (!pv.getActivo()) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (TraslaparUtil.intersectNum(pv.getNumfolioinicio().longValue(), pv.getNumfoliofinal().longValue(),
|
||||||
|
folioIni, folioFin)) {
|
||||||
|
return 2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onClick$btnRemoverCuponSecretaria(Event ev) {
|
||||||
|
CuponSecretaria cd = (CuponSecretaria) cuponSecretariaList.getSelected();
|
||||||
|
if (cd != null) {
|
||||||
|
cd.setActivo(Boolean.FALSE);
|
||||||
|
cd.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
|
||||||
|
cd.setFecmodif(Calendar.getInstance().getTime());
|
||||||
|
|
||||||
|
if (cd.getCuponsecretariaId() != null) {
|
||||||
|
cuponSecretariaService.borrar(cd);
|
||||||
|
}
|
||||||
|
|
||||||
|
lsCuponSecretaria.remove(cd);
|
||||||
|
|
||||||
|
if (lsCuponSecretaria.isEmpty()) {
|
||||||
|
btnAdicionarCuponSecretaria.setDisabled(Boolean.FALSE);
|
||||||
|
chkValidaFolio.setDisabled(Boolean.FALSE);
|
||||||
|
}
|
||||||
|
|
||||||
|
cuponSecretariaList.setData(lsCuponSecretaria);
|
||||||
|
secretaria.setLsCuponSecretaria(lsCuponSecretaria);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,221 @@
|
||||||
|
/*
|
||||||
|
* To change this template, choose Tools | Templates
|
||||||
|
* and open the template in the editor.
|
||||||
|
*/
|
||||||
|
package com.rjconsultores.ventaboletos.web.gui.controladores.configuracioneccomerciales;
|
||||||
|
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.Ciudad;
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.Moneda;
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.TipoCambioCiudad;
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.TipoCambioCtrl;
|
||||||
|
import com.rjconsultores.ventaboletos.service.MonedaService;
|
||||||
|
import com.rjconsultores.ventaboletos.service.TipoCambioCiudadService;
|
||||||
|
import com.rjconsultores.ventaboletos.service.TipoCambioCtrlService;
|
||||||
|
import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.MyComboboxCiudad;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.MyGenericForwardComposer;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.MyListbox;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.MyTextboxDecimal;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Calendar;
|
||||||
|
import java.util.List;
|
||||||
|
import org.apache.log4j.Logger;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.context.annotation.Scope;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.zkoss.util.resource.Labels;
|
||||||
|
import org.zkoss.zk.ui.Component;
|
||||||
|
import org.zkoss.zk.ui.Executions;
|
||||||
|
import org.zkoss.zk.ui.event.Event;
|
||||||
|
import org.zkoss.zul.Button;
|
||||||
|
import org.zkoss.zul.Combobox;
|
||||||
|
import org.zkoss.zul.Datebox;
|
||||||
|
import org.zkoss.zul.Messagebox;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Administrador
|
||||||
|
*
|
||||||
|
* Rafael: Nessa tela foi retirada a opção de adicionar varias cidades.
|
||||||
|
* Senda
|
||||||
|
*/
|
||||||
|
@Controller("editarTipoCambioCiudadController")
|
||||||
|
@Scope("prototype")
|
||||||
|
public class EditarTipoCambioCiudadController extends MyGenericForwardComposer {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private TipoCambioCtrlService tipoCambioCtrlService;
|
||||||
|
@Autowired
|
||||||
|
private TipoCambioCiudadService tipoCambioCiudadService;
|
||||||
|
@Autowired
|
||||||
|
private MonedaService monedaService;
|
||||||
|
private Ciudad ciudadSeleccionada;
|
||||||
|
private MyComboboxCiudad cmbCiudad;
|
||||||
|
private TipoCambioCtrl tipoCambioCtrl;
|
||||||
|
private MyListbox tipoCambioCiudadList;
|
||||||
|
private List<TipoCambioCiudad> lsTipoCambioCiudad;
|
||||||
|
private List<Moneda> lsMoneda;
|
||||||
|
private Button btnApagar;
|
||||||
|
private Datebox dtFecaplicacion;
|
||||||
|
private Combobox cmbMonedaOrigen;
|
||||||
|
private Combobox cmbMonedaDestino;
|
||||||
|
private MyTextboxDecimal decImportecambio;
|
||||||
|
private static Logger log = Logger.getLogger(EditarTipoCambioCiudadController.class);
|
||||||
|
|
||||||
|
public Button getBtnApagar() {
|
||||||
|
return btnApagar;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBtnApagar(Button btnApagar) {
|
||||||
|
this.btnApagar = btnApagar;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Combobox getCmbCiudad() {
|
||||||
|
return cmbCiudad;
|
||||||
|
}
|
||||||
|
|
||||||
|
public TipoCambioCtrl getTipoCambioCtrl() {
|
||||||
|
return tipoCambioCtrl;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTipoCambioCtrl(TipoCambioCtrl tipoCambioCtrl) {
|
||||||
|
this.tipoCambioCtrl = tipoCambioCtrl;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<Moneda> getLsMoneda() {
|
||||||
|
return lsMoneda;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLsMoneda(List<Moneda> lsMoneda) {
|
||||||
|
this.lsMoneda = lsMoneda;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void doAfterCompose(Component comp) throws Exception {
|
||||||
|
super.doAfterCompose(comp);
|
||||||
|
|
||||||
|
lsTipoCambioCiudad = new ArrayList<TipoCambioCiudad>();
|
||||||
|
lsMoneda = monedaService.obtenerTodos();
|
||||||
|
|
||||||
|
tipoCambioCtrl = (TipoCambioCtrl) Executions.getCurrent().getArg().get("tipoCambioCtrl");
|
||||||
|
tipoCambioCiudadList = (MyListbox) Executions.getCurrent().getArg().get("tipoCambioCiudadList");
|
||||||
|
|
||||||
|
if (tipoCambioCtrl.getTipocambioctrlId() == null) {
|
||||||
|
btnApagar.setVisible(Boolean.FALSE);
|
||||||
|
} else {
|
||||||
|
tipoCambioCtrl = tipoCambioCtrlService.obtenerID(tipoCambioCtrl.getTipocambioctrlId());
|
||||||
|
lsTipoCambioCiudad.addAll(tipoCambioCtrl.getTipoCambioCiudadList());
|
||||||
|
|
||||||
|
decImportecambio.setValue(tipoCambioCtrl.getImportecambio().setScale(2).toString());
|
||||||
|
|
||||||
|
if (lsTipoCambioCiudad.size() > 0) {
|
||||||
|
ciudadSeleccionada = lsTipoCambioCiudad.get(0).getCiudad();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
dtFecaplicacion.focus();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onClick$btnSalvar(Event ev) throws InterruptedException {
|
||||||
|
|
||||||
|
dtFecaplicacion.getValue();
|
||||||
|
cmbMonedaOrigen.getValue();
|
||||||
|
cmbMonedaDestino.getValue();
|
||||||
|
cmbCiudad.getValue();
|
||||||
|
decImportecambio.getValue();
|
||||||
|
|
||||||
|
try {
|
||||||
|
|
||||||
|
if (cmbCiudad.getSelectedItem() != null) {
|
||||||
|
lsTipoCambioCiudad = new ArrayList<TipoCambioCiudad>();
|
||||||
|
TipoCambioCiudad tc = new TipoCambioCiudad();
|
||||||
|
tc.setActivo(Boolean.TRUE);
|
||||||
|
tc.setFecmodif(Calendar.getInstance().getTime());
|
||||||
|
tc.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
|
||||||
|
tc.setTipoCambioCtrl(tipoCambioCtrl);
|
||||||
|
tc.setCiudad((Ciudad) cmbCiudad.getSelectedItem().getValue());
|
||||||
|
lsTipoCambioCiudad.add(tc);
|
||||||
|
} else {
|
||||||
|
Messagebox.show(
|
||||||
|
Labels.getLabel("editarTipoCambioCiudadController.MSG.necessitaCiudad"),
|
||||||
|
Labels.getLabel("editarTipoCambioCiudadController.window.title"),
|
||||||
|
Messagebox.OK, Messagebox.INFORMATION);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (lsTipoCambioCiudad.isEmpty()) {
|
||||||
|
Messagebox.show(
|
||||||
|
Labels.getLabel("editarTipoCambioCiudadController.MSG.necessitaCiudad"),
|
||||||
|
Labels.getLabel("editarTipoCambioCiudadController.window.title"),
|
||||||
|
Messagebox.OK, Messagebox.INFORMATION);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (cmbMonedaOrigen.getValue().equals(cmbMonedaDestino.getValue())) {
|
||||||
|
Messagebox.show(
|
||||||
|
Labels.getLabel("editarTipoCambioCiudadController.MSG.diferenteMoneda"),
|
||||||
|
Labels.getLabel("editarTipoCambioCiudadController.window.title"),
|
||||||
|
Messagebox.OK, Messagebox.INFORMATION);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
tipoCambioCtrl.setActivo(Boolean.TRUE);
|
||||||
|
tipoCambioCtrl.setFecmodif(Calendar.getInstance().getTime());
|
||||||
|
tipoCambioCtrl.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
|
||||||
|
tipoCambioCtrl.setTipoCambioCiudadList(lsTipoCambioCiudad);
|
||||||
|
|
||||||
|
if (tipoCambioCtrl.getTipocambioctrlId() == null) {
|
||||||
|
tipoCambioCtrlService.suscribir(tipoCambioCtrl);
|
||||||
|
tipoCambioCiudadList.addItem(tipoCambioCtrl);
|
||||||
|
} else {
|
||||||
|
tipoCambioCtrlService.actualizacion(tipoCambioCtrl);
|
||||||
|
tipoCambioCiudadList.updateItem(tipoCambioCtrl);
|
||||||
|
}
|
||||||
|
|
||||||
|
Messagebox.show(
|
||||||
|
Labels.getLabel("editarTipoCambioCiudadController.MSG.suscribirOK"),
|
||||||
|
Labels.getLabel("editarTipoCambioCiudadController.window.title"),
|
||||||
|
Messagebox.OK, Messagebox.INFORMATION);
|
||||||
|
|
||||||
|
closeWindow();
|
||||||
|
} catch (Exception ex) {
|
||||||
|
log.error("editarTipoCambioCiudadController: " + ex);
|
||||||
|
Messagebox.show(
|
||||||
|
Labels.getLabel("MSG.Error"),
|
||||||
|
Labels.getLabel("editarTipoCambioCiudadController.window.title"),
|
||||||
|
Messagebox.OK, Messagebox.ERROR);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onClick$btnApagar(Event ev) {
|
||||||
|
try {
|
||||||
|
int resp = Messagebox.show(
|
||||||
|
Labels.getLabel("editarTipoCambioCiudadController.MSG.borrarPergunta"),
|
||||||
|
Labels.getLabel("editarTipoCambioCiudadController.window.title"),
|
||||||
|
Messagebox.YES | Messagebox.NO, Messagebox.QUESTION);
|
||||||
|
|
||||||
|
if (resp == Messagebox.YES) {
|
||||||
|
tipoCambioCtrlService.borrar(tipoCambioCtrl);
|
||||||
|
|
||||||
|
Messagebox.show(
|
||||||
|
Labels.getLabel("editarTipoCambioCiudadController.MSG.borrarOK"),
|
||||||
|
Labels.getLabel("editarTipoCambioCiudadController.window.title"),
|
||||||
|
Messagebox.OK, Messagebox.INFORMATION);
|
||||||
|
|
||||||
|
tipoCambioCiudadList.removeItem(tipoCambioCtrl);
|
||||||
|
|
||||||
|
closeWindow();
|
||||||
|
}
|
||||||
|
} catch (Exception ex) {
|
||||||
|
log.error(ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public Ciudad getCiudadSeleccionada() {
|
||||||
|
return ciudadSeleccionada;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCiudadSeleccionada(Ciudad ciudadSeleccionada) {
|
||||||
|
this.ciudadSeleccionada = ciudadSeleccionada;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,198 @@
|
||||||
|
package com.rjconsultores.ventaboletos.web.gui.controladores.configuracioneccomerciales.cyberviaje;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* To change this template, choose Tools | Templates
|
||||||
|
* and open the template in the editor.
|
||||||
|
*/
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.ProdMarca;
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.ProductoServicio;
|
||||||
|
import com.rjconsultores.ventaboletos.service.EmpresaService;
|
||||||
|
import com.rjconsultores.ventaboletos.service.ProductoServicioService;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.MyGenericForwardComposer;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.MyListbox;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.paginacion.HibernateSearchObject;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.paginacion.PagedListWrapper;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.context.annotation.Scope;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.zkoss.util.resource.Labels;
|
||||||
|
import org.zkoss.zhtml.Messagebox;
|
||||||
|
import org.zkoss.zk.ui.Component;
|
||||||
|
import org.zkoss.zk.ui.event.Event;
|
||||||
|
import org.zkoss.zk.ui.event.EventListener;
|
||||||
|
import org.zkoss.zul.Listcell;
|
||||||
|
import org.zkoss.zul.Listitem;
|
||||||
|
import org.zkoss.zul.ListitemRenderer;
|
||||||
|
import org.zkoss.zul.Paging;
|
||||||
|
import org.zkoss.zul.Textbox;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Rafius
|
||||||
|
*/
|
||||||
|
@Controller("busquedaProductoServicioController")
|
||||||
|
@Scope("prototype")
|
||||||
|
public class BusquedaProductoServicioController extends MyGenericForwardComposer
|
||||||
|
implements ListitemRenderer {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private transient PagedListWrapper<ProductoServicio> plwProductoServicio;
|
||||||
|
@Autowired
|
||||||
|
private ProductoServicioService productoServicioService;
|
||||||
|
@Autowired
|
||||||
|
private EmpresaService empresaService;
|
||||||
|
private MyListbox productoServicioList;
|
||||||
|
private Paging pagingProductoServicio;
|
||||||
|
private List<ProductoServicio> lsProductoServicio;
|
||||||
|
private Textbox txtNome;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void doAfterCompose(Component comp) throws Exception {
|
||||||
|
|
||||||
|
super.doAfterCompose(comp);
|
||||||
|
|
||||||
|
productoServicioList.setItemRenderer(this);
|
||||||
|
productoServicioList.addEventListener("onDoubleClick", new EventListener() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onEvent(Event event) throws Exception {
|
||||||
|
ProductoServicio productoServicio = (ProductoServicio) productoServicioList.getSelected();
|
||||||
|
verProductoServicio(productoServicio);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
lsProductoServicio = new ArrayList<ProductoServicio>();
|
||||||
|
|
||||||
|
refreshLista();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onClick$btnPesquisa(Event ev) throws InterruptedException {
|
||||||
|
refreshLista();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onClick$btnRefresh(Event ev) {
|
||||||
|
refreshLista();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onClick$btnNovo(Event ev) {
|
||||||
|
verProductoServicio(new ProductoServicio());
|
||||||
|
}
|
||||||
|
|
||||||
|
private void refreshLista() {
|
||||||
|
HibernateSearchObject<ProductoServicio> productoServicioSearch =
|
||||||
|
new HibernateSearchObject<ProductoServicio>(ProductoServicio.class, pagingProductoServicio.getPageSize());
|
||||||
|
|
||||||
|
if (!txtNome.getValue().equals("")) {
|
||||||
|
productoServicioSearch.addFilterILike("descproductoservicio", "%" + txtNome.getValue() + "%");
|
||||||
|
}
|
||||||
|
|
||||||
|
productoServicioSearch.addFilterEqual("activo", Boolean.TRUE);
|
||||||
|
|
||||||
|
productoServicioSearch.addFilterEqual("indtipo", "S");
|
||||||
|
|
||||||
|
productoServicioSearch.addSortAsc("descproductoservicio");
|
||||||
|
|
||||||
|
plwProductoServicio.init(productoServicioSearch, productoServicioList, pagingProductoServicio);
|
||||||
|
|
||||||
|
if (productoServicioList.getData().length == 0) {
|
||||||
|
try {
|
||||||
|
Messagebox.show(Labels.getLabel("MSG.ningunRegistro"),
|
||||||
|
Labels.getLabel("busquedaProductoServicioController.window.title"),
|
||||||
|
Messagebox.OK, Messagebox.INFORMATION);
|
||||||
|
} catch (InterruptedException ex) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void verProductoServicio(ProductoServicio productoServicio) {
|
||||||
|
if (productoServicio == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Map args = new HashMap();
|
||||||
|
args.put("productoServicio", productoServicio);
|
||||||
|
args.put("productoServicioList", productoServicioList);
|
||||||
|
|
||||||
|
openWindow("/gui/configuraciones_comerciales/cyberviaje/editarProductoServicio.zul",
|
||||||
|
Labels.getLabel("editarProductoServicioController.window.title"), args, MODAL);
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<ProductoServicio> getLsProductoServicio() {
|
||||||
|
return lsProductoServicio;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLsProductoServicio(List<ProductoServicio> lsProductoServicio) {
|
||||||
|
this.lsProductoServicio = lsProductoServicio;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Paging getPagingProductoServicio() {
|
||||||
|
return pagingProductoServicio;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPagingProductoServicio(Paging pagingProductoServicio) {
|
||||||
|
this.pagingProductoServicio = pagingProductoServicio;
|
||||||
|
}
|
||||||
|
|
||||||
|
public PagedListWrapper<ProductoServicio> getPlwProductoServicioPunto() {
|
||||||
|
return plwProductoServicio;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPlwProductoServicioPunto(PagedListWrapper<ProductoServicio> plwProductoServicioPunto) {
|
||||||
|
this.plwProductoServicio = plwProductoServicioPunto;
|
||||||
|
}
|
||||||
|
|
||||||
|
public MyListbox getProductoServicioList() {
|
||||||
|
return productoServicioList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setProductoServicioList(MyListbox productoServicioList) {
|
||||||
|
this.productoServicioList = productoServicioList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ProductoServicioService getProductoServicioService() {
|
||||||
|
return productoServicioService;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setProductoServicioService(ProductoServicioService productoServicioService) {
|
||||||
|
this.productoServicioService = productoServicioService;
|
||||||
|
}
|
||||||
|
|
||||||
|
public EmpresaService getEmpresaService() {
|
||||||
|
return empresaService;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEmpresaService(EmpresaService empresaService) {
|
||||||
|
this.empresaService = empresaService;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Textbox getTxtNome() {
|
||||||
|
return txtNome;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTxtNome(Textbox txtNome) {
|
||||||
|
this.txtNome = txtNome;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void render(Listitem lstm, Object o) throws Exception {
|
||||||
|
ProductoServicio p = (ProductoServicio) o;
|
||||||
|
p = productoServicioService.obtenerID(p.getProductoservicioId());
|
||||||
|
|
||||||
|
Listcell lc = new Listcell();
|
||||||
|
|
||||||
|
lc = new Listcell(p.getProductoservicioId().toString());
|
||||||
|
lc.setParent(lstm);
|
||||||
|
|
||||||
|
if (p.getDescproductoservicio() != null) {
|
||||||
|
lc = new Listcell(p.getDescproductoservicio());
|
||||||
|
} else {
|
||||||
|
lc = new Listcell("-");
|
||||||
|
}
|
||||||
|
lc.setParent(lstm);
|
||||||
|
|
||||||
|
lstm.setAttribute("data", p);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,177 @@
|
||||||
|
/*
|
||||||
|
* To change this template, choose Tools | Templates
|
||||||
|
* and open the template in the editor.
|
||||||
|
*/
|
||||||
|
package com.rjconsultores.ventaboletos.web.gui.controladores.configuracioneccomerciales.cyberviaje;
|
||||||
|
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.ClaseServicio;
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.ProdClaseServicio;
|
||||||
|
import com.rjconsultores.ventaboletos.service.ClaseServicioService;
|
||||||
|
import com.rjconsultores.ventaboletos.service.ProdClaseServicioService;
|
||||||
|
import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.MyGenericForwardComposer;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.MyListbox;
|
||||||
|
import java.util.Calendar;
|
||||||
|
import java.util.List;
|
||||||
|
import org.apache.log4j.Logger;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.context.annotation.Scope;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.zkoss.util.resource.Labels;
|
||||||
|
import org.zkoss.zk.ui.Component;
|
||||||
|
import org.zkoss.zk.ui.Executions;
|
||||||
|
import org.zkoss.zk.ui.event.Event;
|
||||||
|
import org.zkoss.zul.Combobox;
|
||||||
|
import org.zkoss.zul.Messagebox;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Administrador
|
||||||
|
*/
|
||||||
|
@Controller("editarProdClaseServicioController")
|
||||||
|
@Scope("prototype")
|
||||||
|
public class EditarProdClaseServicioController extends MyGenericForwardComposer {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ProdClaseServicioService prodClaseServicioService;
|
||||||
|
@Autowired
|
||||||
|
private ClaseServicioService claseServicioService;
|
||||||
|
private List<ClaseServicio> lsClaseServicio;
|
||||||
|
private MyListbox prodClaseServicioList;
|
||||||
|
private Combobox cmbClaseServicio;
|
||||||
|
private ProdClaseServicio prodClaseServicio;
|
||||||
|
private List<ProdClaseServicio> lsProdClaseServicio;
|
||||||
|
private static Logger log = Logger.getLogger(EditarProdClaseServicioController.class);
|
||||||
|
|
||||||
|
public List<ClaseServicio> getLsClaseServicio() {
|
||||||
|
return lsClaseServicio;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLsClaseServicio(List<ClaseServicio> lsClaseServicio) {
|
||||||
|
this.lsClaseServicio = lsClaseServicio;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ProdClaseServicio getProdClaseServicio() {
|
||||||
|
return prodClaseServicio;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setProdClaseServicio(ProdClaseServicio prodClaseServicio) {
|
||||||
|
this.prodClaseServicio = prodClaseServicio;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void doAfterCompose(Component comp) throws Exception {
|
||||||
|
lsClaseServicio = claseServicioService.obtenerTodos();
|
||||||
|
lsProdClaseServicio = (List<ProdClaseServicio>) Executions.getCurrent().getArg().get("lsProdClaseServicio");
|
||||||
|
prodClaseServicio = (ProdClaseServicio) Executions.getCurrent().getArg().get("prodClaseServicio");
|
||||||
|
prodClaseServicioList = (MyListbox) Executions.getCurrent().getArg().get("prodClaseServicioList");
|
||||||
|
|
||||||
|
super.doAfterCompose(comp);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onClick$btnAdicionar(Event ev) throws Exception {
|
||||||
|
|
||||||
|
cmbClaseServicio.getValue();
|
||||||
|
|
||||||
|
try {
|
||||||
|
|
||||||
|
if (prodClaseServicio.getClaseServicio() == null) {
|
||||||
|
Messagebox.show(
|
||||||
|
Labels.getLabel("MSG.Error.combobox"),
|
||||||
|
Labels.getLabel("editarProductoServicioController.windowProdClaseServicio.title"),
|
||||||
|
Messagebox.OK, Messagebox.ERROR);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (prodClaseServicio.getProdclaseservicioId() != null) {
|
||||||
|
if (registroDuplicado()) {
|
||||||
|
Messagebox.show(
|
||||||
|
Labels.getLabel("editarPricingController.MSG.categoriaExiste"),
|
||||||
|
Labels.getLabel("editarProductoServicioController.windowProdClaseServicio.title"),
|
||||||
|
Messagebox.OK, Messagebox.EXCLAMATION);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
prodClaseServicioService.actualizacion(prodClaseServicio);
|
||||||
|
prodClaseServicioList.updateItem(prodClaseServicio);
|
||||||
|
lsProdClaseServicio.add(prodClaseServicio);
|
||||||
|
} else {
|
||||||
|
if (registroDuplicado()) {
|
||||||
|
Messagebox.show(
|
||||||
|
Labels.getLabel("editarPricingController.MSG.categoriaExiste"),
|
||||||
|
Labels.getLabel("editarProductoServicioController.windowProdClaseServicio.title"),
|
||||||
|
Messagebox.OK, Messagebox.EXCLAMATION);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
prodClaseServicioService.suscribir(prodClaseServicio);
|
||||||
|
prodClaseServicioList.addItem(prodClaseServicio);
|
||||||
|
lsProdClaseServicio.add(prodClaseServicio);
|
||||||
|
}
|
||||||
|
|
||||||
|
closeWindow();
|
||||||
|
} catch (Exception ex) {
|
||||||
|
log.error(ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean registroDuplicado() throws InterruptedException {
|
||||||
|
for (ProdClaseServicio p : lsProdClaseServicio) {
|
||||||
|
if (!p.getActivo()){
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (p.getClaseServicio().getDescclase().equals(prodClaseServicio.getClaseServicio().getDescclase())) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onClick$btnRemover(Event ev) {
|
||||||
|
try {
|
||||||
|
Integer resp = Messagebox.show(
|
||||||
|
Labels.getLabel("editarProdClaseServicioController.MSG.borrarPergunta"),
|
||||||
|
Labels.getLabel("editarProductoServicioController.windowProdClaseServicio.title"),
|
||||||
|
Messagebox.YES | Messagebox.NO, Messagebox.QUESTION);
|
||||||
|
|
||||||
|
if (resp.equals(Messagebox.YES)) {
|
||||||
|
prodClaseServicio.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
|
||||||
|
prodClaseServicio.setFecmodif(Calendar.getInstance().getTime());
|
||||||
|
prodClaseServicio.setActivo(Boolean.FALSE);
|
||||||
|
|
||||||
|
prodClaseServicioList.removeItem(prodClaseServicio);
|
||||||
|
prodClaseServicioService.borrar(prodClaseServicio);
|
||||||
|
|
||||||
|
Messagebox.show(
|
||||||
|
Labels.getLabel("editarProdClaseServicioController.MSG.borrarSucesso"),
|
||||||
|
Labels.getLabel("editarProductoServicioController.windowProdClaseServicio.title"),
|
||||||
|
Messagebox.YES, Messagebox.EXCLAMATION);
|
||||||
|
|
||||||
|
closeWindow();
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch (Exception ex) {
|
||||||
|
log.error(ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public Combobox getCmbClaseServicio() {
|
||||||
|
return cmbClaseServicio;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCmbClaseServicio(Combobox cmbClaseServicio) {
|
||||||
|
this.cmbClaseServicio = cmbClaseServicio;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the lsProdClaseServicio
|
||||||
|
*/
|
||||||
|
public List<ProdClaseServicio> getLsProdClaseServicio() {
|
||||||
|
return lsProdClaseServicio;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param lsProdClaseServicio the lsProdClaseServicio to set
|
||||||
|
*/
|
||||||
|
public void setLsProdClaseServicio(List<ProdClaseServicio> lsProdClaseServicio) {
|
||||||
|
this.lsProdClaseServicio = lsProdClaseServicio;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,167 @@
|
||||||
|
/*
|
||||||
|
* To change this template, choose Tools | Templates
|
||||||
|
* and open the template in the editor.
|
||||||
|
*/
|
||||||
|
package com.rjconsultores.ventaboletos.web.gui.controladores.configuracioneccomerciales.cyberviaje;
|
||||||
|
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.FormaPago;
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.ProdFormaPago;
|
||||||
|
import com.rjconsultores.ventaboletos.service.FormaPagoService;
|
||||||
|
import com.rjconsultores.ventaboletos.service.ProdFormaPagoService;
|
||||||
|
import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.MyGenericForwardComposer;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.MyListbox;
|
||||||
|
import java.util.Calendar;
|
||||||
|
import java.util.List;
|
||||||
|
import org.apache.log4j.Logger;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.context.annotation.Scope;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.zkoss.util.resource.Labels;
|
||||||
|
import org.zkoss.zhtml.Messagebox;
|
||||||
|
import org.zkoss.zk.ui.Component;
|
||||||
|
import org.zkoss.zk.ui.Executions;
|
||||||
|
import org.zkoss.zk.ui.event.Event;
|
||||||
|
import org.zkoss.zul.Combobox;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Administrador
|
||||||
|
*/
|
||||||
|
@Controller("editarProdFormaPagoController")
|
||||||
|
@Scope("prototype")
|
||||||
|
public class EditarProdFormaPagoController extends MyGenericForwardComposer {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ProdFormaPagoService prodFormaPagoService;
|
||||||
|
@Autowired
|
||||||
|
private FormaPagoService formaPagoService;
|
||||||
|
private List<FormaPago> lsFormaPago;
|
||||||
|
private MyListbox prodFormaPagoList;
|
||||||
|
private Combobox cmbProdFormaPago;
|
||||||
|
private ProdFormaPago prodFormaPago;
|
||||||
|
private List<ProdFormaPago> lsProdFormaPago;
|
||||||
|
private static Logger log = Logger.getLogger(EditarProdFormaPagoController.class);
|
||||||
|
|
||||||
|
public List<FormaPago> getLsFormaPago() {
|
||||||
|
return lsFormaPago;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLsFormaPago(List<FormaPago> lsFormaPago) {
|
||||||
|
this.lsFormaPago = lsFormaPago;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ProdFormaPago getProdFormaPago() {
|
||||||
|
return prodFormaPago;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setProdFormaPago(ProdFormaPago prodFormaPago) {
|
||||||
|
this.prodFormaPago = prodFormaPago;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void doAfterCompose(Component comp) throws Exception {
|
||||||
|
lsFormaPago = formaPagoService.buscarFormasPagoExceptoEspeciales();
|
||||||
|
lsProdFormaPago = (List<ProdFormaPago>) Executions.getCurrent().getArg().get("lsProdFormaPago");
|
||||||
|
prodFormaPago = (ProdFormaPago) Executions.getCurrent().getArg().get("prodFormaPago");
|
||||||
|
prodFormaPagoList = (MyListbox) Executions.getCurrent().getArg().get("prodFormaPagoList");
|
||||||
|
|
||||||
|
super.doAfterCompose(comp);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onClick$btnAdicionar(Event ev) throws Exception {
|
||||||
|
cmbProdFormaPago.getValue();
|
||||||
|
try {
|
||||||
|
|
||||||
|
if (prodFormaPago.getFormaPago() == null) {
|
||||||
|
Messagebox.show(
|
||||||
|
Labels.getLabel("MSG.Error.combobox"),
|
||||||
|
Labels.getLabel("editarProdFormaPagoController.winEditarProdFormaPago.title"),
|
||||||
|
Messagebox.OK, Messagebox.ERROR);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (prodFormaPago.getProdformapagoId() != null) {
|
||||||
|
if (registroDuplicado()) {
|
||||||
|
Messagebox.show(
|
||||||
|
Labels.getLabel("editarPricingController.MSG.categoriaExiste"),
|
||||||
|
Labels.getLabel("editarProdFormaPagoController.winEditarProdFormaPago.title"),
|
||||||
|
Messagebox.OK, Messagebox.EXCLAMATION);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
prodFormaPagoService.actualizacion(prodFormaPago);
|
||||||
|
lsProdFormaPago.add(prodFormaPago);
|
||||||
|
prodFormaPagoList.updateItem(prodFormaPago);
|
||||||
|
} else {
|
||||||
|
if (registroDuplicado()) {
|
||||||
|
Messagebox.show(
|
||||||
|
Labels.getLabel("editarPricingController.MSG.categoriaExiste"),
|
||||||
|
Labels.getLabel("editarProdFormaPagoController.winEditarProdFormaPago.title"),
|
||||||
|
Messagebox.OK, Messagebox.EXCLAMATION);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
prodFormaPagoService.suscribir(prodFormaPago);
|
||||||
|
lsProdFormaPago.add(prodFormaPago);
|
||||||
|
prodFormaPagoList.addItem(prodFormaPago);
|
||||||
|
}
|
||||||
|
|
||||||
|
closeWindow();
|
||||||
|
} catch (Exception ex) {
|
||||||
|
log.error(ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean registroDuplicado() throws InterruptedException {
|
||||||
|
for (ProdFormaPago p : lsProdFormaPago) {
|
||||||
|
if (!p.getActivo()){
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (p.getFormaPago().getDescpago().equals(prodFormaPago.getFormaPago().getDescpago())) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onClick$btnRemover(Event ev) {
|
||||||
|
try {
|
||||||
|
Integer resp = Messagebox.show(
|
||||||
|
Labels.getLabel("editarProdFormaPagoController.MSG.borrarPergunta"),
|
||||||
|
Labels.getLabel("editarProdFormaPagoController.winEditarProdFormaPago.title"),
|
||||||
|
Messagebox.YES | Messagebox.NO, Messagebox.QUESTION);
|
||||||
|
|
||||||
|
if (resp.equals(Messagebox.YES)) {
|
||||||
|
prodFormaPago.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
|
||||||
|
prodFormaPago.setFecmodif(Calendar.getInstance().getTime());
|
||||||
|
prodFormaPago.setActivo(Boolean.FALSE);
|
||||||
|
|
||||||
|
prodFormaPagoList.removeItem(prodFormaPago);
|
||||||
|
prodFormaPagoService.borrar(prodFormaPago);
|
||||||
|
|
||||||
|
Messagebox.show(
|
||||||
|
Labels.getLabel("editarProdFormaPagoController.MSG.borrarSucesso"),
|
||||||
|
Labels.getLabel("editarProdFormaPagoController.winEditarProdFormaPago.title"),
|
||||||
|
Messagebox.YES, Messagebox.EXCLAMATION);
|
||||||
|
|
||||||
|
closeWindow();
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch (Exception ex) {
|
||||||
|
log.error(ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the lsProdFormaPago
|
||||||
|
*/
|
||||||
|
public List<ProdFormaPago> getLsProdFormaPago() {
|
||||||
|
return lsProdFormaPago;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param lsProdFormaPago the lsProdFormaPago to set
|
||||||
|
*/
|
||||||
|
public void setLsProdFormaPago(List<ProdFormaPago> lsProdFormaPago) {
|
||||||
|
this.lsProdFormaPago = lsProdFormaPago;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,302 @@
|
||||||
|
/*
|
||||||
|
* To change this template, choose Tools | Templates
|
||||||
|
* and open the template in the editor.
|
||||||
|
*/
|
||||||
|
package com.rjconsultores.ventaboletos.web.gui.controladores.configuracioneccomerciales.cyberviaje;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Calendar;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.Comparator;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.apache.log4j.Logger;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.context.annotation.Scope;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.zkoss.util.resource.Labels;
|
||||||
|
import org.zkoss.zhtml.Messagebox;
|
||||||
|
import org.zkoss.zk.ui.Component;
|
||||||
|
import org.zkoss.zk.ui.Executions;
|
||||||
|
import org.zkoss.zk.ui.event.Event;
|
||||||
|
import org.zkoss.zk.ui.util.Clients;
|
||||||
|
import org.zkoss.zul.Combobox;
|
||||||
|
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.Marca;
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.ProdMarca;
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.ProdPrecio;
|
||||||
|
import com.rjconsultores.ventaboletos.service.MarcaService;
|
||||||
|
import com.rjconsultores.ventaboletos.service.ProdMarcaService;
|
||||||
|
import com.rjconsultores.ventaboletos.service.ProdPrecioService;
|
||||||
|
import com.rjconsultores.ventaboletos.utilerias.TraslaparUtil;
|
||||||
|
import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.MyGenericForwardComposer;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.MyListbox;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.MyTextboxDecimal;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.render.RenderCyberViajeProdPrecio;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Administrador
|
||||||
|
*/
|
||||||
|
@Controller("editarProdMarcaController")
|
||||||
|
@Scope("prototype")
|
||||||
|
public class EditarProdMarcaController extends MyGenericForwardComposer {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ProdMarcaService prodMarcaService;
|
||||||
|
@Autowired
|
||||||
|
private MarcaService marcaService;
|
||||||
|
@Autowired
|
||||||
|
private ProdPrecioService prodPrecioService;
|
||||||
|
private List<Marca> lsMarca;
|
||||||
|
private MyListbox prodMarcaList;
|
||||||
|
private ProdMarca prodMarca;
|
||||||
|
private Combobox cmbProdMarca;
|
||||||
|
private List<ProdMarca> lsProdMarca;
|
||||||
|
private MyListbox prodPrecioList;
|
||||||
|
private List<ProdPrecio> lsProdPrecio;
|
||||||
|
private MyTextboxDecimal txtImporteInicial;
|
||||||
|
private MyTextboxDecimal txtImporteFinal;
|
||||||
|
private MyTextboxDecimal tarifa;
|
||||||
|
private static Logger log = Logger.getLogger(EditarProdMarcaController.class);
|
||||||
|
|
||||||
|
public List<Marca> getLsMarca() {
|
||||||
|
return lsMarca;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLsMarca(List<Marca> lsMarca) {
|
||||||
|
this.lsMarca = lsMarca;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ProdMarca getProdMarca() {
|
||||||
|
return prodMarca;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setProdMarca(ProdMarca prodMarca) {
|
||||||
|
this.prodMarca = prodMarca;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void doAfterCompose(Component comp) throws Exception {
|
||||||
|
lsProdPrecio = new ArrayList<ProdPrecio>();
|
||||||
|
lsMarca = marcaService.obtenerTodos();
|
||||||
|
lsProdMarca = (List<ProdMarca>) Executions.getCurrent().getArg().get("lsProdMarca");
|
||||||
|
prodMarca = (ProdMarca) Executions.getCurrent().getArg().get("prodMarca");
|
||||||
|
prodMarcaList = (MyListbox) Executions.getCurrent().getArg().get("prodMarcaList");
|
||||||
|
|
||||||
|
if (prodMarca.getProdmarcaId() != null) {
|
||||||
|
lsProdPrecio = prodPrecioService.buscar(prodMarca.getMarca(), prodMarca.getProductoServicio());
|
||||||
|
}
|
||||||
|
super.doAfterCompose(comp);
|
||||||
|
|
||||||
|
prodPrecioList.setItemRenderer(new RenderCyberViajeProdPrecio());
|
||||||
|
prodPrecioList.setData(lsProdPrecio);
|
||||||
|
habilitarCombo();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void habilitarCombo() {
|
||||||
|
cmbProdMarca.setDisabled(!lsProdPrecio.isEmpty());
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onClick$btnApagarProdPrecio(Event ev) throws Exception {
|
||||||
|
if (prodPrecioList.getSelected() == null) {
|
||||||
|
Clients.alert(Labels.getLabel("editarProdMarcaController.MSG.seleccionarUnImporte"), Labels.getLabel("editarProdMarcaController.winEditarProdMarca.title"), Messagebox.INFORMATION);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
ProdPrecio selected = (ProdPrecio) prodPrecioList.getSelected();
|
||||||
|
prodPrecioService.borrar(selected);
|
||||||
|
lsProdPrecio.remove(selected);
|
||||||
|
prodPrecioList.setData(lsProdPrecio);
|
||||||
|
habilitarCombo();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onClick$btnNovoProdPrecio(Event ev) throws Exception {
|
||||||
|
|
||||||
|
txtImporteInicial.setConstraint("no empty");
|
||||||
|
txtImporteFinal.setConstraint("no empty");
|
||||||
|
tarifa.setConstraint("no empty");
|
||||||
|
|
||||||
|
cmbProdMarca.getValue();
|
||||||
|
txtImporteInicial.getValue();
|
||||||
|
txtImporteFinal.getValue();
|
||||||
|
tarifa.getValue();
|
||||||
|
|
||||||
|
|
||||||
|
if ((txtImporteInicial.getValueDecimal() == null) || (txtImporteFinal.getValueDecimal() == null)) {
|
||||||
|
Clients.alert(Labels.getLabel("editarProdMarcaController.MSG.valoresImportes"),
|
||||||
|
Labels.getLabel("editarProdMarcaController.winEditarProdMarca.title"),
|
||||||
|
Messagebox.INFORMATION);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Collections.sort(lsProdPrecio, new Comparator<ProdPrecio>() {
|
||||||
|
|
||||||
|
public int compare(ProdPrecio o1, ProdPrecio o2) {
|
||||||
|
return o1.getImporteinicial().compareTo(o2.getImporteinicial());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
boolean traslapa = false;
|
||||||
|
for (ProdPrecio pp : lsProdPrecio) {
|
||||||
|
if (TraslaparUtil.intersectNum(pp.getImporteinicial(), pp.getImportefinal(), txtImporteInicial.getValueDecimal(), txtImporteFinal.getValueDecimal())) {
|
||||||
|
traslapa = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (traslapa) {
|
||||||
|
Clients.alert(Labels.getLabel("editarProdMarcaController.MSG.conflitoVigencias"),
|
||||||
|
Labels.getLabel("editarProdMarcaController.winEditarProdMarca.title"),
|
||||||
|
Messagebox.INFORMATION);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
ProdPrecio prodPrecio = new ProdPrecio();
|
||||||
|
prodPrecio.setMarca(prodMarca.getMarca());
|
||||||
|
prodPrecio.setProductoservicio(prodMarca.getProductoServicio());
|
||||||
|
prodPrecio.setImportefinal(txtImporteFinal.getValueDecimal());
|
||||||
|
prodPrecio.setImporteinicial(txtImporteInicial.getValueDecimal());
|
||||||
|
prodPrecio.setPrecio(tarifa.getValueDecimal());
|
||||||
|
lsProdPrecio.add(prodPrecio);
|
||||||
|
prodPrecioList.setData(lsProdPrecio);
|
||||||
|
|
||||||
|
txtImporteInicial.setConstraint("");
|
||||||
|
txtImporteFinal.setConstraint("");
|
||||||
|
tarifa.setConstraint("");
|
||||||
|
|
||||||
|
txtImporteInicial.setValue(null);
|
||||||
|
txtImporteFinal.setValue(null);
|
||||||
|
tarifa.setValue(null);
|
||||||
|
|
||||||
|
habilitarCombo();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onClick$btnAdicionar(Event ev) throws Exception {
|
||||||
|
cmbProdMarca.getValue();
|
||||||
|
try {
|
||||||
|
|
||||||
|
if (prodMarca.getMarca() == null) {
|
||||||
|
Messagebox.show(
|
||||||
|
Labels.getLabel("MSG.Error.combobox"),
|
||||||
|
Labels.getLabel("editarProdMarcaController.winEditarProdMarca.title"),
|
||||||
|
Messagebox.OK, Messagebox.EXCLAMATION);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (prodPrecioList.getData().length == 0) {
|
||||||
|
Messagebox.show(
|
||||||
|
Labels.getLabel("editarProdMarcaController.MSG.necesitaImporte"),
|
||||||
|
Labels.getLabel("editarProdMarcaController.winEditarProdMarca.title"),
|
||||||
|
Messagebox.OK, Messagebox.EXCLAMATION);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (prodMarca.getProdmarcaId() != null) {
|
||||||
|
if (registroDuplicado()) {
|
||||||
|
Messagebox.show(
|
||||||
|
Labels.getLabel("editarPricingController.MSG.categoriaExiste"),
|
||||||
|
Labels.getLabel("editarProdMarcaController.winEditarProdMarca.title"),
|
||||||
|
Messagebox.OK, Messagebox.EXCLAMATION);
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
prodMarcaService.actualizacion(prodMarca, lsProdPrecio);
|
||||||
|
prodMarcaList.updateItem(prodMarca);
|
||||||
|
lsProdMarca.add(prodMarca);
|
||||||
|
} else {
|
||||||
|
if (registroDuplicado()) {
|
||||||
|
Messagebox.show(
|
||||||
|
Labels.getLabel("editarPricingController.MSG.categoriaExiste"),
|
||||||
|
Labels.getLabel("editarProdMarcaController.winEditarProdMarca.title"),
|
||||||
|
Messagebox.OK, Messagebox.EXCLAMATION);
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
prodMarcaService.suscribir(prodMarca, lsProdPrecio);
|
||||||
|
prodMarcaList.addItem(prodMarca);
|
||||||
|
lsProdMarca.add(prodMarca);
|
||||||
|
}
|
||||||
|
Messagebox.show(
|
||||||
|
Labels.getLabel("editarProdMarcaController.MSG.salvarOk"),
|
||||||
|
Labels.getLabel("editarProdMarcaController.winEditarProdMarca.title"),
|
||||||
|
Messagebox.OK, Messagebox.INFORMATION);
|
||||||
|
|
||||||
|
closeWindow();
|
||||||
|
} catch (Exception ex) {
|
||||||
|
log.error(ex);
|
||||||
|
Messagebox.show(
|
||||||
|
Labels.getLabel("MSG.Error"),
|
||||||
|
Labels.getLabel("editarProdMarcaController.winEditarProdMarca.title"),
|
||||||
|
Messagebox.OK, Messagebox.ERROR);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean registroDuplicado() throws InterruptedException {
|
||||||
|
for (ProdMarca p : lsProdMarca) {
|
||||||
|
if (!p.getActivo()) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
Boolean igualID = Boolean.FALSE;
|
||||||
|
if (prodMarca.getProdmarcaId() != null) {
|
||||||
|
igualID = prodMarca.getProdmarcaId().equals(p.getProdmarcaId());
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((p.getMarca().getDescmarca().equals(prodMarca.getMarca().getDescmarca()))
|
||||||
|
&& (!igualID)) {
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onClick$btnRemover(Event ev) throws InterruptedException {
|
||||||
|
try {
|
||||||
|
Integer resp = Messagebox.show(
|
||||||
|
Labels.getLabel("editarProdMarcaController.MSG.borrarPergunta"),
|
||||||
|
Labels.getLabel("editarProdMarcaController.winEditarProdMarca.title"),
|
||||||
|
Messagebox.YES | Messagebox.NO, Messagebox.QUESTION);
|
||||||
|
|
||||||
|
if (resp.equals(Messagebox.YES)) {
|
||||||
|
prodMarca.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
|
||||||
|
prodMarca.setFecmodif(Calendar.getInstance().getTime());
|
||||||
|
prodMarca.setActivo(Boolean.FALSE);
|
||||||
|
|
||||||
|
prodMarcaList.removeItem(prodMarca);
|
||||||
|
prodMarcaService.borrar(prodMarca);
|
||||||
|
|
||||||
|
Messagebox.show(
|
||||||
|
Labels.getLabel("editarProdMarcaController.MSG.borrarSucesso"),
|
||||||
|
Labels.getLabel("editarProdMarcaController.winEditarProdMarca.title"),
|
||||||
|
Messagebox.YES, Messagebox.EXCLAMATION);
|
||||||
|
|
||||||
|
closeWindow();
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch (Exception ex) {
|
||||||
|
log.error(ex);
|
||||||
|
Messagebox.show(
|
||||||
|
Labels.getLabel("MSG.Error"),
|
||||||
|
Labels.getLabel("editarProdMarcaController.winEditarProdMarca.title"),
|
||||||
|
Messagebox.OK, Messagebox.ERROR);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the lsProdMarca
|
||||||
|
*/
|
||||||
|
public List<ProdMarca> getLsProdMarca() {
|
||||||
|
return lsProdMarca;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param lsProdMarca the lsProdMarca to set
|
||||||
|
*/
|
||||||
|
public void setLsProdMarca(List<ProdMarca> lsProdMarca) {
|
||||||
|
this.lsProdMarca = lsProdMarca;
|
||||||
|
}
|
||||||
|
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue